DHCP script for zcip package
Kevin Steen <[email protected]> Sat, 25 Jun 2005 22:12:54 +0100
| Newsgroups | gmane.network.zeroconf.workers |
|---|---|
| Message-ID | <[email protected]> |
Below is a script I've created to link the DHCP client and zcip together, so that if no DHCP server is available the machine still ends up with a usable IP address. I was trying to bring about the use case where two wireless laptop users get together and want to exchange files. I'm using the script on Ubuntu 5.04, so I've named it /etc/dhcp3/dhclient-exit-hooks.d/zeroconf I'm not sure it's the best way to do things, and it currently works badly if you have more than one interface, but it does work. (Comments and feedback most welcome!) Reading the drafts on auto-configuration I see that one suggestion is to have an auto-configured address along with a dhcp-supplied address, but I don't know enough about linux device configuration to create aliases yet! Has all this been done before and I just haven't found the right packages to install, or is standalone networking just something which linux users haven't had the need for yet? Personally I can't wait for the day my linux laptop can join an ad-hoc network and offer up websites, file-transfer and chat. -Kevin #!/bin/sh # Script to allocate ourselves an IP address if no DHCP server available # Written June 2005 by Kevin Steen ([email protected]) # # Requires zcip to be installed # # ToDo: # + Once zcip supports it, get zcip to write its pid to a file so we can # kill the correct instance. allocate_address() { if [ "$reason" == BOUND ]; then killall zcip ; elif [ "$reason" == FAIL ]; then killall zcip zcip -i $interface & fi } allocate_address # end of script ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click