How do I apply multiple subnets to a server with one NIC?
Posted
by
Cosban
on Server Fault
See other posts from Server Fault
or by Cosban
Published on 2012-10-29T00:38:35Z
Indexed on
2012/10/29
5:05 UTC
Read the original article
Hit count: 475
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/27 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
© Server Fault or respective owner