Configuring DHCP:
Router(config)#ip dhcp pool internal
Creates a DHCP pool called internal.
Router(dhcp-config)#network 172.16.10.0 255.255.255.0
Defines the range of addresses to be leased.
Router(dhcp-config)#defaultrouter 172.16.10.1
Defines the address of the default router for the client.
Router(dhcp-config)#dns-server 172.16.10.10
Defines the address of the Domain Name System (DNS) server for the client
Router(dhcp-config)#netbiosname-server 172.16.10.10
Defines the address of the NetBIOS server for the client.
Router(dhcp-config)#domain-name fakedomainname.ca
Defines the domain name for the client.
Router(dhcp-config)#lease 14 12 23
Defines the lease time to be 14 days,12 hours, 23 minutes.
Router(dhcp-config)#lease infinite
Sets the lease time to infinity; the default time is 1 day.
Router(dhcp-config)#exit
Returns to global configuration mode.
Router(config)#ip dhcp excluded address 172.16.10.1 172.16.10.9
Specifies the range of addresses not to be leased out to clients.
Router(config)#service dhcp
Enables the DHCP service and relay features on a Cisco IOS router.
Router(config)#no service dhcp
Turns the DHCP service off. DHCP service is on by default in Cisco IOS Software.
Verifying and Troubleshooting DHCP Configuration:
Router#show ip dhcp binding
Displays a list of all bindings created
Router#show ip dhcp binding w.x.y.z
Displays the bindings for a specific DHCP client with an IP address of w.x.y.z
Router#clear ip dhcp binding a.b.c.d
Clears an automatic address binding from the DHCP server database
Router#clear ip dhcp binding *
Clears all automatic DHCP bindings
Router#show ip dhcp conflict Displays a list of all address conflicts recorded by the DHCP server
Router#clear ip dhcp conflict a.b.c.d
Clears address conflict from the database
Router#clear ip dhcp conflict *
Clears conflicts for all addresses
Router#show ip dhcp database
Displays recent activity on the DHCP database
Router#show ip dhcp server statistics
Displays a list of the number of messages sent and received by the DHCP server
Router#clear ip dhcp server statistics
Resets all DHCP server counters to 0
Router#debug ip dhcp server {events | packets | linkage | class}
Displays the DHCP process of addresses being leased and returned
Configuring a DHCP Helper Address
Router(config)#interface fastethernet 0/0
Moves to interface configuration mode.
Router(config-if)#ip helperaddress 172.16.20.2
DHCP broadcasts will be forwarded as a unicast to this specific address rather than be dropped by the router.
NOTE: The ip helper-address command will forward broadcast packets as a unicast to eight different UDP ports by default:
• TFTP (port 69)
• DNS (port 53)
• Time service (port 37)
• NetBIOS name server (port 137)
• NetBIOS datagram server (port 138)
• Boot Protocol (BOOTP) client and server datagrams (ports 67 and 68)
• TACACS service (port 49)
If you want to close some of these ports, use the no ip forward-protocol udp x
command at the global configuration prompt, where x is the port number you want to close. The following command stops the forwarding of broadcasts to port 49:
Router(config)#no ip forward-protocol udp 49
If you want to open other UDP ports, use the ip forward-helper udp x command, where x is the port number you want to open:
Router(config)#ip forward-protocol udp 517
NAT
Step 1.
Corp(config)#ip nat pool ExAmPle 64.64.64.70 64.64.64.126 netmask 255.255.255.128
Defines the following: The name of the pool is scott. (The name of the pool can be anything.)
The start of the pool is 64.64.64.70. The end of the pool is 64.64.64.126.
The subnet mask is 255.255.255.128.
Step 2.
Corp(config)#access-list 1 permit 172.16.10.0 0.0.0.255
Configure an access control list (ACL) that will identify which private IP addresses will be translated.
Step 3.
Corp(config)#ip nat inside source list 1 pool ExAmPle
Link the ACL to the pool of addresses (create the translation).
Step 4.
Router(config)#interface fastethernet 0/0
Moves to interface configuration mode.
Router(config-if)#ip nat inside
You can have more than one inside interface on a router.
Addresses from each inside interface are then allowed to be translated into a public address.
Step 5.
Router(config)#interface serial 0/0/0
Router(config-if)#ip nat outside