Re: how can I connect 2 lan ?

From: Moe Trin (ibuprofin_at_painkiller.example.tld)
Date: 08/01/05


Date: Mon, 01 Aug 2005 14:31:40 -0500

In the Usenet newsgroup comp.os.linux.networking, in article
<W%oHe.23972$2U1.1536535@news3.tin.it>, Charly wrote:

>could you help me in this problem ?

        206074 Aug 25 2003 Ethernet-HOWTO
         40490 Jun 22 2000 Home-Network-mini-HOWTO
         45620 Jul 10 2000 Networking-Overview-HOWTO
         22582 Feb 6 2004 Reading-List-HOWTO
         71626 Apr 4 2004 Unix-and-Internet-Fundamentals-HOWTO

>I want to put in contact computer1 and computer2

[computer1 ~]$ /sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 17 eth0
192.168.2.0 192.168.1.250 255.255.255.0 UG 0 0 17 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 20 lo
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 15 eth0
[computer1 ~]$

[computer2 ~]$ /sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 17 eth0
192.168.1.0 192.168.2.1 255.255.255.0 UG 0 0 17 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 20 lo
0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0 15 eth0
[computer2 ~]$

[linux_box ~]$ /sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 17 eth0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 17 eth1
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 20 lo
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 15 eth0
[linux_box ~]$ cat /proc/sys/net/ipv4/ip_forward
1
[linux_box ~]$

[router ~]$ /sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
82.57.64.0 0.0.0.0 255.255.255.0 U 0 0 17 wan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 17 eth0
192.168.2.0 192.168.1.250 255.255.255.0 UG 0 0 17 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 20 lo
0.0.0.0 82.57.64.1 0.0.0.0 UG 0 0 33 wan0
[router ~]$

NOTES:
1. This assumes all boxes run Linux. windoze boxes will be similar, but
the command will be different, and the display more confusing.
2. You don't mention distributions or versions, so I can't tell you what
file to edit, or what tool to use to get the above configuration.
3. On computer2, the route to 192.168.1.0 isn't really _required_ as it
is covered by the default.
4. The router must be forwarding packets AND MASQUERADING (also called
NAT) to allow packets out to the world.

>Woudl be great if you can tell me how to do it becouse I really didn't
>understan...

http://tldp.org/guides.html
http://ibiblio.org/pub/linux/docs/linux-doc-project/

-rw-rw-r-- 1 gferg ldp 705493 Jan 5 2001 nag2.html.tar.gz
-rw-rw-r-- 1 gferg ldp 1604859 Feb 27 2001 nag2.pdf
-rw-rw-r-- 1 gferg ldp 1069355 Feb 27 2001 nag2.ps.gz
-rw-rw-r-- 1 gferg ldp 635097 Jan 5 2001 nag2.sgml.tar.gz

The 'nag2' is the second edition of the "Linux Network Administrator's
Guide", about a 500 page book in the dead tree version (O'Reilly and
Assoc., ISBN 1-56592-400-2, US$35), but yours for the free download.

        Old guy