port forwarding - iptables redirect outside requests to 127.0.0.1 - Unix & Linux Stack Exchange

PHOTO EMBED

Thu Jan 18 2024 17:06:17 GMT+0000 (Coordinated Universal Time)

Saved by @p0ir0t #bash

iptables -t nat -I PREROUTING -p tcp -d 192.168.1.0/24 --dport 2222 -j DNAT --to-destination 127.0.0.1:2222

sysctl -w net.ipv4.conf.eth0.route_localnet=1
content_copyCOPY

https://unix.stackexchange.com/questions/111433/iptables-redirect-outside-requests-to-127-0-0-1