On Fri, Jan 21, 2011 at 12:53 PM, George P. Burdell <[email protected]>wrote:
> I know this is a pretty frequently-occurring newbie question but I
> just haven't been able to find a clear answer for my exact problem on
> Debian (lenny). I have two NIC's on my linux box. eth0 is connected to
> a router, which is connected to the Internet. eth1 is connected to a
> set of other linux boxes via a separate switch as a private network
> (which is to function as a Sun/Oracle Grid Engine cluster), and these
> linux boxes do not need Internet access.
>
> The router is 192.168.1.1, so I set eth0 as 192.168.1.200 (there are a
> bunch of Windows PC's connected to the router, e.g. 192.168.1.100,
> 192.168.1.101, etc.), and eth1 as 192.168.2.1 so that the private
> network will have address 192.168.2.x (the other linux boxes connected
> to the switch are 192.168.2.101, 192.168.2.102, ...)
>
> My /etc/network/interfaces file looks like this:
>
> ===============================
> # The loopback network interface
> auto lo
> iface lo inet loopback
>
> # The primary network interface
> allow-hotplug eth0
> #iface eth0 inet dhcp
> iface eth0 inet static
> address 192.168.1.200
> netmask 255.255.255.0
> broadcast 192.168.1.255
> gateway 192.168.1.1
> dns-domain lan
> dns-nameservers 192.168.1.1
>
> allow-hotplug eth1
> iface eth1 inet static
> address 192.168.2.1
> netmask 255.255.255.0
> gateway 192.168.2.1
> ===============================
>
> The "route" command gives me this ("amade" is the name of the linux box):
>
> ===============================
> Kernel IP routing table
> Destination Gateway Genmask Flags Metric Ref Use
> 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.1.1 0.0.0.0 UG 0 0 0
> eth0
> default amade-eth1 0.0.0.0 UG 0 0 0
> eth1
> ===============================
>
> What am I doing wrong here?
>
> One problem is that sometimes the "route" command gives me something like:
>
> ===============================
> Kernel IP routing table
> Destination Gateway Genmask Flags Metric Ref Use
> 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 amade-eth1 0.0.0.0 UG 0 0 0
> eth1
> default 192.168.1.1 0.0.0.0 UG 0 0 0
> eth0
> ===============================
>
> in which case the linux box cannot access the Internet, because
> "amade-eth1" seems to take precedence over the router as a gateway to
> the Internet, which of course will not work.
>
> George.
>
>
> --
> To UNSUBSCRIBE, email to [email protected]
> with a subject of "unsubscribe". Trouble? Contact
> [email protected]
> Archive:
> http://lists.debian.org/[email protected]
>
>
add "metric 100" to your eth1, kernel will always choose your eth0 as first
default gateway.
--
Linuxer using Arch/Ubuntu, Pythoner, Geek
--> Blog: http://apt-blog.net
--> FB: http://www.facebook.com/boypt