Joachim Breitner

Spontanious DHCP-Server

Published 2007-05-21 in sections English, Digital World.

Sometime someone connects his computer to mine using a network cable, to transfer some files or similar. In a perfect world, both computers would run something like zeroconf or avahi-autoip, and IP adresses were taken care of. But in the real world, this is not often the case. Then, this would be easiest:

$ ifconfig eth0 192.168.42.1
$ simpledhcpd eth0

Where simpledhcpd would, without any configuration, start listening for DHCP requests on eth0 and serve IPs from the just configured subnet. No configuration file, no leases, not even a deamon mode. Just Real Simple IPs for your ad-hoc-network. Does that already exists?

Comments

Nothing quite like that exists, as far as I know. Seems handy.



The closest thing I can think of: dnsmasq works fairly well with little-to-no configuration, and what little configuration you might want you can do with command-line options if you don't want a configuration file.



Oh, and in a *perfect* world, both sides would run IPv6 and would automatically have a unique link-local address on interfaces in addition to whatever other address that interface might have.
#1 Anonymous am 2007-05-21
You want "link-local" addresses. All implementations of IPv6 has them as already mentioned. But they exist for IPv4 as well (IPv4LL)... Windows has it (169.254.x.x), and I think Suse has implemented it as well... But this doesn't really help you unless you help everyone else to set it up at their end. If it's the same set of people, it might be better for you to do it once on all their computers and it'll "just work" the next time they visit.

Check out the zeroconf efforts, and what they have to offer.... The linux zeroconf implementation, avahi (avahi-autoipd), can probably help you.



HTH. HAND.
#2 fatal am 2007-05-21
Right, but as I said, sometimes the other person just doesn’t have it set up yet...
#3 Joachim Breitner (Homepage) am 2007-05-22
Check out *udhcpd*. It does what you want, alas it'll need a config file if you're not setting up shop on eth0 and serving 192.168.0.20 - 192.168.0.254.



I've used it successfully to put up adhoc networks on wlan. Like this:

http://kode.lurtgjort.no/index.php#121d9c38abe6b35a7efa69b23164da12
#4 Håvard Dahle am 2007-05-22
Very nice. I’ll have a closer look at that. Maybe the developers can be conviced to add a “no-conf” mode or a command-line-conf-only mode with a nice wrapper
#5 Joachim Breitner (Homepage) am 2007-05-22
no configuration and can be runned in foreground mode:



http://pumipd.sourceforge.net/
#6 Benedikt am 2007-05-22
Thanks, but zeroconf is _not_ what I want, as explained before, becuase it need to be set up on both sides.
#7 Joachim Breitner (Homepage) am 2007-05-22
<strong>Trackback:</strong> <a href="http://www.joachim-breitner.de/blog/archives/243-Spontanious-DHCP-Server-Done..html">Spontanious DHCP-Server: Done.</a><br />

Sitting around at the GPN6 conference in Karlsruhe at the moment, I thought it’s time to write the instant DHCP server I blogged about. So I took the code from udhcpd and, instead of parsing an config file, figure out the settings myself. So I can run s
#8 nomeata’s mind shares (Homepage) am 2007-06-03

Have something to say? You can post a comment by sending an e-Mail to me at <mail@joachim-breitner.de>, and I will include it here.