[TriLUG] Choosing the right pipe

Stephen Schaefer stephen_schaefer27517 at yahoo.com
Mon Oct 28 16:18:31 EST 2002


Applications don't get to choose their network card;
rather the kernel looks at its routing tables and
decides which card is appropriate to get to the right
network.  You say you've got a public and private
networks attached.  Normally that means you'd have
something like

eth0: 152.2.1.l netmask 255.255.0.0
eth1: 192.168.1.1 netmask 255.255.255.0

If you want to telnet/ssh/anything to 192.168.1.2, the
kernel will see that it's directly connected to that
network via eth1, and use it.  The same with 152.21.1:
you're directly connected to that network, so the
kernel uses eth0.

Most simple configurations have just one extra entry
in the kernel routing table, the default route:

route add net 0.0.0.0 netmask 0.0.0.0 gw 152.2.254.254

which says: if you're not directly connected to an IP
network, route the packet via the gateway
152.2.254.254.  It is common for DHCP to obtain this
default route from the DHCP server.  So now any packet
not headed for 192.168.1.X or 152.2.Y.Z will head out
eth0 toward 152.2.254.254.

You can use the routing table to force a packet out
any particular interface.  Tell us moure about the IP
addresses of your interfaces, the IP address of your
router, which network is attached to that router, and
the IP address you want to get to, and I can come up
with routing table entries that will get you there.

    - Stephen

--- Jeff Bollinger <jeff01 at email.unc.edu> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Of course you can't ssh TO a network, but you can
> SSH INTO a network,
> like in my original message below.  Route displays
> an asterisk for each
> network under "Gateway", which is defined as the
> "default".   Is there a
> change I can make to /etc/resolv.conf that will
> always make eth0 use a
> particular gateway, and eth1 use another?
> 
> Thanks,
> Jeff
> 
> Jeremy Portzer wrote:
> | On Mon, 2002-10-28 at 15:41, Jeff Bollinger wrote:
> |
> |>-----BEGIN PGP SIGNED MESSAGE-----
> |>Hash: SHA1
> |>
> |>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)?
> |
> |
> | Well, you can't ssh to a *network* -- you ssh to a
> host (computer).
> | Based on the IP address of the destination
> computer, the kernel routing
> | tables will pick the appropriate "pipe".  (If
> there's more than one
> | possible route to a destination, things become
> much more complex.)
> |
> | Type "route" at a shell prompt to see where the
> kernel is routing things
> | now.  If things appear to be configured wrong,
> you'll need to check the
> | IP address, subnet mask, and other settings for
> each NIC.
> |
> | --Jeremy
> |
> | _______________________________________________
> | TriLUG mailing list
> |     http://www.trilug.org/mailman/listinfo/trilug
> | TriLUG Organizational FAQ:
> |    
> http://www.trilug.org/~lovelace/faq/TriLUG-faq.html
> 
> - --
> Jeff Bollinger
> University of North Carolina
> IT Security Analyst
> 105 Abernethy Hall
> mailto: jeff_bollinger at unc dot edu
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.0 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -
> http://enigmail.mozdev.org
> 
>
iD8DBQE9vaPivoVlxVBmgsURAjFuAJ9tpq5a0HextNL2z7vHzSQeSYfSOwCg9Ba2
> C4aASrrUHX7w2I2eQBHw5dQ=
> =a1SN
> -----END PGP SIGNATURE-----
> 
> _______________________________________________
> TriLUG mailing list
>     http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ:
>    
http://www.trilug.org/~lovelace/faq/TriLUG-faq.html


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/



More information about the TriLUG mailing list