Book Image

Mastering Proxmox

By : Wasim Ahmed
Book Image

Mastering Proxmox

By: Wasim Ahmed

Overview of this book

Table of Contents (17 chapters)
Mastering Proxmox
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding NAT/masquerading


NAT is a way to hide internal network IP addresses from the external network, such as the Internet. Any outgoing traffic uses the main host IP address instead of using own local IP address. Add the last three lines of the following post-up and post-down settings in the configuration file /etc/network/interfaces. Only add these lines under the virtual bridge configuration which needs the NAT option. Have a look at the following code snippet:

auto vmbr0
iface vmbr0 inet static
address 192.168.145.1
netmask 255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.145.0/24' -o eth0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.145.0/24' -o eth0 -j MASQUERADE

Tip

It is much easier and manageable to handle NAT using a physical or virtual firewall. Most of the firewalls have the NAT option out of the box. Also, using virtualized firewalls, we can create...