Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

wired & wireless network simultaneously > 2 default routes

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
19 posts • Page 1 of 1
Author
Message
cor
n00b
n00b
Posts: 13
Joined: Sun Sep 04, 2005 9:53 am

wired & wireless network simultaneously > 2 default r

  • Quote

Post by cor » Sun Sep 04, 2005 12:28 pm

I've just installed gentoo on my laptop, and I'm trying to get the wireless (ipw2100) working. Getting it to work when I disable the wired connection (/etc/init.d/net.eth0 stop) is flawless, but if I want it to work at the same time, resolving names stops. So, both interfaces work fine when the other one is stopped. I've searched the forums a bit and I get the idea that its an issue with my default routes:

Code: Select all

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
130.89.136.0    *               255.255.252.0   U     0      0        0 eth1
130.89.160.0    *               255.255.224.0   U     0      0        0 eth0
loopback        localhost       255.0.0.0       UG    0      0        0 lo
default         130.89.136.1    0.0.0.0         UG    0      0        0 eth1
default         130.89.160.1    0.0.0.0         UG    0      0        0 eth0
route takes a loooong time to complete, about a minute or two. My /etc/resolv.conf is still valid; the nameservers stay the same.
So, I am wondering how I can prevent two default routes, or even better, have eth0 be preferred (wired), but if it goes down, let eth1 take over (wireless). route works fine if only one intercae is up.

If I have only one interface up, my gateway is not represented by an ip adress but by name (which resolves to the gateway ip adress). Pinging anything by name fails (unknown host) if both interfaces are up , but by ip adress works ping works. When only one interface is up, ping by name works.

Maybe I'm looking at the wrong things as the cause for the problem, but I'm not at home with troubleshooting networks, so any help will be appreciated.
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Mon Sep 05, 2005 7:15 am

Could you test with baselayout-1.12.0_pre8 please?
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
cor
n00b
n00b
Posts: 13
Joined: Sun Sep 04, 2005 9:53 am

  • Quote

Post by cor » Mon Sep 05, 2005 8:32 am

Hi, thanks for the suggestion, I won't be able to do much work on my gentoo box during the week, but I'll try this in the weekend, I'll keep you informed on what happens.

Thanks!
Top
cor
n00b
n00b
Posts: 13
Joined: Sun Sep 04, 2005 9:53 am

  • Quote

Post by cor » Sat Sep 10, 2005 12:06 am

OK, I finally got around to upgrading (to baselayout-1.12.0_pre8-r2 I see now), and things haven't really become easier. My eth0 won't use dhcp:

Code: Select all

/etc/init.d/net.eth0 start
 * Starting eth0
 *   Bringing up eth0
 *     dhcp
 *     No loaded modules provide "dhcp" (dhcp_start)
 *     Trying fallback configuration
 *     www.xxx.yyy.zzz                                                    [ ok ]
If I bring eth0 down (/etc/init.d/net.eth0 stop) and then run ifconfig eth0 up && dhcpcd I get my IP adress and everything works.
My wireless connection also won't work anymore, it seems that some file which I didn't know the existence of has changed for the worse:

Code: Select all

/etc/init.d/net.eth1 start
 * Caching service dependencies ...                                       [ ok ]
 * Starting eth1
 *   Starting wpa_supplicant on eth1 ...                                  [ ok ]
/lib/rcscripts/net.modules.d/wpa_supplicant: array assign: line 103: syntax erro
r near unexpected token `('
/lib/rcscripts/net.modules.d/wpa_supplicant: array assign: line 103: `IEEE 802.1
X (NO WPA)'
I solved the wpa_supplicant error by removing a () pair form line 103 of the file in question:

Code: Select all

 local -a status="$( wpa_cli -i"$1" status | sed -n -e 's/^\(key_mgmt\|wpa_state\|EAP state\)=\([^=]\+\).*/\U\2/p' )"
Now, if I try to start eth1 the way it should (/etc/init.d/net.eth1 start) the wpa supplicant starts, and if i run wpa_cli from another terminal, I see it is assocatied with the right AP, but it still times out.

Code: Select all

 /etc/init.d/net.eth1 start
 * Starting eth1
 *   Starting wpa_supplicant on eth1 ...                                  [ ok ]
 *     Timed out                                                                        [ !! ] 
Again, if I start the whole thing manually, I get an ip adress: ifconfig eth1 up, wpa_supplicant -i eth1 -B -c /etc/wpa_supplicant.conf, dhcpcd eth1.

The bad thing is that I still have the same symptoms as I started out with, and I have to go through more hassle to get everything as I used to have it.
Top
jamapii
l33t
l33t
User avatar
Posts: 637
Joined: Thu Sep 16, 2004 6:22 pm

  • Quote

Post by jamapii » Sat Sep 10, 2005 2:41 pm

Looks like a difficult problem. If you just remove one of the default routes (possibly in a postup() function), it will be missing when you need it again (when an interface goes down), so it must be restored in a predown() function. (in /etc/conf.d/net or /etc/conf.d/net.eth0 ...)

The removal must be conditional (if the other interface is up then remove our default route...)

If you unplug the wired net, you want it to go down (if only for its predown() function to restore the WLAN default route), maybe ifplugd can help with this.
Top
a2gentoo
n00b
n00b
Posts: 66
Joined: Wed Nov 17, 2004 2:26 am
Location: Derry, NH
Contact:
Contact a2gentoo
Website

I took the easy way out

  • Quote

Post by a2gentoo » Sat Sep 10, 2005 3:33 pm

I have a laptop with the IPW wireless card.

I just turned off the wired port in the BIOS. That enede the fight. Now my wireless is ETH0

c
BSD for my servers
Linux for my Laptop
Windows for my Spyware
-------------
Top
cor
n00b
n00b
Posts: 13
Joined: Sun Sep 04, 2005 9:53 am

  • Quote

Post by cor » Sat Sep 10, 2005 5:42 pm

@a2gentoo: This is not the problem I'm having. Both of my interfaces work, but not simultaneously. If your having problems with a fight between wired and wireless, remove eth0 (wired) from your standard runlevel, and only activate eth1 (wireless). This way, you won't have to reboot your pc if you want wired, but only activate eth1 via the usual, and deacitvate eth0.

@jamapii: Yeah, removing one of the default routes when both interfaces are up solves the problem. I guess using ifplugd's capabailities with postup and predown functions should do it, I'll see how far I get with that, and let you know of the progress. Thanks for the suggestion.

Also, unless I'm doing something obviously wrong (I ran etc-update, but I might have ignored somethings, rejected some changes) I guess I'll downgrade back to the stable baselayout
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Mon Sep 12, 2005 6:12 am

cor, the dhcp problem can be solved by emerging dhcpcd-2.0.0
Also, what version of wpa_supplicant are you using there?
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
cor
n00b
n00b
Posts: 13
Joined: Sun Sep 04, 2005 9:53 am

  • Quote

Post by cor » Mon Sep 12, 2005 8:00 am

Thanks, upgrading dhcpcd to 2.0 (from 1.3 something) solved the problem with bringing up networking on boot.

I'm using net-wireless/wpa_supplicant-0.3.9-r1, which I believe is the latest stable version.
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Mon Sep 12, 2005 8:52 am

Could you post the output of "wpa_cli -ieth1 status" please?
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
Apollyon
n00b
n00b
User avatar
Posts: 22
Joined: Mon Mar 10, 2003 10:24 pm
Location: Spain

  • Quote

Post by Apollyon » Tue Oct 25, 2005 10:13 am

Hi,

I have a similar problem. I think the best solution to this double default route thing would be to give a higher metric to the routes used by a particular interface over the other. That is, have the wired connection have a metric of 0, and the wireless one a metric of 1. This way, connections will always use the wired connection over the wireless if both are available.

The problem is that I don't know how to set the metrics automatically. I know of a tool, ifmetric, which does this, but I have to execute it every time my wireless interface comes up. Is there a way to have this executed automagically by specifying something in /etc/conf.d/net? I haven't been able to find anything about it in the documentation, and setting config_eth1=("dhcp metric 1") does nothing.
Top
petrjanda
Veteran
Veteran
User avatar
Posts: 1557
Joined: Fri Sep 05, 2003 10:04 pm
Location: Brno, Czech Republic
Contact:
Contact petrjanda
Website

  • Quote

Post by petrjanda » Tue Oct 25, 2005 10:55 am

Apollyon wrote:Hi,

I have a similar problem. I think the best solution to this double default route thing would be to give a higher metric to the routes used by a particular interface over the other. That is, have the wired connection have a metric of 0, and the wireless one a metric of 1. This way, connections will always use the wired connection over the wireless if both are available.

The problem is that I don't know how to set the metrics automatically. I know of a tool, ifmetric, which does this, but I have to execute it every time my wireless interface comes up. Is there a way to have this executed automagically by specifying something in /etc/conf.d/net? I haven't been able to find anything about it in the documentation, and setting config_eth1=("dhcp metric 1") does nothing.
Remove the default route entries from /etc/conf.d/net

Code: Select all

emerge iproute2

touch /etc/init.d/routes
chmod 755 /etc/init.d/routes
/etc/init.d/routes

Code: Select all

#!/sbin/runscript

start() {
        ebegin "Adding default routes"
        ip route add 0.0.0.0 dev eth0 via $GatewayIPAddress metric 0
        ip route add 0.0.0.0 dev eth1 via $GatewayIPAddress metric 1
        eend $?
}

stop() {
        ebegin "Removing default routes"
        ip route del 0.0.0.0 dev eth0 via $GatewayIPAddress metric 0
        ip route del 0.0.0.0 dev eth1 via $GatewayIPAddress metric 1
        eend $?
}
Substitute "$GatewayIPAddress" with real next-hop router addresses.
There is, a not-born, a not-become, a not-made, a not-compounded. If that unborn, not-become, not-made, not-compounded were not, there would be no escape from this here that is born, become, made and compounded. - Gautama Siddharta
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Tue Oct 25, 2005 11:22 am

Apollyon wrote:I have a similar problem. I think the best solution to this double default route thing would be to give a higher metric to the routes used by a particular interface over the other. That is, have the wired connection have a metric of 0, and the wireless one a metric of 1. This way, connections will always use the wired connection over the wireless if both are available.

The problem is that I don't know how to set the metrics automatically. I know of a tool, ifmetric, which does this, but I have to execute it every time my wireless interface comes up. Is there a way to have this executed automagically by specifying something in /etc/conf.d/net? I haven't been able to find anything about it in the documentation, and setting config_eth1=("dhcp metric 1") does nothing.
baselayout-1.12.0_pre9-r1 does this automatically for you if you set RC_AUTO_INTERFACE="yes" in /etc/conf.d/net

All stable dhcp clients can now just the route metric too :)

@petrjanda that's better done in postup()/postdown() functions in conf.d/net otherwise there will be issues if you start/stop interfaces.
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
petrjanda
Veteran
Veteran
User avatar
Posts: 1557
Joined: Fri Sep 05, 2003 10:04 pm
Location: Brno, Czech Republic
Contact:
Contact petrjanda
Website

  • Quote

Post by petrjanda » Tue Oct 25, 2005 11:53 am

UberLord wrote:
Apollyon wrote:I have a similar problem. I think the best solution to this double default route thing would be to give a higher metric to the routes used by a particular interface over the other. That is, have the wired connection have a metric of 0, and the wireless one a metric of 1. This way, connections will always use the wired connection over the wireless if both are available.

The problem is that I don't know how to set the metrics automatically. I know of a tool, ifmetric, which does this, but I have to execute it every time my wireless interface comes up. Is there a way to have this executed automagically by specifying something in /etc/conf.d/net? I haven't been able to find anything about it in the documentation, and setting config_eth1=("dhcp metric 1") does nothing.
baselayout-1.12.0_pre9-r1 does this automatically for you if you set RC_AUTO_INTERFACE="yes" in /etc/conf.d/net

All stable dhcp clients can now just the route metric too :)

@petrjanda that's better done in postup()/postdown() functions in conf.d/net otherwise there will be issues if you start/stop interfaces.
I thought RC_AUTO_INTERFACE was in /etc/conf.d/rc.

How exactly does it work?
There is, a not-born, a not-become, a not-made, a not-compounded. If that unborn, not-become, not-made, not-compounded were not, there would be no escape from this here that is born, become, made and compounded. - Gautama Siddharta
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Tue Oct 25, 2005 1:24 pm

petrjanda wrote:I thought RC_AUTO_INTERFACE was in /etc/conf.d/rc.

How exactly does it work?
I blogged about it earlier

http://roy.marples.name/node/203
http://roy.marples.name/node/207

Essentially, baselayout-1.12 knows something about the link (wired, wireless, bridge, tunnel etc) so we add a magic number (1000 for wireless) to the no of gateways below us (in metric terms).
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
danton
n00b
n00b
Posts: 3
Joined: Sat Feb 01, 2003 10:27 pm
Location: switzerland

  • Quote

Post by danton » Tue Oct 25, 2005 10:30 pm

Apollyon wrote:The problem is that I don't know how to set the metrics automatically. I know of a tool, ifmetric, which does this, but I have to execute it every time my wireless interface comes up. Is there a way to have this executed automagically by specifying something in /etc/conf.d/net? I haven't been able to find anything about it in the documentation, and setting config_eth1=("dhcp metric 1") does nothing.
These lines in /etc/conf.d/net

Code: Select all

dhcpcd_eth0=("-t 30 -m 10")
dhcpcd_eth1=("-t 30 -m 20")
seems to work for me (stable baselayout). Also, I use ifplugd for wired ethernet (eth0) and wpa_supplicant for wireless (eth1).
BTW, I start my wireless eth1 from a custom non-blocking script in default runlevel so that I don't have to wait for association with AP or timeout. Is there an "official gentoo" way of doing this?
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Wed Oct 26, 2005 10:22 am

The way I do is to compile my NIC drivers as external modules. coldplug then runs on boot, loads the modules by itself which triggers hotplug. hotplug then starts net.xxx for me

So I don't have any net.xxx scripts in any runlevels - except for net.lo in boot
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
risa2000
n00b
n00b
Posts: 35
Joined: Sun Oct 17, 2004 3:34 pm

  • Quote

Post by risa2000 » Fri Oct 28, 2005 12:48 pm

UberLord wrote:The way I do is to compile my NIC drivers as external modules. coldplug then runs on boot, loads the modules by itself which triggers hotplug. hotplug then starts net.xxx for me

So I don't have any net.xxx scripts in any runlevels - except for net.lo in boot
I do find something scary about having hotplug running based on loading the driver. In fact I thought it is the other way, once the device is attached, the hotplug loads the driver, right?

Unfortunately I found out that at least for network drivers, udev on my system, somehow (have to figure it out yet) executes corresponding /etc/init.d/net.* scripts. I use hotplug_eth0="no" in net config, but is there a way to remove this hotpluging stuff completely? Or, in other words, is it safe to run only udev, without hotplug?
Top
UberLord
Retired Dev
Retired Dev
User avatar
Posts: 6838
Joined: Thu Sep 18, 2003 10:26 am
Location: Blighty
Contact:
Contact UberLord
Website

  • Quote

Post by UberLord » Fri Oct 28, 2005 12:58 pm

You can always remove net.agent from /etc/hotplug to stop udev/hotplug from starting any network devices
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Top
Post Reply

19 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic