[SOLVED] Assign a new IP Block to a Bridged Interface

D

Delinquency

Guest
Hello ProxMox Community,

I have an issue with my ProxMox configuration.

My server is assigned to a single /29 address and has access to a /30 block on the same port.

I would like to configure two IPs from a /30 block to be used by my virtual machine through a bridged interface on vmbr0.

I have tried adding the gateway routes on the host but that does not work. It only fix is by adding one of the two IP's to vmbr0:1.

Is there any way this setup can be configured correctly?

Another way I can try this is if I use NAT and masquerade traffic, but how would that work with multiple IP addresses?

Thanks for the help, if any. Feel free to reply if you would like more clarification or could suggest a different approach.
 
Last edited by a moderator:
/etc/network/interfaces ON THE HOST:
auto vmbr1
iface vmbr1 inet static
address 10.0.0.1
netmask 255.0.0.0
bridge_ports none
bridge_stp off
bridge_fd 0


#THE IP YOU WANT TO GIVE TO THE VM -- ADD THIS IN PROXMOX WEB UI and REBOOT
iface vmbr0:1 inet static
address <IP ADDRESS>
netmask <NETMASK IP ADDRESS>
broadcast <BROADCAST IP ADDRESS>
network <NETWORK IP ADDRESS>

/etc/network/interfaces ON THE VM:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.0.0.2
netmask 255.0.0.0
gateway 10.0.0.1
post-up route add -net 10.0.0.0 netmask 255.0.0.0 dev eth0; route add default gw 10.0.0.1 eth0
post-down route del -net 10.0.0.0 netmask 255.0.0.0 dev eth0; route del default gw 10.0.0.1 eth0

Virtual machine is given static IP 10.0.0.2 and bridged with vmbr1.

IP Tables Routing ON THE HOST
echo "1" > /proc/sys/net/ipv4/ip_forward;


iptables -t nat -A PREROUTING -d <OUTPUT IP ADDRESS>/32 -j DNAT --to 10.0.0.2;
#Forward incoming packets


iptables -t nat -A POSTROUTING -s to 10.0.0.2/32 -j SNAT --to-source <OUTPUT IP ADDRESS>;
#Forward outgoing packets
 
Last edited by a moderator:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!