多个IP – 不同的网关 – 一个接口 – Debian Squeezy

我在这里和其他地方读了很多答案,但我找不到合适的答案。 我尝试了几个解决scheme,但没有任何工作 我有一个接口eth0的服务器。 我有多个IP,但是我无法让他们工作。 也许你可以帮助我。

etc / network / interfaces(我在其他网站上发现了这个解决scheme):

# 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 eth0 iface lo inet loopback # The primary network interface auto eth0 allow-hotplug eth0 iface eth0 inet static address 31.133.CCC.47 netmask 255.255.255.0 broadcast 31.133.CCC.255 network 31.133.CCC.0 post-up route add default gw 31.133.CCC.1 metric 1 pre-down route del default gw 31.133.CCC.1 auto eth0:0 allow-hotplug eth0 iface eth0 inet static address 31.133.XXX.254 netmask 255.255.255.128 post-up route add default gw 31.133.XXX.129 metric 2 pre-down route del default gw 31.133.XXX.129 auto eth0:1 allow-hotplug eth0 iface eth0 inet static address 31.133.YYY.254 netmask 255.255.255.128 post-up route add default gw 31.133.YYY.129 metric 3 pre-down route del default gw 31.133.YYY.129 auto eth0:2 allow-hotplug eth0 iface eth0 inet static address 31.133.ZZZ.229 netmask 255.255.255.0 post-up route add default gw 31.133.ZZZ.1 metric 4 pre-down route del default gw 31.133.ZZZ.1 

这个configuration不起作用。 没有后期和前期,但与网关 – 不工作了太多。 我该怎么办? 启动,绑定和其他服务将无法启动,因为他们无法find一个工作接口。 使用单个IPconfiguration(第一个)服务器正在工作。

非常感谢您的build议。

我解决了这个问题

/etc/init.d/interfaces:

 auto lo eth0 iface lo inet loopback auto eth0:0 eth0:1 eth0:2 allow-hotplug eth0 iface eth0 inet static address 31.133.MMM.47 netmask 255.255.255.0 broadcast 31.133.MMM.255 network 31.133.MMM.0 post-up route add default gw 31.133.MMM.1 metric 1 pre-down route del default gw 31.133.MMM.1 iface eth0:0 inet static address 31.133.NNN.254 netmask 255.255.255.128 broadcast 31.133.NNN.255 network 31.133.NNN.0 post-up route add default gw 31.133.NNN.129 metric 2 pre-down route del default gw 31.133.NNN.129 iface eth0:1 inet static address 31.133.KKK.254 netmask 255.255.255.128 broadcast 31.133.KKK.255 network 31.133.KKK.0 post-up route add default gw 31.133.KKK.129 metric 3 pre-down route del default gw 31.133.KKK.129 iface eth0:2 inet static address 31.133.LLL.229 netmask 255.255.255.0 broadcast 31.133.LLL.255 network 31.133.LLL.0 post-up route add default gw 31.133.LLL.1 metric 4 pre-down route del default gw 31.133.LLL.1 

它的工作原理!

感谢大家的帮助!