NAT not working if gateway is on vmbr1

BelCloud

Renowned Member
Dec 15, 2015
96
5
73
www.belcloud.net
I am using NAT in the provisioning part of my VM-s.

I am trying to add a public IP to access the proxmox cluster/node, however i am unable to use both public IP and NAT.

This is my configuration:
Code:
auto lo
iface lo inet loopback

iface eth0 inet manual
iface eth1 inet manual

auto bond0
iface bond0 inet manual
  slaves eth0 eth1
  bond_miimon 100
  bond_mode 802.3ad
  bond_xmit_hash_policy 2

auto vmbr0
iface vmbr0 inet static
  address 10.0.1.119
  netmask 255.255.0.0
#  gateway 10.0.0.1
  bridge_ports bond0.101
  bridge_stp off
  bridge_fd 0

auto vmbr1
iface vmbr1 inet static
  address 22.118.226.190
  netmask 255.255.255.0
  gateway 22.118.226.1
  bridge_ports bond0.300
  bridge_stp off
  bridge_fd 0

With this configuration, my guest OS gets a dhcp IP in the 10.0.2.0/24 network however it cannot access anything outside. The external IP 22.118.226.190 works in this situation.

If i set the gateway on vmbr0 to 10.0.0.1 (pfsense) and remove the gateway from vmbr1, the guest OS can access the internet however the external IP 22.118.226.190 can no longer be accessed.

Please advise

Thank you
 
I am using NAT in the provisioning part of my VM-s.

I never use the "built-in" NAT of KVM. It is much better you define the NAT by your own with the iptables command added into /etc/network/interfaces, e.g:

Code:
       post-up iptables -t nat -A POSTROUTING -o vmbr1 -j MASQUERADE
 

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!