network question

Paul Civati paul at xciv.org
Wed Aug 30 17:09:07 BST 2000


David Richards <davidr at eurosoft-uk.com> wrote:

>    I have two network cards in a machine. ed1 is connect to the main
> network and ed0 connected to a test network. how can i add routes to
> ed0 so that it will pass all traffic over to ed1 and the other way
> around? so in theory. i should be able to logon to the test network
> and ping etc... any workstation on the main network and the other
> way around too?

A few routing concepts to start with:

 - A router is a box with more than one interface, and all it does it
   forward packets between those interfaces.  (Providing that a) it
   has the relevent routes in its routing table so that it knows
   where to send packets to and b) it has IP forwarding enabled).

 - A router can route to a network it has an interface on without
   needing any specific routes added, because it knows how to reach
   those networks by virtue of being directly connected to them
   (aside, Linux *does* require routes to its interfaces, which
   I've always found a bit weird).

 - A router can only reach another network by having an interface
   on that network, or having a route to that network (and the
   route must point to a host it knows how to reach via one of
   its interfaces).

Machines on your main network (call it 192.168.11.0/24) will (I
guess) have default routes pointing to your internet connection
router (call it 192.168.11.1).

This new router of yours will have two interfaces, call the one
on the main network 192.168.11.20, and the other test network
will be 192.168.50.20:

192.168.11.1     192.168.11.20  192.168.50.1      192.168.50.20
  Internet ----------------- New -------------------- Test
     G/W                     G/W                      Host
            Main network              Test network

When a host on your main network needs to talk to 192.168.50.0/24
it will send packets using its default route to 192.168.11.1,
so on your internet gateway you will need a route to say that to
reach 192.168.5.0/24 it should send packets to 192.168.11.20:

  route add -net 192.168.50 -netask 255.255.255.0 192.168.11.20

or similar Cisco speak:

  ip route 192.168.50.0 255.255.255.0 192.168.11.20

On your test network hosts will have a default route of
192.168.50.1, and your new gateway will want a default route
of 192.168.11.1 so that it knows how to get out to the internet.

This is a difficult subject to explain in this medium, but I
hope the above is explanational without being more confusing. :)

-Paul-




More information about the Ukfreebsd mailing list