LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   "restarting" dhcpcd (https://www.linuxquestions.org/questions/linux-networking-3/restarting-dhcpcd-720604/)

wilson47 04-21-2009 03:57 AM

"restarting" dhcpcd
 
Hello everyone,

I run Slackware 12.2 (no GUI) on my dell inspiron 1420 laptop, and have managed to get
connected to the wlan at my school. However, once I kill the connection and try to reconnect,
dhcpcd just sits there broadcasting a signal and never goes anywhere. After a fresh start, I
can connect really quickly without any hesitation by dhcpcd. I have looked at the man page,
and I thought the cache was screwing things up, so I also tried running: sudo dhcpcd -k wlan0,
but that didn't help me. I don't really like rebooting my computer unless absolutely
necessary, so I was hoping you could point me in the right direction of what I need to do to
make dhcpcd work like after a fresh start.

Thanks very much for your help,
Glen M. Wilson

Libu 04-21-2009 04:20 AM

How do you connect ? Do you use the rc.d scripts or do you have some other application like netmanager ?

Drainuzzo 04-21-2009 06:19 AM

Can you try with
ifconfig wlan0 up
?

john test 04-21-2009 02:18 PM

on my system
Code:

s# /etc/init.d/networking restart

wilson47 04-21-2009 11:40 PM

Sorry, I forgot to say how I connect! This is what I have been doing:

sudo ifconfig wlan0 up
sudo iwconfig wlan0 essid "BLAH"
sudo dhcpcd wlan0

This works, but only on the first try. It has been the only way to connect from the command line that I figured out so far. I'll give john test's suggestion a try today and post back. Thanks for the help!!!
-Glen

paulsm4 04-22-2009 12:23 AM

Q: What happens if you try "/etc/init.d/networking restart" (or the Moral Equivalent for your version of Slackware) as previously suggested?

Q: What happens if you "kill -9" your first instance of dhcpcd, confirm that it's dead, and retry the three commands you stated?

wilson47 04-22-2009 02:27 AM

I guessed that my equivalent of "/etc/init.d/networking restart" is

/etc/rc.d/rc.inet1
or
/etc/rc.d/rc.inetd.

Upon restarting, they only seemed to do anything to eth0, and even with the following (as it suggests)

/etc/rc.d/rc.inet1 wlan0 start

I was unable to connect a second time. In case it wasn't clear, I hope to be able to reconnect after running

sudo ifconfig wlan0 down

and then bringing it back up again when I need it. Is that going to mess things up? Is this screwing up some cached files when I do this?

Upon trying just "kill -9" with the appropriate pid and all that, I also had to delete the dhcpcd pid file. After this, and bringing wlan0 down and back up again and all that jazz, I was still unable to connect. It just sits at DHCP_BROADCAST and then goes through a few more lines of stuff like DHCP_DISCOVER and then decides it didn't find anything. This is the error I get in syslog:

Apr 22 09:00:57 eisenbud dhcpcd[3155]: timed out waiting for a valid DHCP server response
Apr 22 09:00:57 eisenbud dhcpcd[3155]: timed out waiting for a valid DHCP server response

It isn't the end of the world if I have to restart my computer every day, but if it works after a restart, I should be able to give the same commands to get it in the same state after a fresh start. Are there tmp files that get created or something, and not deleted when I just kill dhcpcd and bring wlan0 down that do get deleted when I restart? That is what my guess is.

Thanks again for your help! I really appreciate it.
Glen Wilson

Libu 04-22-2009 03:30 AM

Using the rc.d scripts, the correct commands are
Quote:

/etc/rc.d/rc.inet1 wlan0_restart
/etc/rc.d/rc.inet1 wlan0_start
/etc/rc.d/rc.inet1 wlan0_stop
This will only work if you have properly configured rc.inet1.conf and rc.wireless.conf and if you are using wpa_supplicant (for wpa encryption), then /etc/wpa_supplicant.conf

I'm at work at the moment, so do not have samples to show you. But try googling, there are a lot of good slackware resources on how to properly configure these conf files. Just so you know its pretty simple.

Libu 04-22-2009 03:35 AM

I think this should answer all your queries ;):
http://alien.slackbook.org/dokuwiki/...ckware:network

wilson47 04-22-2009 09:59 AM

Hi Everyone,
I am sorry for dragging this out so long... But I added in the appropriate code to get the /etc/rc.d/rc.inet1 script to work (see code below) and it still won't restart. After inserting the code, it logs onto the network at boot time, printing the following:

#############
Polling for DHCP server on interface eth0:
Broadcasting DHCP_REQUEST for 81.210.235.17
timed out waiting for DHCP_ACK response
Broadcasting DHCP_DISCOVER
timed out waiting for a valid DHCP server response
/etc/rc.d/rc.M: wlan0 information: 'Any ESSID'
Error for wireless request "Set Nickname" (8B1C) :
SET failed on device wlan0 ; Operation not supported.
Polling for DHCP server on interface wlan0:
Broadcasting DHCP_DISCOVER
broadcastAddr option is missing in DHCP server response. Assuming 10.87.87.255
dhcpIPaddrLeaseTime=86400 in DHCP server response.
dhcpT1value is missing in DHCP server response. Assuming 43200 sec
dhcpT2value is missing in DHCP server response. Assuming 75600 sec
DHCP_OFFER received from ■ (10.87.87.254)
Broadcasting DHCP_REQUEST for 10.87.87.144
dhcpIPaddrLeaseTime=86400 in DHCP server response.
dhcpT1value is missing in DHCP server response. Assuming 43200 sec
dhcpT2value is missing in DHCP server response. Assuming 75600 sec
DHCP_ACK received from ■ (10.87.87.254)
Broadcasting ARPOP_REQUEST for 10.87.87.144
#########

then, once I am at the command line, I issue the restart command: sudo /etc/rc.d/rc.inet1 wlan0_restart, and get:

#########
/etc/rc.d/rc.inet1: wlan0 information: 'Any ESSID'
Error for wireless request "Set Nickname" (8B1C) :
SET failed on device wlan0 ; Operation not supported.
Polling for DHCP server on interface wlan0:
Broadcasting DHCP_DISCOVER
timed out waiting for a valid DHCP server response
#########

Also, upon trying it the way I mentioned above in all possible combinations that made sense, I was still unable to get things going. So, unless anybody else has any ideas, I'll take this as a cue to not use my laptop at school and study.

Thanks!
Glen

wilson47 04-22-2009 12:02 PM

sorry... here is my entry in /etc/rc.d/rc.inet1.conf

####
IFNAME[4]="wlan0"
IPADDR[4]=""
NETMASK[4]=""
USE_DHCP[4]="yes"
#DHCP_HOSTNAME[4]=""
WLAN_ESSID[4]=FREIFLUG

Libu 04-22-2009 02:32 PM

One thing, your rc.wireless script is being run, and it need not be. So remove the execute bits from rc.wireless, so that its not run.

is the ESSID correct (FREIFLUG) ?

You should be able to get more information from /var/log/messages
Just grep it for rc.inet1
Quote:

sudo grep rc.inet1 /var/log/messages

wilson47 04-23-2009 01:19 AM

Thanks for the help Libu! Maybe this will be interesting. After removing the execute bits from /etc/rc.d/rc.wireless, I couldn't connect with the rc.inet1 script. I'm going to compare the logs of when it works and when it doesnt to see what the difference is. Thanks for the help.
-Glen

Libu 04-23-2009 02:58 AM

You must also set the debug option in rc.inet1.conf to get more information in /var/log/messages

Quote:

DEBUG_ETH_UP="yes"

wilson47 04-23-2009 08:38 AM

Hi Libu,

Thanks for your help! I added that line in and was going through the debugging stuff, and the idea hit me to try using dhcpcd to get an IP address from another one of the schools wireless networks. I was able to get an IP address for this other network, although, since it is a VPN I couldn't actually use it. However, whatever that did was good enough to let me get an IP address with dhcpcd with the network I can use (FREIFLUG). It isn't really a fix, but at least I can get internet without having to always restart my laptop! Thanks very much for your help.

Best regards,
Glen


All times are GMT -5. The time now is 11:48 PM.