View previous topic :: View next topic |
Author |
Message |
Vineus n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 23 Mar 2006 Posts: 42 Location: Paris, France
|
Posted: Thu Mar 22, 2007 11:19 pm Post subject: net init script running "dhcpcd -m 2000" [solved] |
|
|
Hi
I recently tried to set up my wireless card using the init scripts (I had a home made shell script before).
I want to know if someone can told me why the init script launched dhcpcd with the metric 2000 ? Let me explain: (XXXXX is my WEP key)
Code: |
[ root:/ ]$ cat /etc/conf.d/net
config_eth0=( "192.168.0.42" )
routes_eth0=( "default via 192.168.0.1" )
modules_eth1=("iwconfig")
[ root:/ ]$ cat /etc/conf.d/wireless
essid_eth1="apt6"
mode_eth1="auto"
channel_eth1="3"
associate_timeout_eth1="5"
key_apt6="XXXXXXX"
config_apt6=("dhcp")
preferred_aps_eth1=( "apt6" )
[ root:/ ]$ /etc/init.d/net.eth1 start
* Starting eth1
* Configuring wireless network for eth1
* eth1 connected to ESSID "apt6" at 00:06:25:E6:BC:6F
* in managed mode on channel 10 (WEP enabled - restricted)
* Configuration not set for eth1 - assuming DHCP
* Bringing up eth1
* dhcp
* Running dhcpcd ... [ ok ]
* eth1 received address 192.168.1.101/24
[ root:/ ]$
|
dhcpcd takes a very long time before I get an IP. At the end, I can ping the routeur but no external URLs or IP.
So I tried to find out what dhcpcd did and while it was setting up I did:
Code: |
[ root:~ ]$ ps aux | grep dhcp
root 16851 0.0 0.1 1568 524 pts/3 R+ 18:44 0:00 /sbin/dhcpcd -h bloutch42 -m 2000 eth1
root 16853 0.0 0.0 1640 472 pts/4 R+ 18:44 0:00 grep dhcp
|
I think the problem comes from the metric, because when I type "route" to get the routes it takes soooooo long before giving me the routes.
If I kill dhcpcd and relaunch it without options, everything works just fine.
So, I tried to override dhcpcd options in the init script as it is stated in the documentation of wireless configuration file:
Code: |
[ root:/ ]$ cat /etc/conf.d/wireless | grep dhcpcd
dhcpcd_apt6="-m 0"
|
And guess what happend on dhcpcd launching:
Code: |
[ root:~ ]$ ps aux | grep dhcp
root 17504 0.0 0.1 1708 704 pts/3 S+ 18:45 0:00 /sbin/dhcpcd -h bloutch42 -m 0 -m 2000 eth1
root 17524 0.0 0.0 1636 468 pts/4 R+ 18:45 0:00 grep dhcp
|
I'm just loving it. Great overriding.
Does someone has any clue to change the default metric for dhcpcd on wireless net init scripts ? I could not found were it is set.
Thank you for your help. _________________ Vineus
Last edited by Vineus on Fri Mar 23, 2007 1:24 pm; edited 2 times in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Vineus n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 23 Mar 2006 Posts: 42 Location: Paris, France
|
Posted: Thu Mar 22, 2007 11:39 pm Post subject: |
|
|
Ok, I found a solution.
Gentoo gives to the wireless card a very high metric and to the wired card a very low metric. So if I stop my wired card before starting my wireless card, everything works fine :
Code: |
[ root:~ ]$ cat /proc/net/route
Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
eth1 0001A8C0 00000000 0001 0 0 2000 00FFFFFF 0 0 0
eth0 0000A8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
lo 0000007F 00000000 0001 0 0 0 000000FF 0 0 0
eth0 00000000 0100A8C0 0003 0 0 0 00000000 0 0 0
eth1 00000000 0101A8C0 0003 0 0 2000 00000000 0 0 0
[ root:~ ]$ /etc/init.d/net.eth0 stop
* Caching service dependencies ... [ ok ]
* Stopping eth0
* Bringing down eth0
* Shutting down eth0 ... [ ok ]
[ root:~ ]$ cat /proc/net/route
Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
eth1 0001A8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
lo 0000007F 00000000 0001 0 0 0 000000FF 0 0 0
eth1 00000000 0101A8C0 0003 0 0 0 00000000 0 0 0
[ root:~ ]$
|
But let me just says : it sucks.
Is there any other way than modifying the gentoo script functions and the function "calculate_metric()" to have a low metric on the wireless interface ? _________________ Vineus |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
UberLord Retired Dev
![Retired Dev Retired Dev](/images/ranks/rank-retired.gif)
![](images/avatars/16007251014200867ea775c.gif)
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Vineus n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 23 Mar 2006 Posts: 42 Location: Paris, France
|
Posted: Fri Mar 23, 2007 1:32 pm Post subject: |
|
|
Thank you for your help.
I totally understand the point of view about the higher metric for wired than wireless. I found the parameter "metric_ethX=" and its description in net.example, I should have RTFM more before asking the forum (as usual )
I finally made two runlevels: wired and wireless and I choose at boottime wenever I want to get a wireless or wired connexion.
Thanx again. _________________ Vineus |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|