Mailing List Archive

multiple nics ordering, static routes
I have 3 nic's in a computer. How can I change what order then come up
as, as far as eth0, eth1, eth2?

Also, how can a static route be added to /etc/conf.d/net?

Thanks.

-Josh

--
gentoo-user@gentoo.org mailing list
Re: multiple nics ordering, static routes [ In reply to ]
Josh Close <narshe <at> gmail.com> writes:

>
> I have 3 nic's in a computer. How can I change what order then come up
> as, as far as eth0, eth1, eth2?
>
> Also, how can a static route be added to /etc/conf.d/net?
>
> Thanks.
>
> -Josh
>
> --
> gentoo-user <at> gentoo.org mailing list
>
>
>

Here's a script I use on my system, drop it in /etc/init.d and update net.eth0
as shown in the comments below.

/etc/init.d/nameif
#!/sbin/runscript

#
# for this script to work do the following:
# 1. Update /etc/init.d/net.eth0 to include
# "need nameif" prior to the "use hotplug .." line.
#
# 2. Reassign the existing eth0, eth1, etc to
# "unused" names so that we can reassign
# them. The kernel will not "overwrite" an
# existing device name (e.g. eth1 can't be renamed to eth0
# until eth0 is "removed"/renamed.)

start() {
# First rename the existing eth0, ...
# Motherboard
/sbin/nameif -s foo0 00:0a:e6:f9:55:02
# 3Com 3c905b
/sbin/nameif -s foo1 00:01:02:cd:82:02
# Linksys
/sbin/nameif -s foo2 00:03:6d:1a:3f:c3

# Now assign the "standard" names in the
# preferred order
# Motherboard
/sbin/nameif -s eth0 00:0a:e6:f9:55:02
# 3Com 3c905b
/sbin/nameif -s eth1 00:01:02:cd:82:02
# Linksys
/sbin/nameif -s eth2 00:03:6d:1a:3f:c3
}




--
gentoo-user@gentoo.org mailing list
Re: Re: multiple nics ordering, static routes [ In reply to ]
On Mon, 13 Sep 2004 14:33:42 +0000 (UTC), John Sivak
<jsivak@winterjewel.com> wrote:
>
>
> Josh Close <narshe <at> gmail.com> writes:
>
> >
> > I have 3 nic's in a computer. How can I change what order then come up
> > as, as far as eth0, eth1, eth2?
> >
> > Also, how can a static route be added to /etc/conf.d/net?
> >
> > Thanks.
> >
> > -Josh
> >
> > --
> > gentoo-user <at> gentoo.org mailing list
> >
> >
> >
>
> Here's a script I use on my system, drop it in /etc/init.d and update net.eth0
> as shown in the comments below.
>
> /etc/init.d/nameif
> #!/sbin/runscript
>
> #
> # for this script to work do the following:
> # 1. Update /etc/init.d/net.eth0 to include
> # "need nameif" prior to the "use hotplug .." line.
> #
> # 2. Reassign the existing eth0, eth1, etc to
> # "unused" names so that we can reassign
> # them. The kernel will not "overwrite" an
> # existing device name (e.g. eth1 can't be renamed to eth0
> # until eth0 is "removed"/renamed.)
>
> start() {
> # First rename the existing eth0, ...
> # Motherboard
> /sbin/nameif -s foo0 00:0a:e6:f9:55:02
> # 3Com 3c905b
> /sbin/nameif -s foo1 00:01:02:cd:82:02
> # Linksys
> /sbin/nameif -s foo2 00:03:6d:1a:3f:c3
>
> # Now assign the "standard" names in the
> # preferred order
> # Motherboard
> /sbin/nameif -s eth0 00:0a:e6:f9:55:02
> # 3Com 3c905b
> /sbin/nameif -s eth1 00:01:02:cd:82:02
> # Linksys
> /sbin/nameif -s eth2 00:03:6d:1a:3f:c3
> }
>
> --
> gentoo-user@gentoo.org mailing list
>
>


There has to be a better way than that...

Isn't there some way to specify in a .conf file or something the order
that the modules get loaded? Or the devices get checked?

-Josh

--
gentoo-user@gentoo.org mailing list
Re: Re: multiple nics ordering, static routes [ In reply to ]
> I have 3 nic's in a computer. How can I change what order then come up
> as, as far as eth0, eth1, eth2?

If your NIC drivers are modules, there are options that you can pass
in the kernel command line (or, I think, in /etc/modules.conf) that
will determine the module load order. See the Ethernet-HOWTO
(specifically, section 2.4):
http://www.ibiblio.org/mdw/HOWTO/Ethernet-HOWTO-2.html#ss2.4

--
gentoo-user@gentoo.org mailing list
Re: multiple nics ordering, static routes [ In reply to ]
James Hiscock wrote:

>>I have 3 nic's in a computer. How can I change what order then come up
>>as, as far as eth0, eth1, eth2?
>
>
> If your NIC drivers are modules, there are options that you can pass
> in the kernel command line (or, I think, in /etc/modules.conf) that
> will determine the module load order. See the Ethernet-HOWTO
> (specifically, section 2.4):
> http://www.ibiblio.org/mdw/HOWTO/Ethernet-HOWTO-2.html#ss2.4
>
> --
> gentoo-user@gentoo.org mailing list
>
>
I use compiled in drivers, not modules; hence the "nameif" song and dance.


--
gentoo-user@gentoo.org mailing list
Re: Re: multiple nics ordering, static routes [ In reply to ]
On Mon, 13 Sep 2004 14:55:29 -0400, John Sivak <jsivak@winterjewel.com> wrote:
>
>
> James Hiscock wrote:
>
> >>I have 3 nic's in a computer. How can I change what order then come up
> >>as, as far as eth0, eth1, eth2?
> >
> >
> > If your NIC drivers are modules, there are options that you can pass
> > in the kernel command line (or, I think, in /etc/modules.conf) that
> > will determine the module load order. See the Ethernet-HOWTO
> > (specifically, section 2.4):
> > http://www.ibiblio.org/mdw/HOWTO/Ethernet-HOWTO-2.html#ss2.4
> >
> > --
> > gentoo-user@gentoo.org mailing list
> >
> >
> I use compiled in drivers, not modules; hence the "nameif" song and dance.

I'm using compiled in drivers also, but there must be another way than
writing a init script to do it.

-Josh

--
gentoo-user@gentoo.org mailing list
Re: Re: multiple nics ordering, static routes [ In reply to ]
> I'm using compiled in drivers also, but there must be another way than
> writing a init script to do it.

There is: check out /usr/src/linux/Documentation/kernel-parameters.txt
- specifically the "ethers=" or "netdev=" parameters... The same thing
is covered in the Ethernet-HOWTO I mentioned earlier...

--
gentoo-user@gentoo.org mailing list
Re: multiple nics ordering, static routes [ In reply to ]
James Hiscock wrote:

>>I'm using compiled in drivers also, but there must be another way than
>>writing a init script to do it.
>
>
> There is: check out /usr/src/linux/Documentation/kernel-parameters.txt
> - specifically the "ethers=" or "netdev=" parameters... The same thing
> is covered in the Ethernet-HOWTO I mentioned earlier...
>
> --
> gentoo-user@gentoo.org mailing list
>
>

If I'm reading the docs correctly, using the kernel-parameters means
that I'd have to know/determine the IRQ or base address to "define" the
NIC "names" in the order I wanted.

I prefer specifying the names by MAC address rather than IRQ/Base address.

In the end though, it appears that the easiest solution is to compile
the network support as modules and use /etc/modules.conf.


--
gentoo-user@gentoo.org mailing list
Re: Re: multiple nics ordering, static routes [ In reply to ]
Can anyone answer my other question then?

How can I add a static route to /etc/conf.d/net?

Right now I have made a custon init script that does it and added it
to boot, but I'd like to just use /etc/conf.d/net. I'm sure there's a
way, but I haven't seen anything on the gentoo site or gentoo forums.

Thanks.

-Josh


On Mon, 13 Sep 2004 17:33:36 -0400, John Sivak <jsivak@winterjewel.com> wrote:
>
>
> James Hiscock wrote:
>
> >>I'm using compiled in drivers also, but there must be another way than
> >>writing a init script to do it.
> >
> >
> > There is: check out /usr/src/linux/Documentation/kernel-parameters.txt
> > - specifically the "ethers=" or "netdev=" parameters... The same thing
> > is covered in the Ethernet-HOWTO I mentioned earlier...
> >
> > --
> > gentoo-user@gentoo.org mailing list
> >
> >
>
> If I'm reading the docs correctly, using the kernel-parameters means
> that I'd have to know/determine the IRQ or base address to "define" the
> NIC "names" in the order I wanted.
>
> I prefer specifying the names by MAC address rather than IRQ/Base address.
>
> In the end though, it appears that the easiest solution is to compile
> the network support as modules and use /etc/modules.conf.
>
>
>
>
> --
> gentoo-user@gentoo.org mailing list
>
>

--
gentoo-user@gentoo.org mailing list
Re: Re: multiple nics ordering, static routes [ In reply to ]
Josh Close wrote:

> Can anyone answer my other question then?
>
> How can I add a static route to /etc/conf.d/net?
>
> Right now I have made a custon init script that does it and added
> it to boot, but I'd like to just use /etc/conf.d/net. I'm sure
> there's a way, but I haven't seen anything on the gentoo site or
> gentoo forums.
>
> Thanks.
>
> -Josh
>
>
Josh, you should edit /etc/conf.d/net and add, for example,

routes_eth0("-net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.254"
"-host 192.176.3.164 gw 10.173.0.206")

you should be able to use routes_eth1, and routes_eth2 for your other
interfaces.

I don't think it matters where in /etc/conf.d/net these lines are
added, but I know it works when entered just before the default
gateway setting.

Hope this helps,
-SJ


--
gentoo-user@gentoo.org mailing list
Re: Re: multiple nics ordering, static routes [ In reply to ]
Josh Close <narshe@gmail.com> asks:
> Can anyone answer my other question then?
>
> How can I add a static route to /etc/conf.d/net?

Comments in the file:

# Specify routes as an array per interface, for example:
# routes_eth0=(
# "-net 10.1.0.0 netmask 255.255.0.0 gw 10.0.0.5"
# "-net 10.2.0.0 netmask 255.255.0.0 gw 10.0.0.6"
# "-host 10.3.0.1 dev eth0"
# )
#
# You can optionally use the gateway variable or just put the default route
# in the routes variable. The following two are REDUNDANT:
#
#
# routes_eth0=( "default gw 10.0.0.5" )
# gateway="eth0/10.0.0.5"
#

For consistency I like the first way to specify the default route.

For multiple network interfaces make /etc/init.d/net.eth1 a symlink to
net.eth0, and set up ifconfig_eth1, routes_eth1, etc.


--
Barry.Schwartz@acm.org http://www.livejournal.com/users/chemoelectric/
"It struck me as I was speaking to people in Bangor, Maine, that
this president sees America as we think about a 10-year-old child."
-- Andrew Card

--
gentoo-user@gentoo.org mailing list
Re: Re: multiple nics ordering, static routes [ In reply to ]
Thanks, this should work.

-Josh


On Mon, 13 Sep 2004 19:51:51 -0500, barryschwartz124@comcast.net
<barryschwartz124@comcast.net> wrote:
> Josh Close <narshe@gmail.com> asks:
> > Can anyone answer my other question then?
> >
> > How can I add a static route to /etc/conf.d/net?
>
> Comments in the file:
>
> # Specify routes as an array per interface, for example:
> # routes_eth0=(
> # "-net 10.1.0.0 netmask 255.255.0.0 gw 10.0.0.5"
> # "-net 10.2.0.0 netmask 255.255.0.0 gw 10.0.0.6"
> # "-host 10.3.0.1 dev eth0"
> # )
> #
> # You can optionally use the gateway variable or just put the default route
> # in the routes variable. The following two are REDUNDANT:
> #
> #
> # routes_eth0=( "default gw 10.0.0.5" )
> # gateway="eth0/10.0.0.5"
> #
>
> For consistency I like the first way to specify the default route.
>
> For multiple network interfaces make /etc/init.d/net.eth1 a symlink to
> net.eth0, and set up ifconfig_eth1, routes_eth1, etc.
>
> --
> Barry.Schwartz@acm.org http://www.livejournal.com/users/chemoelectric/
> "It struck me as I was speaking to people in Bangor, Maine, that
> this president sees America as we think about a 10-year-old child."
> -- Andrew Card
>
>
>
> --
> gentoo-user@gentoo.org mailing list
>
>

--
gentoo-user@gentoo.org mailing list
Re: multiple nics ordering, static routes [ In reply to ]
BarrySchwartz124@comcast.net wrote:

> Josh Close <narshe@gmail.com> asks:
>
>>Can anyone answer my other question then?
>>
>>How can I add a static route to /etc/conf.d/net?
>
>
> Comments in the file:
>
> # Specify routes as an array per interface, for example:
> # routes_eth0=(
> # "-net 10.1.0.0 netmask 255.255.0.0 gw 10.0.0.5"
> # "-net 10.2.0.0 netmask 255.255.0.0 gw 10.0.0.6"
> # "-host 10.3.0.1 dev eth0"
> # )
> #
> # You can optionally use the gateway variable or just put the default route
> # in the routes variable. The following two are REDUNDANT:
> #
> #
> # routes_eth0=( "default gw 10.0.0.5" )
> # gateway="eth0/10.0.0.5"
> #
>
> For consistency I like the first way to specify the default route.
>
> For multiple network interfaces make /etc/init.d/net.eth1 a symlink to
> net.eth0, and set up ifconfig_eth1, routes_eth1, etc.
>
>
Where is routes_ethX documented?

I've looked on several of my Gentoo boxes and none of their
/etc/conf.d/net files have comments like those above..


--
gentoo-user@gentoo.org mailing list
Re: Re: multiple nics ordering, static routes [ In reply to ]
I'd like to know this also.

-Josh


On Tue, 14 Sep 2004 08:47:29 -0400, John Sivak <jsivak@winterjewel.com> wrote:
> BarrySchwartz124@comcast.net wrote:
>
> > Josh Close <narshe@gmail.com> asks:
> >
> >>Can anyone answer my other question then?
> >>
> >>How can I add a static route to /etc/conf.d/net?
> >
> >
> > Comments in the file:
> >
> > # Specify routes as an array per interface, for example:
> > # routes_eth0=(
> > # "-net 10.1.0.0 netmask 255.255.0.0 gw 10.0.0.5"
> > # "-net 10.2.0.0 netmask 255.255.0.0 gw 10.0.0.6"
> > # "-host 10.3.0.1 dev eth0"
> > # )
> > #
> > # You can optionally use the gateway variable or just put the default route
> > # in the routes variable. The following two are REDUNDANT:
> > #
> > #
> > # routes_eth0=( "default gw 10.0.0.5" )
> > # gateway="eth0/10.0.0.5"
> > #
> >
> > For consistency I like the first way to specify the default route.
> >
> > For multiple network interfaces make /etc/init.d/net.eth1 a symlink to
> > net.eth0, and set up ifconfig_eth1, routes_eth1, etc.
> >
> >
> Where is routes_ethX documented?
>
> I've looked on several of my Gentoo boxes and none of their
> /etc/conf.d/net files have comments like those above..
>
>
>
>
> --
> gentoo-user@gentoo.org mailing list
>
>

--
gentoo-user@gentoo.org mailing list
Re: Re: multiple nics ordering, static routes [ In reply to ]
On Mon, 13 Sep 2004 19:51:51 -0500, barryschwartz124@comcast.net
<barryschwartz124@comcast.net> wrote:
> Josh Close <narshe@gmail.com> asks:
> > Can anyone answer my other question then?
> >
> > How can I add a static route to /etc/conf.d/net?
>
> Comments in the file:
>
> # Specify routes as an array per interface, for example:
> # routes_eth0=(
> # "-net 10.1.0.0 netmask 255.255.0.0 gw 10.0.0.5"
> # "-net 10.2.0.0 netmask 255.255.0.0 gw 10.0.0.6"
> # "-host 10.3.0.1 dev eth0"
> # )

Does it have to have the ( ) around the strings? I've always done

alias_eth0="\
10.10.1.1 \
10.10.1.2 \
10.10.1.3 \
"

and it seems to have worked. Is it 'cause they need to be in different
strings? Where is this documented (the route_ethx part)?

-Josh



> #
> # You can optionally use the gateway variable or just put the default route
> # in the routes variable. The following two are REDUNDANT:
> #
> #
> # routes_eth0=( "default gw 10.0.0.5" )
> # gateway="eth0/10.0.0.5"
> #
>
> For consistency I like the first way to specify the default route.
>
> For multiple network interfaces make /etc/init.d/net.eth1 a symlink to
> net.eth0, and set up ifconfig_eth1, routes_eth1, etc.
>
> --
> Barry.Schwartz@acm.org http://www.livejournal.com/users/chemoelectric/
> "It struck me as I was speaking to people in Bangor, Maine, that
> this president sees America as we think about a 10-year-old child."
> -- Andrew Card
>
>
>
> --
> gentoo-user@gentoo.org mailing list
>
>

--
gentoo-user@gentoo.org mailing list
Re: Re: multiple nics ordering, static routes [ In reply to ]
Josh Close wrote:
<snip>
>>Where is routes_ethX documented?
>>
>>I've looked on several of my Gentoo boxes and none of their
>>/etc/conf.d/net files have comments like those above..

The file /etc/conf.d/net is parsed by /etc/init.d/net.eth0 at startup.
Then any routes elements found in the routes_ethX array are then passed
to /sbin/route. Look from line 153 in /etc/init.d/net.eth0

For more information on how to construct the elements of your your
routes_ethX array, you need to look at the man pages for the route
command (try 'man route' at your shell prompt).

Hope that helps some more.
-SJ



--
gentoo-user@gentoo.org mailing list