Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dhcpcd starts with net.eth0 but not with net.wlan0
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
jody
l33t
l33t


Joined: 16 Oct 2007
Posts: 682
Location: Switzerland

PostPosted: Wed Oct 14, 2009 7:44 pm    Post subject: dhcpcd starts with net.eth0 but not with net.wlan0 Reply with quote

Hi

I just installed wpa_supplicant and got my wireless running - somewhat.
Whenever i start it
Code:
 enki bin # /etc/init.d/net.wlan0 start
 * Starting wlan0
 *   Starting wpa_supplicant on wlan0 ...                               [ ok ]
 *   Starting wpa_cli on wlan0 ...                                      [ ok ]
 *     Backgrounding ...
it seems to get an address from dhcpcd. However, in our
network there seem to be several units which act as DHCP servers
and in order to get the real one, i'd have to blacklist them.

When i now do
Code:
dhcpcd -X 192.168.77.1 -X 192.168.0.1 wlan0
wlan0: dhcpcd already running on pid 13577 (/var/run/dhcpcd-wlan0.pid)
i first have to kill the dhcpcd and then repeat this command.
Code:
enki bin # dhcpcd -x wlan0
wlan0: sending signal 15 to pid 21643
wlan0: waiting for pid 21643 to exit
enki bin # dhcpcd -X 192.168.77.1 -X 192.168.0.1 wlan0
wlan0: dhcpcd 4.0.13 starting
wlan0: broadcasting for a lease
wlan0: ignoring blacklisted server 192.168.77.1
wlan0: ignoring blacklisted server 192.168.0.1
wlan0: offered 192.168.1.61 from 192.168.1.1
wlan0: acknowledged 192.168.1.61 from 192.168.1.1
wlan0: checking 192.168.1.61 is available on attached networks
wlan0: leased 192.168.1.61 for 86400 seconds


Interestingly, however, is the fact that with eth0 the whole thing works automatically:
Code:
enki bin # /etc/init.d/net.eth0 start
 * Starting eth0
 *   Bringing up eth0
 *     dhcp
 *       Running dhcpcd ...
eth0: dhcpcd 4.0.13 starting
eth0: broadcasting for a lease
eth0: offered 192.168.1.47 from 192.168.1.1
eth0: ignoring offer of 192.168.0.106 from 192.168.0.1
eth0: acknowledged 192.168.1.47 from 192.168.1.1
eth0: checking 192.168.1.47 is available on attached networks
eth0: ignoring offer of 192.168.77.2 from 192.168.77.1
eth0: leased 192.168.1.47 for 86400 seconds                             [ ok ]
 *       eth0 received address 192.168.1.47/24
, i.e. it ignores offers from the bad guys, but i am quite certain
that i haven't written anything about "192.168.1.1" or "192.168.77.1"
into any configuration...

I then wrote a script for switching to wireless:
Code:
enki bin # cat doWireless
/etc/init.d/net.eth0 stop 

/etc/init.d/net.wlan0 start
dhcpcd -x wlan0
dhcpcd -X 192.168.77.1 -X 192.168.0.1 wlan0

/etc/init.d/apache2 start
/etc/init.d/postgresql restart
, but when i run this, eth0 gets started, when apache2 is about to be started!
Code:
enki bin # doWireless
 * Stopping apache2 ...
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName                                        [ ok ]
 * Unmounting network filesystems ...                                   [ ok ]
 * Stopping eth0
 *   Bringing down eth0
 *     Stopping dhcpcd on eth0 ...                                      [ ok ]
 *     Shutting down eth0 ...                                           [ ok ]
 * WARNING:  net.wlan0 has already been started.
wlan0: sending signal 15 to pid 24356
wlan0: waiting for pid 24356 to exit
wlan0: dhcpcd 4.0.13 starting
wlan0: broadcasting for a lease
wlan0: ignoring blacklisted server 192.168.0.1
wlan0: ignoring blacklisted server 192.168.77.1
wlan0: offered 192.168.1.61 from 192.168.1.1
wlan0: acknowledged 192.168.1.61 from 192.168.1.1
wlan0: checking 192.168.1.61 is available on attached networks
wlan0: leased 192.168.1.61 for 86400 seconds
 * Starting eth0
 *   Bringing up eth0
 *     dhcp
 *       Running dhcpcd ...
eth0: dhcpcd 4.0.13 starting
eth0: waiting for carrier
eth0: timed out                                                         [ !! ]
 
(timed out because i had unplugged the ethernet cable.)
So for some reason, apache2 starts eth0 and eth0 starts dhcpcd...
is there some configuration which defines these dependencies?
I would like to achieve:
- to start wlan0, such that it starts dhcpcd with blacklisting the bad servers, exactly as eth0 does
- to start apache2 after wlan0 has been started, without eth0 being started

Can anybody explain all this, and peraps tell me how i can acieve my two goals here?

Thank You
Jody
Back to top
View user's profile Send private message
Kulfaangaren!
Apprentice
Apprentice


Joined: 11 Jan 2003
Posts: 176
Location: Borås, Sweden

PostPosted: Wed Oct 14, 2009 10:30 pm    Post subject: Reply with quote

I have no explanation regarding why the blacklisting works automatically for eth0 but the correct way to send arguments to dhcpd would be to add a ...
Code:
dhcpcd_wlan0="-X 192.168.77.1 -X 192.168.0.1"
... to your /etc/config.d/net to blacklist the DHCP-servers you wanted to blacklist.

I have to point out ... read the available documentation! Gentoo is known in certain corners of the internet for it's excellent documentation :)

As the Gentoo network configuration (x86 | amd64) documentation states in several places, the file /etc/config.d/net.example contains lots of useful information regarding all aspects of network configuration.

Regarding your second question ...
Much information can be had by looking at the apache2 script in /etc/init.d/. The script does not have a direct dependance on eth0 but rather on net which is to say any network. My guess is that once you add the above mentioned config options to dhcpd on wlan0 and it starts automatically without help from other homebrew-scripts it will "Just Work"(TM)

// Fredrik
_________________
Please add [SOLVED] to the subject of your original post when you feel that your problem is resolved.
Join the 'adopt an unanswered post' initiative today
Back to top
View user's profile Send private message
Kulfaangaren!
Apprentice
Apprentice


Joined: 11 Jan 2003
Posts: 176
Location: Borås, Sweden

PostPosted: Wed Oct 14, 2009 10:55 pm    Post subject: Reply with quote

Regarding eth0:
You might have to edit /etc/config.d/rc ...
Code:
# Some people want a finer grain over hotplug/coldplug. RC_PLUG_SERVICES is a
# list of services that are matched in order, either allowing or not. By
# default we allow services through as RC_COLDPLUG/RC_HOTPLUG has to be yes
# anyway.
# Example - RC_PLUG_SERVICES="net.wlan !net.*"
# This allows net.wlan and any service not matching net.* to be plugged.

RC_PLUG_SERVICES="!net.eth0"
The pertinent part is off course the "..."!net.eth0"..." part.

This should prevent eth0 from being started automatically by a net dependency, but from what I understand it will not prevent you from adding it to the startup sequence with the normal ...
Code:
root@laptop ~/># rc-update add net.eth0 default

/etc/config.d/* is a good place to look when you want to find out how things/services are configured in your computer.

An other interesting segment of /etc/config.d/rc is ...
Code:
# RC_VERBOSE will make init scripts more verbose. Only networking scripts
# really use this at this time, and this is useful for trouble shooting
# any issues you may have.
# This is also used to re-enable init script output for init scripts
# started or stopped from the command line.

RC_VERBOSE="no"
It could help you debug further network problems if you switch it to "yes" and reboot.

// Fredrik
_________________
Please add [SOLVED] to the subject of your original post when you feel that your problem is resolved.
Join the 'adopt an unanswered post' initiative today
Back to top
View user's profile Send private message
jody
l33t
l33t


Joined: 16 Oct 2007
Posts: 682
Location: Switzerland

PostPosted: Thu Oct 15, 2009 8:32 pm    Post subject: Reply with quote

Hi Fredrik
Thank you for your reply
I added the line 'dhcpcd_wlan0="-X 192.168.77.1 -X 192.168.0.1"' to /etc/conf.d/net,
but nothing changed : wlan0 does not call dhcpcd, and apache2 starts eth0...

I also tried 'dhcpcd_eth0="-X 192.168.77.1 -X 192.168.0.1"' but to no effect.

I also added the 'RC_PLUG_SERVICES="!net.eth0"' in /etc/conf.d/rc and rebooted,
but eth0 still is started as soon as i start apache after wlan0...

Do you think there might be any USE-flags which somehow caused a problem?
I also have completely weird problems with my keyboard which remains in us-mode
even though i use hald to set it to swiss german... see here

jody
Back to top
View user's profile Send private message
Kulfaangaren!
Apprentice
Apprentice


Joined: 11 Jan 2003
Posts: 176
Location: Borås, Sweden

PostPosted: Sat Oct 17, 2009 10:58 pm    Post subject: Reply with quote

I'm traveling at the moment. Will try to post tomorrow or the day after at the latest.

Anyone else want to weigh in ? :)

// Fredrik
_________________
Please add [SOLVED] to the subject of your original post when you feel that your problem is resolved.
Join the 'adopt an unanswered post' initiative today
Back to top
View user's profile Send private message
Kulfaangaren!
Apprentice
Apprentice


Joined: 11 Jan 2003
Posts: 176
Location: Borås, Sweden

PostPosted: Mon Oct 19, 2009 10:16 am    Post subject: Reply with quote

Hi again.
I think it is time we saw some file contents and other information.
Please post the following enclosed in separate code-blocks:
  • rc-status -nc boot ; rc-status -nc default
  • ls -l /etc/init.d/net.*
  • lspci | grep -E 'Net|Eth'
  • cat /etc/conf.d/net
  • cat /etc/wpa_supplicant/wpa_supplicant.conf
DONT FORGET to X-out all psk-entries from your wpa_supplicant.conf file above.

As an example of how it would look if I posted ...
Code:
[root@lap25 | jobs: 0 | 12:09:10 Mon Oct 19]
[~] (8 files, 224K) > ls -l /etc/init.d/net.*
lrwxrwxrwx 1 root root     6 Jul  7 12:28 /etc/init.d/net.br0 -> net.lo
lrwxrwxrwx 1 root root     6 May 26 10:29 /etc/init.d/net.eth0 -> net.lo
lrwxrwxrwx 1 root root    18 Jul  9 11:36 /etc/init.d/net.kvmnet0 -> /etc/init.d/net.lo
lrwxrwxrwx 1 root root    18 Jul  9 11:36 /etc/init.d/net.kvmnet1 -> /etc/init.d/net.lo
-rwxr-xr-x 1 root root 30696 May 26 10:29 /etc/init.d/net.lo
lrwxrwxrwx 1 root root    18 Sep 15 13:04 /etc/init.d/net.ppp0 -> /etc/init.d/net.lo
lrwxrwxrwx 1 root root     6 Mar  6  2009 /etc/init.d/net.wlan0 -> net.lo

// Fredrik
_________________
Please add [SOLVED] to the subject of your original post when you feel that your problem is resolved.
Join the 'adopt an unanswered post' initiative today
Back to top
View user's profile Send private message
Kulfaangaren!
Apprentice
Apprentice


Joined: 11 Jan 2003
Posts: 176
Location: Borås, Sweden

PostPosted: Fri Oct 23, 2009 7:39 pm    Post subject: Reply with quote

I'm hoping the silence on your part means you have solved your problems.

Good luck

// Fredrik
_________________
Please add [SOLVED] to the subject of your original post when you feel that your problem is resolved.
Join the 'adopt an unanswered post' initiative today
Back to top
View user's profile Send private message
riquito
Tux's lil' helper
Tux's lil' helper


Joined: 17 Jul 2002
Posts: 93

PostPosted: Mon Jan 03, 2011 9:51 am    Post subject: Reply with quote

I know it's an old post, but it came first google searching when I had the same problem, so I'll post here an answer.

About apache that cannot start after wlan0 started because of eth0 being down, the solution is in configuring an rc value.

As stated by the gentoo wiki
http://www.gentoo-wiki.info/Wireless/Configuration#Net_services_like_Apache_don.27t_start_if_both_wlan0_and_eth0_aren.27t_started

Quote:
Net services like Apache don't start if both wlan0 and eth0 aren't started

If RC strict is set to "yes", then it will require that all net devices are started before any of the net services are started, you need to set this to "no".

For baselayout-1: Open /etc/conf.d/rc and change RF_NET_STRICT_CHECKING to "NO"

For baselayout-2: Open /etc/rc.conf and change rc_depend_strict to "NO"

_________________
Sideralis Programs
http://www.sideralis.org
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum