[Proxmox] NAT 설정

2023. 3. 3. 15:24Proxmox

Proxmox 가상 IP 설정 NAT

root@pve3:~# cat /etc/network/interfaces
# network interface settings; autogenerated
# Please do NOT modify this file directly, unless you know what
# you're doing.
#
# If you want to manage parts of the network configuration manually,
# please utilize the 'source' or 'source-directory' directives to do
# so.
# PVE will preserve these directives, but will NOT read its network
# configuration from sourced files, so do not attempt to move any of
# the PVE managed interfaces into external files!

auto lo
iface lo inet loopback

#iface ens1f0 inet manual

#iface ens1f1 inet manual

auto ens1f0 
iface ens1f0 inet static
        address XXX.XX.X.XX/24
        gateway XXX.XX.X.X
        #bridge-ports ens1f0
        #bridge-stp off
        #bridge-fd 0

auto vmbr0
iface vmbr0 inet static
        address 192.168.5.1/24
        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 '192.168.5.0/24' -o ens1f0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '192.168.5.0/24' -o ens1f0 -j MASQUERADE

        post-up   iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
        post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
root@pve3:~#

https://pve.proxmox.com/wiki/Network_Configuration#sysadmin_network_masquerading

 

Network Configuration - Proxmox VE

Proxmox VE does not write changes directly to /etc/network/interfaces. Instead, we write into a temporary file called /etc/network/interfaces.new, this way you can do many related changes at once. This also allows to ensure your changes are correct before

pve.proxmox.com