Created
December 13, 2015 05:31
-
-
Save hayleyxyz/2d973d7dcd648500b2b1 to your computer and use it in GitHub Desktop.
Proxmox NAT - /etc/network/interfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file describes the network interfaces available on your system | |
# and how to activate them. For more information, see interfaces(5). | |
# The loopback network interface | |
auto lo | |
iface lo inet loopback | |
# vmbr0: Bridging. Make sure to use only MAC adresses that were assigned to you. | |
auto vmbr0 | |
iface vmbr0 inet static | |
address 91.121.221.193 | |
netmask 255.255.255.0 | |
network 91.121.221.0 | |
broadcast 91.121.221.255 | |
gateway 91.121.221.254 | |
bridge_ports eth0 | |
bridge_stp off | |
bridge_fd 0 | |
# for Routing | |
auto vmbr1 | |
iface vmbr1 inet manual | |
post-up /etc/pve/kvm-networking.sh | |
bridge_ports dummy0 | |
bridge_stp off | |
bridge_fd 0 | |
auto vmbr2 | |
iface vmbr2 inet static | |
address 10.21.21.254 | |
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.21.21.0/24' -o vmbr0 -j MASQUERADE | |
post-down iptables -t nat -D POSTROUTING -s '10.21.21.0/24' -o vmbr0 -j MASQUERADE | |
post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 10.21.21.5:22 | |
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 2222 -j DNAT --to 10.21.21.5:22 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment