SSH tunneling code example

Example 1: port forwarding linux

echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
# ENABLES IP FORWARDING TEMPORARILY

Example 2: how to enable the port mapping to the SSH port windos

ssh -R remote_port:localhost:local_port ssh_server_hostname

Example 3: ssh open tunnel command line

# from localhost:13306 to remote 3306 via tunnel
ssh -L 33066:localhost:3306 remotemachine

Example 4: port forwarding linux

sudo nano /etc/sysctl.conf
# UNCOMMENT `net.ipv4.ip_forward=1`
#AFTER, EXECUTE THESE COMMANDS
sudo sysctl -p
sudo sysctl --system

Example 5: ssh tunnel port

ssh -L 80:intra.example.com:80 gw.example.com