DHCP Server

From ImageStream Router Documentation

Jump to: navigation, search

Contents

DHCP server Command Reference

Introduction

As of version 4.2.7, Imagestream routers support the Dynamic Host Configuration Protocol (DHCP). DHCP simplifies setup and maintenance of networks by pushing various network settings to clients automatically. Use of DHCP eliminates the need to configure each system manually, insuring proper configuration and simplifying troubleshooting of network problems. For more information, see the DHCP server HOWTO

Requirements

You must have a router with at least Imagestream Linux 4.2.7
Be sure to have a list of IP addresses for clients that do not use DHCP for IP address assignment. Thes IP addresses will need to be excluded from the pool to prevent duplicate IP address assignment.
These IP network addresses are given to you by your Internet Service Provider, your leased line carrier, or by ARIN. If you do not plan to connect you network to the Internet, you can use an IP network address set aside for private use. The IP network address for private use can be found in RFC 1597. Most people will use 192.168.0.0/24 as we have in this example.

Sample Configurations

Basic configuration

In this example, we are going to assume the following:
  • The router has an Ethernet IP address of 192.168.0.1 with a netmask of 255.255.255.0 .
  • The router will assign IP addresses from 192.168.0.20 through 192.168.0.254 (exclude addresses .1 through .19).
  • The IP address lease time will be 12 hours.
  • The clients will use 192.168.0.1 as the default gateway (default router).
  • The clients will use 192.168.0.10 and 192.168.0.11 as DNS servers.
  • The clients will use imagestream.com as their domain name.
  • The IP addresses used in this Technical Note are examples only. You will need to use an IP network given to you by your Internet Service Provider.
!
version 2.00
!
interface Ethernet0
 ip address 192.168.0.1 255.255.255.0
!
ip dhcp pool 0
 network 192.168.0.0 255.255.255.0
 ip dhcp excluded-address 192.168.0.1 192.168.0.19
 domain-name imagestream.com
 dns-server 192.168.0.10 192.168.0.11
 default-router 192.168.0.1
 lease 12 hours
! 
end

Advanced configuration

In this example, we are going to assume the following:
  • The router has an Ethernet IP address of 192.168.0.1 with a netmask of 255.255.255.0 .
  • The router will assign IP addresses from 192.168.0.20 through 192.168.0.254 (exclude addresses .1 through .19).
  • The IP address lease time will be 10 minutes.
  • The clients will use 192.168.0.1 as the default gateway (default router).
  • The clients will use 192.168.0.10 and 192.168.0.11 as DNS servers.
  • The clients will use imagestream.com as their domain name.
  • The clients will use 192.168.0.12 as their NetBIOS server.
  • A client with the MAC address 00:30:64:02:AF:CC will be assigned 192.168.0.35.
  • A client with the MAC address 00:30:61:12:00:09 will be assigned 192.168.0.36.
The IP addresses used in this Technical Note are examples only. You will need to use an IP network given to you by your Internet Service Provider.
!
version 2.00
!
interface Ethernet0
 ip address 192.168.0.1 255.255.255.0
!
ip dhcp pool 0
 network 192.168.0.0 255.255.255.0
 ip dhcp excluded-address 192.168.0.1 192.168.0.19
 domain-name imagestream.com
 dns-server 192.168.0.10 192.168.0.11
 default-router 192.168.0.1
 lease 10 minutes
 netbios-name-server 192.168.0.12
 netbios-node-type h-node
 host 192.168.0.35 hardware-address 00:30:64:02:AF:CC
 host 192.168.0.36 hardware-address 00:30:61:12:00:09
! 
end

Multiple DHCP pools on a single interface

In this example, we are going to assume the following:
  • The router has an Ethernet IP address of 192.168.0.1 with a netmask of 255.255.255.0 .
  • The router will assign IP addresses from 192.168.0.20 through 192.168.0.254 (exclude addresses .1 through .19).
  • The router has a secondary Ethernet IP address of 192.168.1.1 with a netmask of 255.255.255.0 .
  • The router will assign IP addresses from 192.168.1.20 through 192.168.1.254 (exclude addresses .1 through .19).
  • The IP address lease time will be 10 minutes.
  • The clients will use 192.168.0.1 or 192.168.1.1 as the default gateway (default router) depending on which IP address they're assigned.
  • The clients will use 192.168.0.10 and 192.168.0.11 as DNS servers.
  • The clients will use imagestream.com as their domain name.
The IP addresses used in this Technical Note are examples only. You will need to use an IP network given to you by your Internet Service Provider.
!
version 2.00
!
interface Ethernet0
 ip address 192.168.0.1 255.255.255.0
 ip address 192.168.1.1 255.255.255.0 secondary
!
ip dhcp pool 0 shared-network OnEthernet0
 network 192.168.0.0 255.255.255.0
 ip dhcp excluded-address 192.168.0.1 192.168.0.19
 domain-name imagestream.com
 dns-server 205.159.243.5 205.159.243.6
 default-router 192.168.0.1
 lease 10 minutes
! 
ip dhcp pool 1 shared-network OnEthernet0
 network 192.168.1.0 255.255.255.0
 ip dhcp excluded-address 192.168.1.1 192.168.1.19
 domain-name imagestream.com
 dns-server 205.159.243.5 205.159.243.6
 default-router 192.168.1.1
 lease 10 minutes
! 
end

Custom Options

ImageStream uses the ISC dhcpd server to handle DHCP requests. To pass unsupported DHCP server configuration options through to the ISC dhcpd server we created an options command. The options command will add an ISC configuration statement to the dhcpd server configuration. Note that the ISC syntax requires a semi-colon to separate commands so be sure to end the options command line with a semi-colon.
One example of using the options command is to set a time server. The ISC server has an option time-servers command to send DHCP option 4 (time servers) to the client. ImageStream does not map this option directly to a command so the generic options command must be used as follows:
options option time-servers us.pool.ntp.org;
In this example, we are going to assume the following:
  • The router has an Ethernet IP address of 192.168.0.1 with a netmask of 255.255.255.0 .
  • The router will assign IP addresses from 192.168.0.20 through 192.168.0.254 (exclude addresses .1 through .19).
  • The IP address lease time will be 10 minutes.
  • The clients will use 192.168.0.1 as the default gateway (default router).
  • The clients will use 192.168.0.10 and 192.168.0.11 as DNS servers.
  • The clients will use imagestream.com as their domain name.
  • The clients will use us.pool.ntp.org as the time server.
The IP addresses used in this Technical Note are examples only. You will need to use an IP network given to you by your Internet Service Provider.
!
version 2.00
!
interface Ethernet0
 ip address 192.168.0.1 255.255.255.0
!
ip dhcp pool 0
 network 192.168.0.0 255.255.255.0
 ip dhcp excluded-address 192.168.0.1 192.168.0.19
 domain-name imagestream.com
 dns-server 192.168.0.10 192.168.0.11
 options option time-servers us.pool.ntp.org;
 default-router 192.168.0.1
 lease 10 minutes
! 
end

Troubleshooting

Configuration errors will be displayed in the router's event log (syslog). Enable event logging to obtain troubleshooting information from the router. For more detailed information a "ip dhcp debug" command can be used to enable detailed transaction logging for each client. This information will be logged to the router's event log.

tcpdump

Advanced users can use the following command from the command prompt to view all DHCP traffic on all interfaces:

ImageStream:/usr/local/sand# tcpdump -n -s0 -v -e -i Ethernet0 port 67 or port 68

Command description:

tcpdump: Program used to capture and display packets 
 -n: Don't resolve IP addresses to DNS names 
 -s0: Capture the entire packet - provides more information when used with -v 
 -v: Verbose - provide as much information as possible 
 -e: Display the ethernet MAC addresses 
 -i Ethernet0: Capture on the Ethernet0 interface. 
 port 67 or port 68: Capture only packets on the DHCP ports 

Sample output:

tcpdump: listening on Ethernet0
  23:03:14.706036 0:90:fb:9:20:4f ff:ff:ff:ff:ff:ff 0800 590: 0.0.0.0.68 >
  255.255.255.255.67: [udp sum ok] xid:0xb01cc42b vend-rfc1048
  DHCP:DISCOVER CID:[ether]00:90:fb:09:20:4f VC:"udhcp 0.9.9-pre2"
  PR:SM+DG+NS+HN+DN+BR+YD+YS+NTP (ttl 64, id 0, len 576)

  23:03:15.000739 0:e:c:a9:f8:cb 0:90:fb:9:20:4f 0800 342: 192.168.0.1.67 >
  192.168.0.254.68: [udp sum ok] xid:0xb01cc42b Y:192.168.0.254 vend-rfc1048
  DHCP:OFFER SID:192.168.0.1 LT:43200 SM:255.255.255.0 DG:192.168.0.1
  NS:192.168.0.10,192.168.0.11 DN:"imagestream.com" [tos 0x10] (ttl 16, id 0,
  len 328)

  23:03:15.001078 0:90:fb:9:20:4f ff:ff:ff:ff:ff:ff 0800 590: 0.0.0.0.68 >
  255.255.255.255.67: [udp sum ok] xid:0xb01cc42b vend-rfc1048
  DHCP:REQUEST CID:[ether]00:90:fb:09:20:4f VC:"udhcp 0.9.9-pre2"
  RQ:192.168.0.254 SID:192.168.0.1 PR:SM+DG+NS+HN+DN+BR+YD+YS+NTP (ttl 64, id 0,
  len 576)

  23:03:15.001244 0:e:c:a9:f8:cb 0:90:fb:9:20:4f 0800 342: 192.168.0.1.67 >
  192.168.0.254.68: [udp sum ok] xid:0xb01cc42b Y:192.168.0.254 vend-rfc1048
  DHCP:ACK SID:192.168.0.1 LT:43200 SM:255.255.255.0 DG:192.168.0.1
  NS:192.168.0.10,192.168.0.11 DN:"imagestream.com" [tos 0x10] (ttl 16, id 0,
  len 328)

Configuration Option Reference

default-router IPv4_Address

Description

Set the default route, or gateway, associated with this pool of dhcp addresses. Generally this will be the IP address of the interface providing dhcp.

Parameters

IPv4_Address - Series of four numbers, 0 to 255, separated by periods. For more information see the Wikipedia

Examples

default-router 192.168.42.254 - Sets the DHCP server to hand out 192.168.42.254 as the gateway.

dns-server <IPv4_Address> [IPv4_Address]

Description

Set the DNS server(s) for the DHCP server to hand out in a given pool. A maximum of two servers are allowed.

Parameters

IPv4_Address - Series of four numbers, 0 to 255, separated by periods. For more information see the Wikipedia

Examples

dns-server 192.168.42.254 192.168.42.42 - Set the dhcp server to hand out 192.168.42.254 and 192.168.42.42 as dns servers.

domain-name domain

Description

Set the domain name for the DHCP server to hand out to a given pool.

Parameters

domain - DNS Domain name, usually something similar to COMPANY.COM

Examples

domain-name mydomain.com - Set the DHCP server to hand out mydomain.com

host IPv4_Address hardware-address MAC_Address

Description

Assotiates a MAC address with a specific IP address in a DHCP pool. As MAC addresses must be unique on a given LAN, it effectively assigns it to the device.

Parameters

IPv4_Address - Series of four numbers, 0 to 255, separated by periods. For more information see the Wikipedia
MAC_Address - Series of six hex numbers 0 - 255, separated by colons

Examples

host 192.168.42.1 hardware-address 00:08:02:0C:C8:EA - Assign the IP address 192.168.42.1 to the system identified by the MAC address 00:08:02:0C:C8:EA

Turns on debugging in a dhcp pool

ip dhcp debug

Description

Enables debug information for the dhcp service.

Parameters

None

Examples

ip dhcp debug - Turn on debug.

ip dhcp excluded-address IPv4_Address IPv4_Address

Description

Sets a range of addresses to be excluded from use in the address pool. You should exclude the IP address of the interface which is providing DHCP service at a minimum.

Parameters

IPv4_Address - Series of four numbers, 0 to 255, separated by periods. For more information see the Wikipedia
IPv4_Address - Series of four numbers, 0 to 255, separated by periods. For more information see the Wikipedia

Examples

ip dhcp excluded-address 192.168.42.250 192.168.42.254 - Set DHCP to not hand out addresses from 192.168.42.250 to 192.168.42.254

ip dhcp pool pool_ID [ shared-network <name> ]

Description

Required command to create the DHCP pool.

Parameters

pool_ID - Positive integer used to identify the group of addresses(or pool)
shared-network name - Required parameter when configuring multiple DHCP pools on a single interface. Each pool sharing an interface must have the same shared-network name parameter specified.

Examples

ip dhcp pool 1 - creates a dhcp pool and assigns it pool ID 1
ip dhcp pool 2 shared-network WirelessCustomers1 - creates a shared dhcp pool with ID 1 and shared network name WirelessCustomers1
ip dhcp pool 3 shared-network WirelessCustomers1 - creates a second dhcp pool on the shared network WirelessCustoemrs1

lease time {minutes|hours}

Description

Set the lease time, or duration for clients to keep their addresses in a specific pool before they request configuration again.

Parameters

time - Positive integer.
minutes - Specifies that time is measured in minutes.
hours - Specifies that time is measured in hours.

Examples

lease 50 minutes - The DHCP lease expires in 50 minutes
lease 5 hours - The DHCP lease expires in 5 hours

netbios-name-server IPv4_Address

Description

Set the netbios nameserver for DHCP to hand out to clients in the configured pool. This is used by Windows to resolve SMB hostnames.

Parameters

IPv4_Address - Series of four numbers, 0 to 255, separated by periods. For more information see the Wikipedia

Examples

netbios-name-server 192.168.42.254 - Assign the IP address 192.168.42.1 to the system identified by the MAC address 00:08:02:0C:C8:EA

Placeholder for Netbios-node-type h-node

network IPv4_Address IPv4_Netmask

Description

Sets the range of addresses to be used by the DHCP server in a given pool.

Parameters

IPv4_Network - Series of four numbers, 0 to 255, separated by periods. For more information see the Wikipedia
IPv4_Netmask - Series of four numbers 0 - 255, separated by periods. The netmask indicates which addresses are local, and which are not. for more information see the Wikipedia

Examples

network 192.168.42.0 255.255.255.0 - Tells the DHCP server to hand out any address between 192.168.42.1 and 192.168.42.254.
Personal tools
Router software releases