linux之网络配置相关
2016-02-29 13:45
435 查看
ubuntu的网络配置文件在 /etc/network/intrfaces;
suse的网络配置在 /etc/sysconfig/network/下面,每个网卡一个配置文件。
intrfaces如下内容表示使用DHCP分配IP:
Dynamic Host Configuration Protocol (DHCP) is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet mask and default gateway.
修改为如下表示配置静态IP地址:
# The primary network interface
auto eth0
#iface eth0 inet dhcp
注意:只需要设置address(IP地址)、netmask(子网掩码)、gateway(网关)这三项就OK,network和broadcast这两项参数是可以不写的。
设置DNS服务器
都在/etc/resolv.conf这个文件内配置。
内容:
nameserver 192.168.80.2
nameserver 8.8.8.8
保存退出。
注意:重启Ubuntu后发现又不能上网了,问题出在/etc/resolv.conf。重启后,此文件配置的dns又被自动修改为默认值。所以需要永久性修改DNS。方法如下:
# vim /etc/resolvconf/resolv.conf.d/base
nameserver 192.168.80.2
nameserver 8.8.8.8
3、重启networking服务使其生效:
# /etc/init.d/networking restart
这样网络配置就永久生效。
----------------------------------------------------------------------------------------------------------------------------------
ubuntu安装好后ifconfig默认只有eth和lo的配置信息:
在ubuntu上面安装KVM后:
KVM里面部署一个虚拟机OS后,又会多出一项信息:
。
vnet0是KVM给部署的virtual machine OS虚拟的网卡,它通过KVM的虚拟网桥virbr0去连接ubuntu的eth0网卡来联网。
suse的网络配置在 /etc/sysconfig/network/下面,每个网卡一个配置文件。
intrfaces如下内容表示使用DHCP分配IP:
auto lo iface lo inet loopback
auto eth0 iface eth0 inet dhcp
Dynamic Host Configuration Protocol (DHCP) is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet mask and default gateway.
修改为如下表示配置静态IP地址:
auto lo iface lo inet loopback
# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static address 192.168.80.129 netmask 255.255.255.0 gateway 192.168.80.2
注意:只需要设置address(IP地址)、netmask(子网掩码)、gateway(网关)这三项就OK,network和broadcast这两项参数是可以不写的。
设置DNS服务器
都在/etc/resolv.conf这个文件内配置。
内容:
nameserver 192.168.80.2
nameserver 8.8.8.8
保存退出。
注意:重启Ubuntu后发现又不能上网了,问题出在/etc/resolv.conf。重启后,此文件配置的dns又被自动修改为默认值。所以需要永久性修改DNS。方法如下:
# vim /etc/resolvconf/resolv.conf.d/base
nameserver 192.168.80.2
nameserver 8.8.8.8
3、重启networking服务使其生效:
# /etc/init.d/networking restart
这样网络配置就永久生效。
----------------------------------------------------------------------------------------------------------------------------------
ubuntu安装好后ifconfig默认只有eth和lo的配置信息:
在ubuntu上面安装KVM后:
KVM里面部署一个虚拟机OS后,又会多出一项信息:
。
vnet0是KVM给部署的virtual machine OS虚拟的网卡,它通过KVM的虚拟网桥virbr0去连接ubuntu的eth0网卡来联网。
相关文章推荐
- 安卓HTTP请求之get和post方法。
- gulp ( http://markpop.github.io/2014/09/17/Gulp入门教程 )
- iOS开发网络篇—数据缓存
- less 官网讲解 ( http://www.bootcss.com/p/lesscss/ )
- tomcat https ssl设置
- C# 网络打印机ESC指令打印小票
- TCP/IP
- Linux设置网络连接
- Netmap 高性能网络I/O框架
- 其实学校的网络就是绑定了地址所以对方使用在线就可以同时占用
- 谈谈HTTP/2对前端的影响【转载】
- okhttp常用工具类
- Java Servlet(六):HttpServlet实现原理(jdk7+tomcat7+eclipse)
- HttpPost 访问网络
- Spring Http Invoker
- Neutron在给虚拟机分配网络时,底层是如何实现的?
- HttpClient 发送Get请求
- muduo库的学习11---TcpServer与TcpClient的基本设计---TcpConnection接收与发送
- httpclien各个版本超时时间设置
- muduo库的学习10---TcpServer与TcpClient的基本设计---TcpConnection建立与关闭