可以先执行第4步测试下能不能ping通,不行的话回来从第一步执行
1.配置网关
由于/etc/network/interfaces是只读文件
可用
sudo vi /etc/network/interfaces
或
sudo su
chmod 777 /etc/network/interfaces
vi /etc/network/interfaces
如果设置动态IP
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
auto eth0
iface eth0 inet DHCP
source-directory /etc/network/interfaces.d
如果设置静态IP
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
auto eth0
iface eth0 inet static
address 192.168.50.223
netmask 255.255.255.0
gateway 192.168.50.1
source-directory /etc/network/interfaces.d
输完,ctrl+c,:wq!退出
2.配置DNS
打开/etc下的resolv.conf
vi