John Mark Causing

System Administrator | Hosting Support Engineer

Bacolod City, Philippines

+639393497018

John Mark Causing

System Administrator | Hosting Support Engineer

Bacolod City, Philippines

+639393497018

Our goal here is to manipulate and play an iptables redirection for SSH connection. user SSH to a container “wp1” –> Server 1 catches the connection —> Server 1 redirects the SSH traffic to Server 2 —> Server redirects SSH traffic to Server 3 lxc container called wp1 —> Server 3 ‘wp1’ response back to the user.

Server 1

iptables -A PREROUTING -t nat -p tcp --dport 9999 -j DNAT --to 192.168.50.27:22

iptables -t nat -A POSTROUTING -j MASQUERADE

Server 2

Container list:

iptables -A PREROUTING -t nat -p tcp --dport 9993 -j DNAT --to 10.155.41.93:22

Example iptables list (table NAT):

Server 3 – lxc container “wp1”

From LXC container wp1, you can enable root login and password enabled:

vi /etc/ssh/sshd_config

Results: