修改root/etc/network/interfaces文件,修改内容如下:
auto eth0
iface eth0 inet static
address 192.168.2.100
netmask 255.255.255.0
gateway 192.168.2.1
broadcast 192.168.2.255
设置静态IP为192.168.2.100
在/etc/rc.local文件里加入/etc/init.d/networkingrestart
修改后内容如下:
echo 30000 > /proc/sys/vm/min_free_kbytes
/etc/init.d/networking restart
exit 0
重新启动后,静态IP设置完成。
原文:https://blog.51cto.com/14586215/2446548