1. 配置静态ip地址
$sudo vi /etc/network/interfaces
原有内容只有如下两行:
auto lo
iface lo inet loopback
向末尾追加以下内容:
auto eth0
iface eth0 inet static
address 192.168.10.200
gateway 192.168.10.1
netmask 255.255.255.0
network 192.168.10.0
broadcast 192.168.10.255
然后保存退出;
2. 重启 network 使修改生效
sudo iptables-save
sudo /etc/init.d/networking restart
sudo ifdown eth0
sudo ifup eth0