I have the following setup:
A computer with two network cards connected to two different routers. The first router redirects all outside traffic coming on port 5122 to port 22. So that I can connect to the machine using ssh.
I wish to use the first router only for ssh connections. Nothing else. So I want all other traffic directed through the second router.
How can I do that?
Best Answer
Like this:
1. Mark packets
Set a mark on each packet which is heading for port 5122.
Alternatively like this if you want to limit it to packets with a destination ip of 10.10.10.10:
2. Create routing table/rule
Create routing table with a rule for it to be used for the marked packets.
3. Add the route
Add the route corresponding to the routing table.
That should work.