ifconfig 获取网卡名称(这里举例名称为eth0)
nano /etc/network/interfaces 修改 IP 地址和DNS 永久生效
文件内容如下:
auto eth0
iface eth0 inet static
address 192.168.1.200 #设置的IP地址
netmask 255.255.255.0 #子网掩码
gateway 192.168.1.1 #网关
dns-nameserver 8.8.8.8 #设置dns服务器
cat /etc/resolv.conf 查看更改后的dns地址为8.8.8.8。
重新加载网络配置或重启
这里说的重启网络服务,命令如下:
/etc/init.d/networking restart
重启命令
reboot
