port mapping

# windows 把192.168.1.1:80轉到192.168.1.10:8080
netsh interface portproxy add v4tov4 listenport=80 listenaddress=192.168.1.1 connectport=8080 connectaddress=192.168.65.10

# 移除
netsh interface portproxy delete v4tov4 listenport=80 listenaddress=192.168.1.1


# Linux 使用舊的iptables
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
sudo iptables -t nat -A OUTPUT -p tcp -d localhost --dport 80 -j REDIRECT --to-ports 8080
sudo sysctl -w net.ipv4.ip_forward=1

# Linux nftables
還在研究中

發佈留言