View Single Post
Old 9th May 2008, 18:26
topdog topdog is offline
Senior Member
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 154 Times in 151 Posts

For purposes of illustrating how this would work i will assume the following you need to substitute for your network

eth0 -> gw
eth0 -> gw

Okay now in your main routing table your default gw will be

okay now create the second routing table

ip ro add dev eth1  proto kernel  scope link  src table 4
ip ro add default table 4
The lets put a rule to make ssh traffic go via table 2
ip ru add fwmark 2 lookup 4
Then we need to mark the ssh packets
iptables -t mangle -I OUTPUT -p tcp --dport 22 -j MARK --set-mark 2
iptables -t mangle -I OUTPUT -p tcp --sport 22 -j MARK --set-mark 2
Then we flush the routing cache
ip ro fl ca
---- - Got Linux problems ? - I can help. - Try it.
Reply With Quote