ubuntu 14.4版本固定IP设置说明

网络配置文件是:/etc/network/interfaces

注意:如果Ubuntu系统采用的是desktop版,由于desktop版安装了NetworkManager,修改完interfaces文档中的内容后,不会生效。
需要先修改/etc/NetworkManager/NetworkManager.conf文档中的managed参数,使之为true,并重启系统。
修改/etc/network/interfaces文件,设置静态IP。修改/etc/network/interfaces设置静态IP
sudo vim /etc/network/interfaces
用下面的代码替换有关eth0的内容:
auto eth0 #表示让网卡开机自动挂载eth0
iface eth0 inet static
address 192.168.9.96
gateway 192.168.9.2
netmask 255.255.255.0
重启网络使上面的配置生效:
sudo /etc/init.d/networking restart
如果上面命令无法令ubuntu重启网络,则使用下面命令:
sudo ifdown eth0 && sudo ifup eth0  这个命令可以多输入几次

猜你喜欢

转载自blog.csdn.net/weixin_40593838/article/details/126359755