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

4.5 Configuring Linux and Windows Static DHCP Clients - 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.

TABLE OF CONTENTS:
  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
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Problem

What with having both Linux and Windows clients, and various Linux distributions that like to do things their own way, you’re a bit befuddled as to how to configure them to have dnsmasq give them static IP addresses.

Solution

The key to getting static IP addresses from DHCP is for the clients to send their host-names to the DHCP server when they request a lease.

Windows 2000, 2003, and XP clients do this automatically. All you do is configure them for DHCP in the usual manner.

First, on all Linux machines, make sure there is nothing in /etc/hosts other than the localdomain entry.

Most Linux distributions are not configured to send the hostname by default. To fix this, add one line to their DHCP client files. On Debian, this is the /etc/dhcp3/ dhclient.conf file. This example is for the computer named Penguina:

  send host-name "penguina";

You must also enter the hostname in /etc/hostname:

  penguina

Just the hostname and nothing else. Then, set up the normal DHCP configuration in /etc/network/interfaces, like this:

  ##/etc/network/interfaces
  auto lo
  iface lo inet loopback

  auto eth0
  iface eth0 inet dhcp

On Fedora, each interface gets its own DHCP client file, like /etc/dhclient-eth1. You may need to create this file. This takes the samesend host-name "penguina";entry. Then, add this line to /etc/sysconfig/network-scripts/ifcfg-eth0:

  DHCP_HOSTNAME=penguina

Make sure theHOSTNAMEline in /etc/sysconfig/network is empty.

The sure way to test your new configurations is to reboot, then run these commands:

  $ hostname
 
penguina
 
$ hostname -f
 
penguina.alrac.net
 
$ dnsdomainname
  alrac.net

Ping will look like this:

  carla@xena:~$ ping penguina
  PING penguina.alrac.net (192.168.1.75) 56(84) bytes of data.
  64 bytes from penguina.alrac.net (192.168.1.75): icmp_seq=1 ttl=128 time=8.90 ms
  carla@penguina:~$ ping penguina
 
PING penguina.alrac.net (192.168.1.75) 56(84) bytes of data.
  64 bytes from penguina.alrac.net (192.168.1.75): icmp_seq=1 ttl=64 time=0.033 ms

Discussion

The most common cause of problems with this is not configuring the hostname correctly. Check all of your pertinent configuration files.

Here is a complete example Fedora configuration for eth0:

  ##/etc/sysconfig/network-scripts/
ifcfg-eth0
  DEVICE=eth0
  ONBOOT=yes
  BOOTPROTO=dhcp
  HWADDR=11.22.33.44.55.66
  DHCP_HOSTNAME=penguina
  TYPE=wireless
  PEERDNS=yes
  MODE=managed
  RATE=auto

Either edit Fedora configuration files directly, or use the graphical network configurator, but don’t use both because the graphical tool overwrites your manual edits.

dnsmasq automatically enters DHCP clients into DNS. This is a great convenience, and when you deploy IPv6, it will be more than a convenience—it will be a necessity, unless you’re comfortable with remembering and typing those long IPv6 addresses.

dnsmasq combines a lot of complex functions into a short configuration file, and can be used in conjunction with BIND, djbdns, MaraDNS, and other nameservers. Use dnsmasq for your private LAN services, and one of the others for a public authoritative server. This makes it easy to keep the two completely separate, as they should be. Remember the number one DNS server rule: keep your authoritative and caching servers strictly separated, which means using two physically separate network interfaces and different IP addresses. Authoritative servers do not answer queries for other domains; that is the job of a caching resolver like dnsmasq. Maintaining two separate servers might sound like more work, but in practice, it’s easier and safer than trying to configure a single server to handle both jobs.

See Also

  • man 5 dhclient
  • dnsmasq.conf is a great help resource
  • dnsmasq home page (http://www.thekelleys.org.uk/dnsmasq/doc.html) is where you’ll find mailing list archives and excellent help documents
  • 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
   

BRAINDUMP ARTICLES

- 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: