Ubuntu Server 9.10上的两个networking适配器 – 不能同时使用两个networking适配器?

我试图在Ubuntu(服务器版)9.10中设置两个networking适配器。 一个用于公共互联网,另一个用于私人局域网。

在安装过程中,我被要求select主networking适配器(eth0或eth1)。 我select了eth0,给安装程序下面列出的/etc/network/interfaces ,并继续进行。 过去几天我一直在使用这个适配器,每一件事情都很好。

今天,我决定是时候设置本地适配器了。 我编辑/etc/network/interfaces以添加eth1的详细信息(请参阅下文),然后使用sudo /etc/init.d/networking restart启动networking。

之后,尝试使用其外部IP地址ping机器失败,但我可以ping其本地IP地址。

如果我使用sudo ifdown eth1 eth1closuressudo ifdown eth1 ,我可以再次通过外部IP地址(但显然不是内部IP地址)ping机器。 引导eth1回到我们原来的问题状态:外部IP不工作,内部IP工作。

这里是我的/etc/network/interfaces (我已经删除了外部IP信息,但是这些设置在工作时没有变化)

 rob@rhea:~$ cat /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary (public) network interface auto eth0 iface eth0 inet static address xxx.167.218.118 netmask 255.255.255.240 network xxx.167.218.112 broadcast xxx.167.218.127 gateway xxx.167.218.126 # The secondary (private) network interface auto eth1 iface eth1 inet static address 192.168.99.4 netmask 255.255.255.0 network 192.168.99.0 broadcast 192.168.99.255 gateway 192.168.99.254 

我然后这样做:

 rob@rhea:~$ sudo /etc/init.d/networking restart * Reconfiguring network interfaces... [ OK ] rob@rhea:~$ sudo ifup eth0 ifup: interface eth0 already configured rob@rhea:~$ sudo ifup eth1 ifup: interface eth1 already configured 

然后,从另一台机器:

 C:\Documents and Settings\Rob>ping xxx.167.218.118 Pinging xxx.167.218.118 with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for xxx.167.218.118: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), 

回到Ubuntu服务器上:

 rob@rhea:~$ sudo ifdown eth1 

…又在另一台机器上:

 C:\Documents and Settings\Rob>ping xxx.167.218.118 Pinging xxx.167.218.118 with 32 bytes of data: Reply from xxx.167.218.118: bytes=32 time<1ms TTL=63 Reply from xxx.167.218.118: bytes=32 time<1ms TTL=63 Reply from xxx.167.218.118: bytes=32 time<1ms TTL=63 Reply from xxx.167.218.118: bytes=32 time<1ms TTL=63 Ping statistics for xxx.167.218.118: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms 

所以…我做错了什么?

已解决首先从eth1节(如MikeyBbuild议的)中删除网关信息,然后从路由表中删除eth1networking地址的路由,如下所示:

sudo route del -net 192.168.99.0 netmask 255.255.255.0 dev eth1

你几乎可以肯定不应该有两个默认的网关。

尝试从eth1节删除默认网关,看看是否有帮助。