IPV4 Nat configuration ?

Bastian Scott

New Member
Feb 26, 2016
1
0
1
28
Good Morning Proxmox Forum,

I'm totally new to networking under Linux and i need some help with it ;)

i actually have 3 Public ip's and i would to like to put these on 3 VM's ( later on more VMs )
so, the Server in the same network can ping each other, the gateway is reachable, but .... i can't ping to the World :(... but eth0:3 works (pinging from my home pc to the public ip)... serieusly i dont know that to do anymore :(


OS: Debian 8.3
Proxmox 4

here my /etc/network/interfaces config:


auto eth0
iface eth0 inet static
address XXX.XXX.XXX.145
netmask 255.255.255.224
gateway XXX.XXX.XXX.129
broadcast XXX.XXX.XXX.159
post-up echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp

#neue ip Adressen
auto eth0:1
iface eth0:1 inet static
address XXX.XXX.XXX.98
netmask 255.255.255.248
network XXX.XXX.XXX.97
broadcast XXX.XXX.XXX.103
hwaddress ether XX:XX:XX:XX:XX:XX

auto eth0:2
iface eth0:2 inet static
address XXX.XXX.XXX.99
netmask 255.255.255.248
network XXX.XXX.XXX.97
broadcast XXX.XXX.XXX.103
hwaddress ether XX:XX:XX:XX:XX:XX

auto eth0:3
iface eth0:3 inet static
address XXX.XXX.XXX.101
netmask 255.255.255.248
network XXX.XXX.XXX.97
broadcast XXX.XXX.XXX.103
hwaddress ether XX:XX:XX:XX:XX:XX

auto vmbr0
iface vmbr0 inet static
address XXX.XXX.117.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
#natting interface vmbr0
post-up iptables -t nat -A POSTROUTING -p tcp -s 'XXX.XXX.XXX.98/29' -o vmbr0 -j MASQUERADE
post-up iptables -t nat -A POSTROUTING -p udp -s 'XXX.XXX.XXX.98/29' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -p tcp -s 'XXX.XXX.XXX.98/29' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -p udp -s 'XXX.XXX.XXX.98/29' -o vmbr0 -j MASQUERADE


auto vmbr1
iface vmbr1 inet static
address XXX.XXX.118.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward

auto vmbr2
iface vmbr2 inet static
address XXX.XXX.119.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
 
I noticed two things: /proc/sys/net/ipv4/ip_forward is just the general forwarding switch, you'll also want to enable /proc/sys/net/ipv4/conf/vmbr0/forwarding (and for vmbr1 and 2, too).
And about 'ping'... you're only masquerading tcp and udp while ping uses icmp ;-)
 

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!