On Thu, 20 Mar 2008, in the Usenet newsgroup comp.os.linux.networking, in
article
>Amy Lee wrote:
>> There are 7 PCs at my office and I make 2 team of them. 3 PCs is
>> group called A net, other 4 PCs is a group called B net. A net IP
>> range is from 192.168.0.1 to 192.168.0.3, B net IP range is from
>> 11.11.11.1 to 11.11.11.4. A net uses a switch X, B net uses a switch Y.
See RFC1918 (or RFC3330) for "suitable" IP address ranges. Your "B net"
can use 192.168.11.1 to 192.168.11.4 and not have to worry about
confusion. The '11.x.x.x' net is actually in use on the Internet.
>> These PCs are running Redhat 9 Linux.
Red Hat 9 was end-of-life 30 April 2004, although there were a few
backported errata released randomly until July 2006. It is now
unsupported, and should be replaced. As long as the systems have NO
access to the Internet (or any other hostile place), this could be OK,
but you really should get a "modern" distribution to avoid problems.
>> What should I do if I hope connect A and B net? Do I need another
>> PC as a gateway or just a ether line?
>Assuming that the A group and B group are isolated right now, all you
>need to do is set up 1 Pc in the A group or B group that has 2 NICs..
>one will be cabled to the A switch and one will be cabled to the B switch.
Agree
>It will have both a 192.168.0.x and 11.11.11.x ip address assigned to it.
Meaning eth0 will be (EXAMPLE) 192.168.0.1 and eth1 will be 11.11.11.1
or similar.
>If each group makes it their default router, then traffic for the 'other'
>group will go via the AB PC automatically.....
Well, that's one way to block all Internet access. Please be careful
about throwing around that 'default' word. IP networking uses the word
'default' in the programming sense - meaning "use this if nothing else
fits". That is, given the choice of A, B, and default, how do you get
to E? It's not A or B, so it must use the default.
The routing table on hosts on the "A net" should look like this:
[example ~]$ /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 95017 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 18 lo
11.11.11.0 192.168.0.1 255.255.255.0 UG 0 0 420 eth0
[example ~]$
while hosts on the "B net" should look like this:
[nutherbox ~] /sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
11.11.11.0 0.0.0.0 255.255.255.0 U 0 0 43521 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 18 lo
192.168.0.0 11.11.11.1 255.255.255.0 UG 0 0 617 eth0
[nutherbox ~]
For these boxes (and assuming the obsolete Red Hat 9), you need to
create files named '/etc/sysconfig/network-scripts/route-eth0' that has
a single line that reads
192.168.0.0/24 via 11.11.11.1
or
11.11.11.0/24 via 192.168.0.1
with suitable corrections for your actual numbers/netmask. On the box
with two NICs, the routing table should look like this:
[thirdbox ~]$ /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 82564 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 18 lo
11.11.11.0 0.0.0.0 255.255.255.0 U 0 0 58489 eth1
[thirdbox ~]$
and this is created by having /etc/sysconfig/network-scripts/ifcfg-eth0
and /etc/sysconfig/network-scripts/ifcfg-eth1 with the correct numbers.
>something like that.
echo 1 > /proc/sys/net/ipv4/ip_forward
on the box with two NICs, so it knows it should forward packets from one
network to the other. On Red Hat 9, this was controlled by having a line
FORWARD_IPV4=yes
in /etc/sysconfig/network.
Old guy