Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 99818

Summary: /etc/conf.d/net with two NICs can easily break the gateway setting
Product: Gentoo Linux Reporter: Jules Colding <colding>
Component: [OLD] baselayoutAssignee: Roy Marples (RETIRED) <uberlord>
Status: RESOLVED INVALID    
Severity: minor    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jules Colding 2005-07-21 10:53:52 UTC
I have two NICs. My network will not work unless the gateway is specified to
"sit on" eth1. 

*) This will work: gateway="eth1/10.0.1.1"

**) This will not work: gateway="eth0/10.0.1.1"

The problem is easily seen when the gateway is "moved to" eth0. 

A "/etc/init.d/net.eth0 restart" will give you a functioning network but a
following "/etc/init.d/net.eth1 restart" will break the network. As eth0 is
started before eth1 when booting, this has the consequence of making the network
not working. Putting the gateway on eth1 will make the network work as eth1 is
started last in the boot sequence. 

Reproducible: Always
Steps to Reproduce:
1.See "Details" above.
2.
3.

Actual Results:  
The gateway *must* sit on the NIC that is started last in the boot sequence.
This should at least be mentioned in the handbook.


Expected Results:  
It should be possible to specify a gateway that isn't bound to any local NIC in
particular. 


omc-1 conf.d # emerge --info
Portage 2.0.51.22-r2 (default-linux/x86/2005.0, gcc-3.3.5-20050130,
glibc-2.3.5-r0, 2.6.11-gentoo-r11 i686)
=================================================================
System uname: 2.6.11-gentoo-r11 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz
Gentoo Base System version 1.6.13
dev-lang/python:     2.3.5
sys-apps/sandbox:    1.2.10
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.18-r1
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config
/usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/
http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/
http://pandemonium.tiscali.de/pub/gentoo/
ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo http://mirror.gentoo.no/
http://gentoo.prz.rzeszow.pl http://ftp.du.se/pub/os/gentoo
ftp://mirror.pudas.net/gentoo"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 X apm berkdb bitmap-fonts bzip2 cdr crypt cups curl eds emacs emboss
fam fbcon foomaticdb fortran gdbm gif gnome gstreamer gtk gtk2 gtkhtml hal imlib
ipv6 jpeg libg++ libwww motif mozilla mpeg ncurses nls nptl opengl pam pdflib
perl png python quicktime readline sdl spell ssl symlink tcpd tetex tiff
truetype truetype-fonts type1-fonts unicode xml2 xv zlib userland_GNU
kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTDIR_OVERLAY
Comment 1 Roy Marples (RETIRED) gentoo-dev 2005-07-21 13:14:53 UTC
The new configuration in baselayout-1.11.13 allows the use of the route_eth0
syntax to set gateways

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=1

routes_eth0=( "default via 10.0.1.1" )
routes_eth1=( "default via 10.0.1.1" )
Comment 2 Jules Colding 2005-07-21 15:10:14 UTC
(In reply to comment #1)
> The new configuration in baselayout-1.11.13 allows the use of the route_eth0
> syntax to set gateways
> 
> http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=1
> 
> routes_eth0=( "default via 10.0.1.1" )
> routes_eth1=( "default via 10.0.1.1" )

I tried that, but it doesn't work. My exact /etc/conf.d/net is:

#############
iface_eth0="10.0.1.4 broadcast 10.0.1.255 netmask 255.255.255.0"
iface_eth1="10.0.1.5 broadcast 10.0.1.255 netmask 255.255.255.0"

routes_eth0=( "default via 10.0.1.1" )
routes_eth1=( "default via 10.0.1.1" )

#gateway="eth1/10.0.1.1"
#############

It only works if the "gateway=..." is effective.

Comment 3 Roy Marples (RETIRED) gentoo-dev 2005-07-21 16:21:18 UTC
config_eth0=( "10.0.1.4 broadcast 10.0.1.255 netmask 255.255.255.0" )
config_eth1=( "10.0.1.5 broadcast 10.0.1.255 netmask 255.255.255.0" )

routes_eth0=( "default via 10.0.1.1" )
routes_eth1=( "default via 10.0.1.1" )

There ya go :)
BTW, the gateway var is translated into a routes_ethx variable

However - with the current stable version of baselayout you can only have one
default route, and you're adding two - if both interfaces are active at the same
time.

baselayout-1.12.0 will solve this issue by clever use of route metrics :)
Comment 4 Jules Colding 2005-07-21 17:48:41 UTC
(In reply to comment #3)
> config_eth0=( "10.0.1.4 broadcast 10.0.1.255 netmask 255.255.255.0" )
> config_eth1=( "10.0.1.5 broadcast 10.0.1.255 netmask 255.255.255.0" )
> 
> routes_eth0=( "default via 10.0.1.1" )
> routes_eth1=( "default via 10.0.1.1" )
> 
> There ya go :)

Thanks a lot. Works fine :-)