Home arrow BrainDump arrow Page 2 - Configuring a Linux Wireless Access Point

4.4 Setting Static IP Addresses from the DHCP Server - BrainDump

In this second part of a five-part series on building a Linux wireless access point, you'll learn how to set up name services, set static IP addresses, and more. This article is excerpted from chapter four of the Linux Networking Cookbook, written by Carla Schroder (O'Reilly; ISBN: 0596102488). Copyright © 2008 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.

  1. Configuring a Linux Wireless Access Point
  2. 4.4 Setting Static IP Addresses from the DHCP Server
  3. 4.5 Configuring Linux and Windows Static DHCP Clients
  4. 4.6 Adding Mail Servers to dnsmasq
By: O'Reilly Media
Rating: starstarstarstarstar / 1
February 03, 2010

print this article




You want to manage your LAN computers from DHCP instead of configuring them individually, so you donít have to run around tweaking individual computers all the time. You want to assign static and dynamic IP addresses, gateways, and servers all via DHCP.


dnsmasq does it all. There are a couple of ways to assign static IP addresses from dnsmasq.conf. One is to use the clientís MAC address as the client identifier, like this: 


My favorite way is to set it by hostname:


Make sure you do not have entries for these in /etc/hosts.

The only client configuration thatís necessary is the hostname, and for DHCP clients to send the hostname to the DHCP server when they request a new lease. Once you have that, you can control everything else from the server.

Remember to runkillall dnsmasq every time you change dnsmasq.conf.

There are some tricky bits to client configuration, so see Recipe 4.5 for this.


Changes in dnsmasq.conf are easy to test. After restarting dnsmasq, try the following commands on your Linux clients.

ifupdown stops and restarts interfaces:

  # ifdown eth0
  # ifup etho

Sometimes, that doesnít quite do the job, so you can also try:

  # /etc/init.d/network restart
  # /etc/init.d/networking restart

The first one is for Fedora, the second for Debian. Youíll see it acquire the address you assigned it from the DHCP server, and it will write the correct DNS server or servers to /etc/resolv.conf.

If those donít work, reboot.

Find MAC addresses with ifconfig for wired NICs, and iwconfig for wireless NICs. ifconfig sees both, but it doesnít differentiate them. iwconfig identifies only wireless interfaces.

When you use the MAC address, donít forget to change the entry in dnsmasq.conf if you replace the clientís network interface card.

MAC addresses are unique, but hostnames are not, so you have to be careful not to have duplicate hostnames. You canít have duplicate hostnames, anyway.

MAC addresses are ridiculously easy to spoof, so donít think youíre adding any security by relying on them as secure, unique identifiers.

See Also

  1. man 8 dnsmasq contains a wealth of helpful information about all the available command-line options, many of which are also dnsmasq.conf options
  2. dnsmasq.conf is also a great help resource
  3. dnsmasq home page (http://www.thekelleys.org.uk/dnsmasq/doc.html) is where youíll find mailing list archives and excellent help documents
  4. Chapter 24, ďManaging Name Resolution,Ē in Linux Cookbook, by Carla Schroder (OíReilly)

>>> More BrainDump Articles          >>> More By O'Reilly Media

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Apple Founder Steve Jobs Dies
- Steve Jobs` Era at Apple Ends
- Google's Chrome Developer Tool Updated
- Google's Chrome 6 Browser Brings Speed to th...
- New Open Source Update Fedora 13 is Released...
- Install Linux with Knoppix
- iPad Developers Flock To SDK 3.2
- Managing a Linux Wireless Access Point
- Maintaining a Linux Wireless Access Point
- Securing a Linux Wireless Access Point
- Configuring a Linux Wireless Access Point
- Building a Linux Wireless Access Point
- Migrating Oracle to PostgreSQL with Enterpri...
- Demystifying SELinux on Kernel 2.6
- Yahoo and Microsoft Create Ad Partnership

Developer Shed Affiliates


Dev Shed Tutorial Topics: