Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I made a quick search and found a doc that showed me a way to setup ad-hoc. Only problem is that I need this to work with my phone (WP7) and I'm not able to set a static IP on the phone so I need the debian machine to dish out IPs when clients connect to it :-)

How can I set up a ad-hoc network that also gives out IPs? Pref in some range too :)

share|improve this question
up vote 3 down vote accepted

Without knowing which method you used, this writeup (a little dated, for Etch) suggests what all it takes is to have the DHCP server listen on the right interface. (Sounds about right, doesn't it?)

The Debian Wiki has an DHCP server entry, the Basic configuration mentioned there should be sufficient for your case.

share|improve this answer

I recommend Dnsmasq to create a small local network with a DNS cache, some local DNS bindings and a DHCP server. It's small and easy to set up.

The file /etc/dnsmasq.conf shipped with the program contains the full list of possible options, commented out by default. Under Debian, make sure to install the resolvconf which will take care of making your local machine query dnsmasq running on localhost for DNS lookups, and making dnsmasq forward queries to the DNS servers associated with the active network connection(s).

To enable the DHCP server, include one or more dhcp-range or dhcp-host directives. For example, to assign the address to the machine with the Ethernet address 22:33:44:55:66:77, and assign addresses of the form 10.23.44.x to other machines:


If your machine itself gets its address from DHCP, or more generally if it's connected to a network where some other machine hands out DHCP addresses, then it's vital that your machine does not reply to DHCP queries on its external interface.


To give names to your machines, declare them in /etc/hosts. Dnsmasq will serve those names to its DNS clients.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.