无法在 Ubuntu 中添加 eth0:0

无法在 Ubuntu 中添加 eth0:0

我有 Ubuntu 12.04.1,并且正在尝试配置以太网接口别名eth0:0

这是我的/etc/network/interfaces

auto lo
iface lo inet loopback
pre-up iptables-restore < /etc/iptables.up.rules

auto eth0
iface eth0 inet static
address 192.168.0.1
gateway 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255

auto eth0:0
iface eth0:0 inet static
address 192.168.1.1
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

如果我重新启动,系统将启动并显示消息:Starting with partial network configuration,并且eth0仅配置。

我试过了

  • 移除pre-up iptables-restore < /etc/iptables.up.rules
  • 将网络掩码更改eth0:0255.255.0.0
  • 将网关更改eth0:0192.168.0.1

“ifup” 失败如下:

$ sudo ifup eth0:0
RTNETLINK answers: File exists
Failed to bring up eth0:0.

service networking restart根本不起作用(甚至在我添加之前eth0:0):

$ sudo service networking restart
stop: Unknown instance: 
networking stop/waiting

不幸的是,执行命令后我甚至没有看到/var/log/syslog或中的更新/var/log/dmsg

ifconfig 的输出:

eth0      Link encap:Ethernet  HWaddr 00:1e:33:71:cd:a4  
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:45 Base address:0x4000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3248 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3248 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:279379 (279.3 KB)  TX bytes:279379 (279.3 KB)

wlan0     Link encap:Ethernet  HWaddr 00:11:22:33:44:55  
          inet addr:78.225.121.83  Bcast:78.225.121.255  Mask:255.255.255.0
          inet6 addr: fe80::211:22ff:fe33:4455/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:37801 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39871 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:36003811 (36.0 MB)  TX bytes:7490816 (7.4 MB)

有任何想法吗?

答案1

这个广播是否192.168.0.255正确eth0:0,或者应该如此192.168.1.255

相关内容