今天同学问我ubuntu下ip如何写死,我想起这周在公司我们队长也问过我,我就在这把我实验的方法说一下、
打开终端:
sudo vim /etc/network/interfaces
然后按如下修改:
auto eth0 ------------------------eth0,根据自己已有的修改。用ifconfig查看。
iface eth0 inet static ---------------------eth0根据已有修改
address 192.168.18.2 ------------写自己的ip
netmask 255.255.255.0 ------------不用修改
network 192.168.18.0 ------------根据自己的ip修改
gateway 192.168.18.1 -------------根据自己的ip修改
auto eth1
iface eth1 inet static
address 172.17.94.93
netmask 255.255.255.0
broadcast 172.17.94.255
gateway 172.17.94.254
然后保存退出、。
source /etc/network/interfaces ------------让修改的配置文件生效、
sudo /etc/init.d/networking restart 重启网络