ProxmoxVE nat network
Configuration errors will cause network exceptions, which will cause the machine to lose connection.
- Configure network
/etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
auto vmbr0
iface vmbr0 inet static
address 1.2.3.4
netmask 255.255.255.255
gateway 1.2.3.254
pointopoint 1.2.3.254
hwaddress ether aa:bb:cc:dd:ee:ff
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
- Turn on forwarding
/etc/sysctl.conf
net.ipv4.ip_forward=1
Run sysctl -p
refresh environment configuration
- Create nat network
/etc/network/interfaces
auto vmbr1
iface vmbr1 inet static
address 10.1.1.254/24
bridge-ports none
bridge-stp off
bridge-fd 0
Iptables
# OUT
iptables -t nat -A POSTROUTING -s '10.1.1.0/24' -o vmbr0 -j MASQUERADE
# IN
iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 10022 -j DNAT --to 10.1.1.100:22
本作品采用 知識共享署名-相同方式共享 4.0 國際許可協議 進行許可