iptables
Installation instructions for iptables
download
wget https://www.netfilter.org/pub/iptables/iptables-1.8.8.tar.bz2
install dev
sudo apt install libmnl-dev libnftnl-dev
build
./configure --disable-nftables --prefix=/usr
make
sudo make install
ip:192.168.42.11:2222 to ip:192.168.122.137:22
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -j MASQUERADE
sudo iptables -t nat -A PREROUTING -d 192.168.42.0/24 -i usb0 -p tcp --dport 2222 -j DNAT --to-destination 192.168.122.137:22
sudo iptables -I FORWARD -p tcp -d 192.168.122.0/24 --dport 2222 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
#sudo iptables -t nat -A PREROUTING -p tcp --dport 2222 -s 192.168.42.11 -j DNAT --to 192.168.122.137:22
ssh user@192.168.42.11 -p 2222