Skip to Content.
Sympa Menu

baslinux - Re: [BL] gateway between two laptops

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: baslinux AT lists.ibiblio.org
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] gateway between two laptops
  • Date: Fri, 22 Aug 2008 12:00:45 +1200

Message from Steven
===================

Perhaps some additional discussion might be useful.

> CLIENT GW WIRELESS ROUTER
> 192.168.1.2------192.168.1.1
> 10.0.0.2--------10.0.0.1

The GW machine sits on both networks. It knows where
the client machine is and it knows where the wireless
router is. In contrast, the client machine only knows
machines on the 192.168.1.x network. And the wireless
router only knows machines on the 10.0.0.x network.

To enable the client machine to connect to (or ping)
the wireless router, you need to tell the client machine
where to find it. This goes on the client machine:
---------------------------------
route add 10.0.0.1 gw 192.168.1.1
---------------------------------
This tells the kernel to send all packets addressed
to 10.0.0.1 to 192.168.1.1 (what happens after that
is 192.168.1.1's problem).

To enable the wireless router to send traffic (or return
pings) to the client machine, you need to tell it where
to find it. This goes on the wireless router:
---------------------------------
route add 192.168.1.2 gw 10.0.0.2
---------------------------------
This tells the kernel to send all packets addressed
to 192.168.1.2 to 10.0.0.2 (which is the same machine
as 192.168.1.1 above). That is the way you would do
it from the Linux CLI; however, your wireless router
probably has a different method of editing its routing
table (or it may be inaccessible). The priciple is
the same no matter which method is used to modify the
routing table: add a route to the client machine
(via the GW machine).

Have another look at the command used above to route
traffic from the client machine to the wireless router:
---------------------------------
route add 10.0.0.1 gw 192.168.1.1
---------------------------------
This route is very specific. Only traffic addressed
to 10.0.0.1 is routed. No other addresses will be
actioned. This is far too limited for most purposes.
What we want instead is for all traffic (other than
192.168.1.x traffic) to be routed to the GW machine.
Therefore, we replace the 10.0.0.1 with default:
--------------------------------
route add default gw 192.168.1.1
--------------------------------
Now all packets (eg to the internet) will be routed
to the GW machine, and the GW machine will forward
them to the wireless router. The wireless router
will do IP masquerading and send the packets to the
worldwide web. Returning packets from the internet
for 192.168.1.2 will be routed to 10.0.0.2, which
will forward them to 192.168.1.2.

Note, this use of default only goes on the client
machine. On the wireless router we still need the
specific address of the client machine:
---------------------------------
route add 192.168.1.2 gw 10.0.0.2
---------------------------------

Any questions?

Cheers,
Steven





Archive powered by MHonArc 2.6.24.

Top of Page