Answer the question
In order to leave comments, you need to log in
How to configure iptables to go from local to global?
There is one public IP and a network of virtual machines on Debian
# network interface settings
auto lo
iface lo inet loopback
# device: eth0
auto eth0
iface eth0 inet static
address 175.219.59.209
gateway 175.219.59.193
netmask 255.255.255.224
post-up echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
auto vmbr0
iface vmbr0 inet static
address 10.10.0.1
netmask 255.255.0.0
bridge_ports none
bridge_stp off
bridge_fd 0
post-up ip route add 10.10.0.1/24 dev vmbr0
auto vmbr1
iface vmbr1 inet static
address 10.10.0.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
post-up iptables -t nat -A POSTROUTING -s '10.10.0.0/24' -o vmbr1 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.10.0.0/24' -o vmbr1 -j MASQUERADE
iptables -t nat -A POSTROUTING ! -d '10.10.11.0/24' -j SNAT --to-source '175.219.59.209'
Answer the question
In order to leave comments, you need to log in
What kind of virtual machine do you have there? Some kind of hypervisor?
Is this the adapter configuration on the gateway? What you wanted to do in the last rule is correctly done:
* enable NAT on the host:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sysctl -p net.ipv4.ip_forward="1"
auto eth0
iface eth0 inet static
address 10.10.0.2
gateway 10.10.0.1
netmask 255.255.255.0
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question