第一步 输入命令 ip addr ,查看我们的ip地址,默认为dhcp分配的地址;
第二步 输入命令 ifconfig 查看网卡名称 (常见的有eth0,ens33)
第三步 sudo vi /etc/network/interface
添加如下命令
auto 网卡名称
iface 网卡名称 inet static address 192.168.8.100 netmask 255.255.255.0 gateway 192.168.8.2 dns-nameserver 119.29.29.29
第四步
重启网络:sudo /etc/init.d/networking restart
第五步
ping www.baidu.com
成功!
转载请注明原文地址: https://ju.6miu.com/read-39427.html