setup 2 different network in one linux box

Dwight A. Ernest dwight at significant.com
Fri Feb 13 20:21:57 EST 2004


Now I see that Dave specified the gateways, but not the default route, 
so my reply is modified below (read the whole question, Dwight! sheesh!)

Dave Peters wrote:

> Hi all,
> 
> One of my friend needs help.
> Here is the case:
> he needs to setup a redhat9.0 linux box with two
> different subnet.
> eth0 192.168.1.200
> eth1 10.1.1.100
> so eth0 can talk to 192.168.X.X subnet and eth1 can
> talk to 10.1.X.X.
> I have no ideal how this can be setup because they
> have 2 different gateway 192.168.1.2 and 10.1.1.2
> Any help are very appreciated.
> 
> DP

To give a complete answer, we need to know the following:

- Default gateway IP address(es) (i.e., how he can get to the global
internet, if at all)

If we can assume that both networks are /24's, e.g. a netmask of
255.255.255.0, then he should set up the following:

In /etc/sysconfig/network-scripts/ifcfg-eth0:
---
DEVICE=eth0
BOOTPROTO=
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
PEERDNS=no
IPADDR=192.168.1.200
BROADCAST=192.168.1.255
NETMASK=255.255.255.0
GATEWAY=192.168.1.2
---
In /etc/sysconfig/network-scripts/ifcfg-eth1:
---
DEVICE=eth1
BOOTPROTO=
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
PEERDNS=no
IPADDR=10.1.1.100
BROADCAST=10.1.1.255
NETMASK=255.255.255.0
GATEWAY=10.1.1.2
---

Once we know the default route to the global internet, I can specify the 
proper 'route add' syntax.

-- 
Dwight A. Ernest, dwight at significant dot com.     KA2CNN
Cell: +1-508-523-1416  FAX: +1-978-405-2504 YIM: dwight_ernest
Papa, partner, pilot, net geek, sysadmin, consultant, cohouser.
Red Hat (Linux) Certified Engineer (RHCE) #803004293310030





More information about the Discuss mailing list