?

Log in

No account? Create an account

Previous Entry | Next Entry

Debian tip

I was getting tired of having my machine not DHCP on the ethernet when I boot. I have eth0's auto up disabled because it's usually not connected to a network when it boots. But sometimes it is, and logging in on a shell and ifup'ing it was getting old. So I came up with a cheap trick.

(I'd use the daemons that detect link beat and bring the interface up and down based on it, but for much of what I do, that's unsuitable for various reasons as well, so I just want to assume that the interface should only act automatically if it's plugged into a network on boot.)

(in /etc/network/interfaces)
auto eth0
iface eth0 inet dhcp
        pre-up /sbin/mii-tool eth0|grep ok > /dev/null


This takes the output of mii-tool's report on eth0. Since grep returns an error code if the string is not found (mii-tool reports "eth0: no link" if not connected, and "eth0: negotiated 100baseTx-FD, link ok" (or similar) when it's connected), the interface going up will fail if mii-tool doesn't have an "ok" in the return. So if it's not connected on boot, it won't go up automatically, but if it is, it'll DHCP it on boot.

It's something quasi-obvious but neat.

And to all my friends back in MI, I just want to point out that I have only been wearing a coat during the evenings. :-P

Comments

( 6 comments — Leave a comment )
thegreatdoogie
Dec. 4th, 2004 06:23 pm (UTC)
And to all my friends back in MI, I just want to point out that I have only been wearing a coat during the evenings. :-P

sucks to be you...I haven't even been wearing one at night :-P

oh, and in case you didn't see it in my journal, Wine failed to even install Streets and Trips. I'm gonna try running WinMX under it later, as according to Wine's website, WinMX is fully supported...just to make sure I'm not doing something wrong.
noweb4u
Dec. 4th, 2004 06:25 pm (UTC)
Yea, I wouldn't count on a Microsoft product to work in Wine. They all but intentionally break them so they don't.
thegreatdoogie
Dec. 4th, 2004 07:16 pm (UTC)
WinMX works beautifully...unfortunetly neither of my laptop drives are any good. Oh well, maybe I can find a deal on eBay....
noweb4u
Dec. 4th, 2004 09:26 pm (UTC)
perhaps. The new stuff is coming down in price lately, so who knows, you might get lucky.
fflewddur
Dec. 4th, 2004 08:57 pm (UTC)
awesome idea, i'll make use of that on my notebook :)
noweb4u
Dec. 30th, 2004 05:34 am (UTC)
Testing my procmail
( 6 comments — Leave a comment )