我设置了 proxmox 实例,一切运行正常,但我遇到了端口转发问题
我有:
服务器A公共 IP 为 1.2.3.4,其专用服务器为 (proxmox)
服务器B(服务器 A 上的虚拟机)桥接 IP:10.10.10.7
我的目标是路由 1.2.3.4:5022 -> 10.10.10.7:22
我的网络配置
# 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!
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
iface lo inet6 loopback
auto enp0s31f6
iface enp0s31f6 inet static
address 1.2.3.4/26
gateway <masked>
up route add -net <masked> netmask 255.255.255.192 gw <masked> dev enp0s31f6
iface enp0s31f6 inet6 static
address 2a01:4f8:10b:234d::2/64
gateway fe80::1
auto vmbr99
iface vmbr99 inet static
address 10.10.10.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 '10.10.10.0/24' -o enp0s31f6 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o enp0s31f6 -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
#port forwarding
post-up iptables -t nat -A PREROUTING -i enp0s31f6 -p tcp --dport 5022 -j DNAT --to 10.10.10.7:22
post-down iptables -t nat -D PREROUTING -i enp0s31f6 -p tcp --dport 5022 -j DNAT --to 10.10.10.7:22
iptables
Chain PREROUTING (policy ACCEPT)
num target prot opt source destination
1 DNAT tcp -- anywhere anywhere tcp dpt:5022 to:10.10.10.7:22
telnet 10.10.10.7 22
作品
telnet localhost 5022
不起作用
telnet 1.2.3.4 22
不起作用
有人能帮我吗?我想学习网络知识,但找不到相关内容