Quantcast
Viewing all articles
Browse latest Browse all 5067

Advanced users • Route Port to specific gateway?

I've been diving down Google Rabbit holes trying to find out how to route SSH through a specific Gateway, and found this thread on Stack Exchange:
https://unix.stackexchange.com/question ... ation-port

But I'm having problems getting it to work.
My default gateway is: 172.27.3.3, but I want to route SSH traffic through 172.27.3.1

This is what I have:
/etc/iproute2/rt_tables

Code:

200     42

Code:

# ip route show table 42default via 172.27.3.1 dev eth0

Code:

ip route add default via 172.27.3.1 dev eth0 table 42ip rule add fwmark 1 table 42iptables -A OUTPUT -t mangle -o eth0 -p tcp --dport 22 -j MARK --set-mark 1iptables -A POSTROUTING -t nat -o eth0 -p tcp --dport 22 -j SNAT --to 172.27.3.1
But when I try to connect via SSH, it goes off to never-never land and does not respond.

If I add a specific route for the IP address of the SSH client, it works properly:

Code:

xxx.xxx.xxx.xxx via 172.27.3.1 dev eth0 proto static
Any ideas?

Thanks!

Statistics: Posted by Prof. R. Myrkr — Sun Oct 20, 2024 1:43 am



Viewing all articles
Browse latest Browse all 5067

Trending Articles