You are not logged in.

#1 2011-01-30 18:24:58

badhat
Member
Registered: 2011-01-30
Posts: 112

[SOLVED] DHCP doesn't work!

Hi all,

After loading up Arch onto my brand new media server box I've found that DHCP isn't working at boot. I've had it working with Debian, Ubuntu, FreeBSD, and Windows 7.

I set the network daemon to run in background, but the problem existed before that. Once the box is rebooted I can try

dhcpcd eth0

and that returns that the daemon is already running.

If I do

ifconfig -a

it gives

eth0      Link encap:Ethernet  HWaddr BC:AE:C5:0A:77:D0
          inet addr:[removed]  Bcast:[removed]  Mask:255.255.255.0
          inet6 addr: fe80::beae:c5ff:fe0a:77d0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:255 errors:0 dropped:0 overruns:0 frame:0
          TX packets:91 errors:0 dropped:0 overruns:0 carrier:1
          collisions:0 txqueuelen:1000
          RX bytes:31517 (30.7 Kb)  TX bytes:15844 (15.4 Kb)
          Interrupt:40

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

As you can see there is only one eth0 device... I can check with

# dmesg | grep eth0
atl1c 0000:02:00.0: atl1c: eth0 NIC Link is Up<100 Mbps Full Duplex>
eth0: no IPv6 routers present

And my /etc/rc.conf

# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="badhat"

# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces.
#
# Interfaces to start at boot-up (in this order)
# Declare each interface then list in INTERFACES
#   - prefix an entry in INTERFACES with a ! to disable it
#   - no hyphens in your interface names - Bash doesn't like it
#
# DHCP:     Set your interface to "dhcp" (eth0="dhcp")
# Wireless: See network profiles below
#

#Static IP example
#eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
eth0="dhcp"
INTERFACES=(eth0)

# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
#   - prefix an entry in ROUTES with a ! to disable it
#
gateway="default gw 192.168.0.1"
ROUTES=(!gateway)

# Setting this to "yes" will skip network shutdown.
# This is required if your root device is on NFS.
NETWORK_PERSIST="no"

# Enable these network profiles at boot-up.  These are only useful
# if you happen to need multiple network configurations (ie, laptop users)
#   - set to 'menu' to present a menu during boot-up (dialog package required)
#   - prefix an entry with a ! to disable it
#
# Network profiles are found in /etc/network.d
#
# This now requires the netcfg package
#
#NETWORKS=(main)

So the output of ifconfig -a only works AFTER I do pkill dhcpcd and start the daemon again manually. After that, if I try to ping www.google.com it just shows no packets received and 100% packet loss.

Last edited by badhat (2011-02-02 17:10:42)

Offline

#2 2011-01-30 21:40:00

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [SOLVED] DHCP doesn't work!

So does the DAEMONS line of your /etc/rc.conf include network?

Last edited by Knute (2011-01-30 21:40:45)


Knute

Offline

#3 2011-01-30 23:53:10

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: [SOLVED] DHCP doesn't work!

I am confused - is dhcpcd/internet access working if you set it up manually with ifconfig/dhcpcd? The ifconfig output looks fine, also have a look at your resolv.conf

Offline

#4 2011-01-31 00:22:12

badhat
Member
Registered: 2011-01-30
Posts: 112

Re: [SOLVED] DHCP doesn't work!

Yes, DAEMONS does include network ... my code seems to have truncated in my first post... sorry.

@hokasch
dhcpcd is supposed to start at boot but when I get to the prompt and do ifconfig -a it doesn't give me an address and actually reports some errors (TX and RX errors I believe).  However, if I start dhcpcd eth0 then it does do all the rebinding steps and I then get an address-- STILL, though, if I ping Google I don't get any packets back, but I can still download with pacman.


EDIT: grammar

Last edited by badhat (2011-01-31 00:22:54)

Offline

#5 2011-01-31 02:13:07

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [SOLVED] DHCP doesn't work!

Are you using NFS at all?

If not, you may want to either comment out the NETWORK_PERSIST variable or set it yes.

I was going through what you posted with what's in my own, and I don't have the NETWORK_PERSIST option.

P.S.  after you change it, as root use the command: /etc/rc.d/network restart

Last edited by Knute (2011-01-31 02:15:30)


Knute

Offline

#6 2011-01-31 02:59:32

badhat
Member
Registered: 2011-01-30
Posts: 112

Re: [SOLVED] DHCP doesn't work!

Alright I tried commenting out the NETWORK_PERSIST options but still no dice.
I also tried something else-- I thought perhaps my school's network might somehow be the problem so I connected through my router instead and the problem still remains.

Perhaps someone could give me his known working /etc/rc.conf to try for myself. Very strange that this isn't working on a clean installation.

Offline

#7 2011-01-31 09:04:05

jOaNbE
Member
Registered: 2011-01-20
Posts: 20

Re: [SOLVED] DHCP doesn't work!

So after you get a new lease you are able to sync/install through pacman put are not able to browse the internet? What happens if you traceroute the pacman mirror used during installation?
Is there any reason for you to not have a static IP on your ethernet connection?

Offline

#8 2011-01-31 16:44:39

badhat
Member
Registered: 2011-01-30
Posts: 112

Re: [SOLVED] DHCP doesn't work!

I do not have a static IP address so I cannot use one.
And,yes, after I run dhcpcd manually I am leased and can then use pacman. I am not so worried about the ping issue as the main problem seems to be that the dhcp daemon just isn't starting at boot. Is there some particular order to load the daemons that I'm missing?  I'm working on a fairly vanilla install at the moment (no X or anything installed yet).

Offline

#9 2011-01-31 16:55:40

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: [SOLVED] DHCP doesn't work!

when I get to the prompt and do ifconfig -a it doesn't give me an address and actually reports some errors

So the ifconfig output in your first post is after a manual dhcpd, not after boot?

I am not so worried about the ping issue as the main problem seems to be that the dhcp daemon just isn't starting at boot.

I thought it was (daemon already runnning)? You can use "cat /var/log/daemon.log | grep dhcpcd" and find the entry for when dhcpcd is started on boot, maybe it throws some errors. Similary try "/etc/rc.d/network/restart"

Offline

#10 2011-01-31 22:00:56

badhat
Member
Registered: 2011-01-30
Posts: 112

Re: [SOLVED] DHCP doesn't work!

Yes, the ifconfig output in the first post is AFTER a manual dhcpcd. It doesn't work at boot.

If I check the logs in /var/log/daemon.log I can see that dhcpcd starts, rebinds the lease for eth0, then init begins entering runlevel: 3, then dhcpcd tries to broadcast for a lease on eth0, and finally it times out.

If I then do a network restart then dhcpcd gets the new lease and forks to the background. I'm still not able to ping google.com but I suspect that is an issue with my school's network and is likely unrelated to this issue with dhcpcd.

Is it possible that because dhcpcd is loading before init starts run level: 3 that it cannot lease? Or perhaps my card isn't loaded quickly enough?

Offline

#11 2011-01-31 22:35:39

jOaNbE
Member
Registered: 2011-01-20
Posts: 20

Re: [SOLVED] DHCP doesn't work!

badhat wrote:

I do not have a static IP address so I cannot use one.
And,yes, after I run dhcpcd manually I am leased and can then use pacman. I am not so worried about the ping issue as the main problem seems to be that the dhcp daemon just isn't starting at boot. Is there some particular order to load the daemons that I'm missing?  I'm working on a fairly vanilla install at the moment (no X or anything installed yet).

Well, since you said that you own a router (technically a gateway I assume) you can certainly have a static IP on your own C-class network (choose anything you want as long as you are on the same network address/broadcast address as your gateway ). Your gateway, however, will NOT have a static external IP (as it leases an IP from your ISP). My point, really, was just to ask if it is truly necessary for you to use dhcp or your wired internet connection. This is a matter of taste and is merly a potential bypass of your current problem.

You can try to preface your network daemon with an @ or move it within the array (not really recommenden as you migh screw with dependencies).

Offline

#12 2011-01-31 23:01:01

badhat
Member
Registered: 2011-01-30
Posts: 112

Re: [SOLVED] DHCP doesn't work!

jOaNbE, good advice though I'm not looking to circumvent the issue by assigning my device an IP through the router (not looking to use that router at all for many, many reasons).

Also, I have tried switching the dhcpcd to background with @ and I've moved it around to see what happens.

Going to see if I can get any information from the network admin at school and I'll post back...


EDIT:  In /etc/rc.conf do the settings for gateway and ROUTES matter or can they be left to defaults? I know that my DHCP server has a different IP than the 192.168.0.1 that is given by default. I've tried setting to the DHCP server that my school uses but it still doesn't work as the request for a new lease just times out according to /var/log/daemon.log

Last edited by badhat (2011-01-31 23:25:41)

Offline

#13 2011-02-01 09:32:51

jOaNbE
Member
Registered: 2011-01-20
Posts: 20

Re: [SOLVED] DHCP doesn't work!

How do set the dhcp server? Typically your nic sends a broadcast an UDP dhcp query (ie to all host on your local network). When the local dhcp server receives the query it initiates the different stages of providing an IP lease. The point is that you typically don't need to set any dhcp server. Also, the DCHP server normally supplies you with a default gateway and DNS. So when using dhcp you normally don't need to touch the default gateway settings in rc.conf.

Also, the problem is not with you schools dhcp server it has to do with how/when your computer initiates the dhcp query. An ugly hack you could try could be to comment out the dhcp settings in rc.conf and instead initiate a dhcp negotiation through rc.local instead (as this file is read later in the startup sequence).

Offline

#14 2011-02-01 13:56:56

badhat
Member
Registered: 2011-01-30
Posts: 112

Re: [SOLVED] DHCP doesn't work!

Ok so if I do set dhcp to start through /etc/rc.local and it works then we can assume that there is some issue in the sequence of events that is preventing my system from getting a new lease? Sorry, I'm a bit of a n00b still.

If I do set it through /etc/rc.local, doesn't that mean that /etc/rc.d/network will no longer function when I want to start/stop the network? If it does turn out that rc.local works, is there some parameter I can set in /etc/rc.conf to tell the daemon to not start for a number of seconds perhaps? (I'll try the /etc/rc.local thing right after my classes today)

Offline

#15 2011-02-01 14:32:15

jOaNbE
Member
Registered: 2011-01-20
Posts: 20

Re: [SOLVED] DHCP doesn't work!

I would suggest starting here: https://wiki.archlinux.org/index.php/Co … ng_Network especially the section "DHCP fails at boot" and also the link to the forum thread in that section. If nothing works then you can use the rc.local thing (even if it works it still ugly)

Always source the wiki first...

Offline

#16 2011-02-02 17:10:15

badhat
Member
Registered: 2011-01-30
Posts: 112

Re: [SOLVED] DHCP doesn't work!

Well, it seems the workaround is to include the commands to start dhcpcd in /etc/rc.local... even though that is not what I want to do.

I might go ahead and try to figure something else out (like using dhclient in place of dhcpcd). I'm going to mark this as solved because, while I have not fixed it myself, at least I can acknowledge that this is a known/documented issue.

Offline

Board footer

Powered by FluxBB