linux之网络配置

-------------------------------------------------静态IP--------------------------------------------------------------

*、备份

cp /etc/network/interfaces /etc/network/interfaces_bak

*、修改文件内容vim /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.0.111
gateway 192.168.0.1 #这个地址你要确认下 网关是不是这个地址
netmask 255.255.255.0

*、修改DNS

vim /etc/resolv.conf
添加
nameserver 202.96.128.86公网DNS即可

*、重启网卡即可

/etc/init.d/network restart

-------------------------------------------------动态IP--------------------------------------------------------------

*、备份

cp /etc/network/interfaces /etc/network/interfaces_bak

*、修改文件内容vim /etc/network/interfaces

auto eth0
iface eth0 inet dhcp

*、重启网卡即可

/etc/init.d/network restart

相关推荐