23,119
社区成员
发帖
与我相关
我的任务
分享
sudo ifconfig eth0 192.168.1.115 net mask 255.255.255.0 broadcast 192.168.1.255 up
sudo ifconfig eth0 192.168.2.115 net mask 255.255.255.0 broadcast 192.168.2.255 up
复制代码这样分配ip后,一段时间,我分配的ip无效了,系统自动又还原成了之前的ip.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.116
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.1.1
auto eth1
iface eth1 inet staic
address 192.168.2.2
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
然后重启
ubuntu@ubuntu:/$ sudo /etc/init.d/networking restart
* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
* Reconfiguring network interfaces...
/etc/network/interfaces:13: unknown method
ifdown: couldn't read interfaces file "/etc/network/interfaces"
/etc/network/interfaces:13: unknown method
ifup: couldn't read interfaces file "/etc/network/interfaces"
...fail!
这是什么原因呢?如果我在命令行修改
sudo ifconfig eth0 192.168.1.115 net mask 255.255.255.0 broadcast 192.168.1.255 up sudo ifconfig eth0 192.168.2.115 net mask 255.255.255.0 broadcast 192.168.2.255 up
这样能给网卡分配IP,但是上不了网了。求解啊。。。