4

I am trying to route multiple IPs through one physical NIC on my dedicated server for use with Proxmox KVM VMs. I have a dedicated server which is currently running Debian 4.4.5-8 with 3 available ip addresses for use, which will be displayed as 176.xxx.xxx.196 (main), 176.xxx.xxx.198 (on same subnet as main) and 5.xxx.xxx.166 (different subnet). I am currently trying to route the third IP address with the dedi for use with a vps that I have set up using proxmox v2.x but am having a really, really hard time doing so. Virtual interfaces binding the additional IP addresses work as expected, ruling out external routing problems.

The provider has given the following information for the IP addresses on the main subnet:
gateway: 176.xxx.xxx.193
netmask: 255.255.255.224
broadcast: 176.xxx.xxx.223

As well as the following information for the IP address on the second subnet:
gateway: 5.xxx.xxx.161
netmask: 255.255.255.248
broadcast: 5.xxx.xxx.167

Everything I've tried with /etc/network/interfaces has either not worked, or has rendered the network completely useless.

This is the current state of the file, which has the secondary IP address working on the same subnet as well as IPv6 working, but not the second subnet.

# Nativen IPv6 Schnittstelle
iface eth0 inet6 manual


# Bridge IPv4 Schnittstelle (176.xxx.xxx.193/27)
auto vmbr0
iface vmbr0 inet static
    address 176.xxx.xxx.196
    netmask 255.255.255.224
    gateway 176.xxx.xxx.193
    broadcast 176.xxx.xxx.223
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0
    bridge_maxwait 0
    post-up ip addr add 176.xxx.xxx.198/27 dev vmbr0

auto vmbr1
iface vmbr1 inet static
    address 5.xxx.xxx.166
    netmask 255.255.255.248
    gateway 5.xxx.xxx.161
    broadcast 5.xxx.xxx.167
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0
    bridge_maxwait 0
    post-up ip addr add 5.xxx.xxx.166/29 dev vmbr1

# Bridge IPv6 Schnittstelle (Reichweite: xxxx:xxxx:xxxx:xxxx:xxxx:xxxx::/64)
iface vmbr0 inet6 static
    address xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
    netmask 64
    up ip -6 route add xxxx:xxxx:xxxx:xxxx:xxxx:xxxx dev vmbr0
    down ip -6 route del xxxx:xxxx:xxxx:xxxx:xxxx:xxxx dev vmbr0
    up ip -6 route add default via xxxx:xxxx:xxxx:xxxx:xxxx:xxxx dev vmbr0
    down ip -6 route del default via xxxx:xxxx:xxxx:xxxx:xxxx:xxxx dev vmbr0
  • You have netmask `255.255.255.248` on the `5.x.x.161` network, but in your `post-up` script you used `/27` instead of `/29`. This is wrong, but I'm not sure that's going to fix your problem. – DerfK Oct 29 '12 at 02:38
  • Which operating system are you using? – rwc Oct 29 '12 at 03:14
  • @RWC, given the filenames and so int, It is almost certain Debian or Ubuntu on Linux as the tags suggest. – Zoredache Oct 29 '12 at 07:42
  • As stated in the first paragraph, I'm using Debian 4.4.5-8. I have also fixed the post-up script but it didn't fix the issue. –  Oct 30 '12 at 05:05

2 Answers2

2

This was completely fixed by re-installation of the guest vm. The provider for the dedicated server gave mac addresses to be assigned to each guest which would then assign it an ip address via dhcp, this solved the issue.

1

You've got two bridges (vmbr0 and vmbr1) which both have eth0 as a member, so you essentially have one layer 2 domain which I suspect will cause weirdness. Are you trying to expose two NICs to the VM? If so, you should rather expose a single NIC and attach two addresses to that inside the VM. The host should have a single bridge which contains eth0.

Since the secondary subnet already has a gateway, the host doesn't need to act as one. Don't configure any addresses or routes for the secondary subnet on the host. In the guest, attach one of the secondary IPs to its NIC, and configure the default gateway to be 5.xxx.xxx.161. The host will simply act as a layer two bridge to allow the VM to reach the gateway.

mgorven
  • 30,615
  • 7
  • 79
  • 122
  • This has worked. Rather than continuing to configure the network interface file, I set up a new vm and then configured the last ip address from there. –  Nov 04 '12 at 21:30