From: Niall O Broin (niall at domain linux.ie)
Date: Fri 10 Aug 2001 - 23:29:38 IST
On Fri, Aug 10, 2001 at 06:31:11PM +0100, Oisin Kim wrote:
> The hardware I have is 4 PCs running red hat. Each PC has 2 network cards, on
> each machine each card is attached to two separate hubs.
>
> What I'd like to do is have one network card configured as a private network
> interface on each machine, so as all traffic for the 4 local machines would
> pass through this card and the "local" hub. For any other traffic the
> machines should consult the DNS server as normal and pass through the other
> network card and the "external" hub.
>
> I was wondering if modifying the /etc/hosts file will be enough to enforce
> this or what esle must I do.
What you need is to modify the routing table on each machine so that
each machine knows that when it needs to access another machine in the
little private group, it must use the private NIC. I'm not sure about RH but
I just added an aliased interface, which is logically equivalent to another
NIC at an IP/routing level. I use 192.168.1.0 as my HAN range so the normal
output of netstat -r on my box is
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
loopback * 255.0.0.0 U 0 0 0 lo
and when I added eth0:0 as 192.168.2.1 by simply doing
ifconfig eth0:0 192.168.2.1
I got the following routing table
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.2.0 * 255.255.255.0 U 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
loopback * 255.0.0.0 U 0 0 0 lo
If instead of eth0:0 I had a second NIC, I'd have this routing table
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.2.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
loopback * 255.0.0.0 U 0 0 0 lo
In your case, 192.168.2.0 will be your private network, and all traffic from
one of your boxes to any host on that network i.e. the local group will use
eth1. All traffic to 192.168.1.0 (presumably in Trinity it'll be something
bigger) i.e. "the world" will go through eth0 and you'll have one more entry
in your routing table for your default gateway e.g. 192.168.2.250 so that
you'll have a routing table like
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.2.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
default 192.168.2.250 0.0.0.0 UG 0 0 0 eth0
loopback * 255.0.0.0 U 0 0 0 lo
Of course local circumstances may make this a little different, but I hope
you get the picture. You say that you have 4 PCs running RH each of which has
two NICs. If this is the case, and these NICs are already configured and
connected as you mentioned, then the traffic should already be as I think
you want it to be, provided of course that each local PC refers to the
others by the local IP address. You can ensure this by making sure that the
entries for each local machine in all the local machines' /etc/hosts files
refer to the local IP addresses and not the wider ones e.g.
192.168.2.1 pc1
192.168.2.2 pc2
192.168.2.3 pc3
192.168.2.4 pc4
and NOT
192.168.1.1 pc1
192.168.1.2 pc2
192.168.1.3 pc3
192.168.1.4 pc4
In either case above, pc1-pc4 will be able to talk to each other, but only
in the first case will they use eth1, assuming everything is setup as I
mentioned.
In hindsight, the answer to
> I was wondering if modifying the /etc/hosts file will be enough to enforce
> this or what esle must I do.
is probably YES provided that everything else is set up in a similar manner
to that described above.
Niall
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:11:34 GMT