[TriLUG] Choosing the right pipe

Mike Johnson mike at enoch.org
Mon Oct 28 16:15:37 EST 2002


Jeff Bollinger [jeff01 at email.unc.edu] wrote:
 
> Say I've got two different NICs, each connecting to a different network.
> ~ If I want to SSH into network A (a private network) how do I tell SSH
> to run through eth0 (or the first NIC)?

You set a route for it.

An example:
I'd like to reach 192.168.3.0/24 through the gateway 192.168.1.1 that's
reachable through eth1 (and, presumably, eth1 has a 192.168.1.0/24
address).

Here's my starting table:
# /sbin/route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.0.254   0.0.0.0         UG    0      0        0 eth0


So, to do what I want:
/sbin/route add -net 192.168.3.0/24 gw 192.168.1.1 dev eth0

And I have:
# /sbin/route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.3.0     192.168.1.1     255.255.255.0   UG    0      0        0 eth1
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.0.254   0.0.0.0         UG    0      0        0 eth0

And then if I ssh to 192.168.3.15, it'll go out eth1.

There's really nothing special about SSH.  It's all about getting the
routes.

Mike
-- 
"Would you like to take advantage of wiretap Wednesdays?" -- Fed on Sealab 2021

GNUPG Key fingerprint = ACD2 2F2F C151 FB35 B3AF  C821 89C4 DF9A 5DDD 95D1
GNUPG Key = http://www.enoch.org/mike/mike.pubkey.asc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: not available
URL: <http://www.trilug.org/pipermail/trilug/attachments/20021028/c057862c/attachment.pgp>


More information about the TriLUG mailing list