DHCP eth0 question

Sep 29, 2013 9 Replies

I have my pi set to use either wired or wifi with both interfaces on DHCP.



If I am using the wireless connection then every so often in syslog I see an attempt to get an eth0 address. It would seem the pi can't tell there is no cable plugged in.



Again on wifi it seems to take longer to boot. I suspect it is waiting for the DHCP request on eth0 to timeout before carrying on. On another OS I can tell DHCP to return at once rather than waiting for a timeout.



Anything I can tweak to help either situation?



TIA


Regards Dave Saville

I have a similar situation on my Debian laptop, so the fix I use for that should work on a Pi too.

I installed mii-tool, which can report details of the port status. Then I changed my /etc/network/interfaces to read something like:

iface eth0 inet dhcp pre-up ( mii-tool eth0 | grep -q "link ok" )

What this does is to check that eth0 has a link before trying to start the interface. If it doesn't then the pre-up command will return false and networking won't try and bring the interface up.

Hope that helps.

Thanks -that looks useful. Will try next time I am playing.

Regards Dave Saville

Seems mii-tool has been superseded, for some years, by ethtool - does the same job here. Thanks.

Regards Dave Saville

Afraid not - putting the pre-up line in results in no interface on the pi getting an IP with either cable or WIFI. I tried changing the order the interfaces were defined in but it made no difference.

Regards Dave Saville

ethtool does not output "link ok". Did you change the grep argument to something like "Link detected: yes" ?

Cheers.

Jim

I am not *that* dim Jim :-) But a valid point in that I had not posted the actual text used. I checked it out form the command line to see what I needed to grep for. Especially as I was using a different tool. But the Pi does not seem to like a pre-up - even though it is in the man page. :-)

Regards Dave Saville

Well, I'm glad you put the smiley at the end there.

Too bad.

I hope you find some solution.

Jim

ISTR having issues with bringing networks up at some point when things 'changed' from the old way to a new way.

Somewhere around kernel 3.0

this may help

formatting link

Ineptocracy (in-ep-toc?-ra-cy) ? a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.

More than I ever wanted to know :-) Thanks.

Regards Dave Saville

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required