You are on page 1of 15

DHCPV4 and

DHCPV6 Services
for
CCNA Students
By
Eng. Abeer Hosni

https://www.facebook.com/groups/1720572871550995/
Lab 1 (DHCP Service):

DHCP(config)#service dhcp (Enabled by default on router but disabled by default on L2


switch).

DHCP(config)#ip dhcp excluded-address 192.168.0.1 (Will be assigned to the DHCP server


itself).

DHCP(config)#ip dhcp excluded-address 192.168.0.230 192.168.0.254

DHCP(config)#ip dhcp pool LAN_1

DHCP(dhcp-config)#network 192.168.0.0 /24

DHCP(dhcp-config)#default-router 192.168.0.1

DHCP(dhcp-config)#dns-server 4.2.2.2 4.2.2.3 8.8.8.8 (Can assign up to 8 DNS servers).

DHCP(dhcp-config)#domain-name cita.net

DHCP(dhcp-config)#lease 2

DHCP(dhcp-config)#int f0/0

DHCP(config-if)#ip address 192.168.0.1 255.255.255.0

DHCP(config-if)#no shut

Now we will configure the host to take IP dynamically:


Using wireshark, you can see the DHCP process between the client and the server.
On the client if you want to renew the lease, you can use the command:

Notice that the renew process is just pass through the Request and Ack processes only.

If you wishes to release the lease between the client and the server use the cmd command:

Ipconfig /release
Lab 2 ( IP helper-address ):

DHCP(config)#ip dhcp excluded-address 192.168.0.1 192.168.0.10

DHCP(config)#ip dhcp excluded-address 10.0.0.1 10.0.0.10

DHCP(config)#ip dhcp pool LAN1

DHCP(dhcp-config)#network 192.168.0.0 /24

DHCP(dhcp-config)#default-router 192.168.0.1

DHCP(dhcp-config)#dns-server 4.2.2.2

DHCP(dhcp-config)#domain-name cita.net

DHCP(dhcp-config)#ip dhcp pool LAN2

DHCP(dhcp-config)#network 10.0.0.0 /24

DHCP(dhcp-config)#default-router 10.0.0.1

DHCP(dhcp-config)#dns-server 4.2.2.2

DHCP(dhcp-config)#domain-name cita.net

DHCP(dhcp-config)#int f0/0

DHCP(config-if)#ip add 10.0.0.2 255.255.255.0

DHCP(config-if)#no shut

Router(config)#int f0/0

Router(config-if)#ip add 10.0.0.1 255.255.255.0

Router(config-if)#no shut
Router(config-if)#int f0/1

Router(config-if)#ip add 192.168.0.1 255.255.255.0

Router(config-if)#no shut

Router(config-if)#ip helper-address 10.0.0.2

The DHCP server must have a route back to the 192.168.0.0 network:

Scenario 1) Configure a static route on the DHCP router server to reach the
192.168.0.0 network.
DHCP(config)#ip route 192.168.0.0 255.255.255.0 10.0.0.1
Scenario 2) Configure the DHCP router as a normal host.
DHCP(config)#no ip route 192.168.0.0 255.255.255.0 10.0.0.1

DHCP(config)#no ip routing

DHCP(config)#ip default-gateway 10.0.0.1


Scenario 3) if it is a Microsoft or Linux DHCP server, or any DHCP server
configured on a computer, make sure it has a default gateway pointing to
10.0.0.1.
To verify:

DHCP#show ip dhcp binding

Bindings from all pools not associated with VRF:

IP address Client-ID/ Lease expiration Type

Hardware address/

User name

192.168.0.11 0102.004c.4f4f.50 Mar 02 2002 12:43 AM Automatic

DHCP#show ip dhcp pool

Pool LAN1 :

Utilization mark (high/low) : 100 / 0

Subnet size (first/next) :0/0

Total addresses : 254

Leased addresses :1

Pending event : none

1 subnet is currently in the pool :

Current index IP address range Leased addresses

192.168.0.12 192.168.0.1 - 192.168.0.254 1

Pool LAN2 :

Utilization mark (high/low) : 100 / 0

Subnet size (first/next) :0/0

Total addresses : 254


Leased addresses :0

Pending event : none

1 subnet is currently in the pool :

Current index IP address range Leased addresses

10.0.0.1 10.0.0.1 - 10.0.0.254 0

Lab 3 (DHCPV6):

The dynamic assignment of IPv6 global unicast addresses can be configured in three ways:

1- Stateless Address Autoconfiguration (SLAAC) only:

DHCPV6#debug ipv6 nd

ICMP Neighbor Discovery events debugging is on

DHCPV6#config t

DHCPV6(config)#int f0/0

DHCPV6(config-if)#ipv6 address 2001::1/64

*Mar 1 00:06:33.959: ICMPv6-ND: Prefix Information change for 2001::/64, 0x0 -> 0xE0

*Mar 1 00:06:33.963: ICMPv6-ND: Adding prefix 2001::/64 to FastEthernet0/0

DHCPV6(config-if)#no shut
*Mar 1 00:06:41.603: ICMPv6-ND: Sending NS for FE80::C002:7FF:FECC:0 on FastEthernet0/0

*Mar 1 00:06:42.607: ICMPv6-ND: DAD: FE80::C002:7FF:FECC:0 is unique.

*Mar 1 00:06:42.607: ICMPv6-ND: Sending NA for FE80::C002:7FF:FECC:0 on FastEthernet0/0

*Mar 1 00:06:42.607: ICMPv6-ND: Linklocal FE80::C002:7FF:FECC:0 on FastEthernet0/0, Up

*Mar 1 00:06:42.611: ICMPv6-ND: Address FE80::C002:7FF:FECC:0/10 is up on FastEthernet0/0

*Mar 1 00:06:42.619: ICMPv6-ND: Sending NS for 2001::1 on FastEthernet0/0

*Mar 1 00:06:43.583: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up

*Mar 1 00:06:43.619: ICMPv6-ND: DAD: 2001::1 is unique.

*Mar 1 00:06:43.619: ICMPv6-ND: Sending NA for 2001::1 on FastEthernet0/0

*Mar 1 00:06:43.623: ICMPv6-ND: Address 2001::1/64 is up on FastEthernet0/0

*Mar 1 00:06:44.583: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0,


changed state to up

DHCPV6(config-if)#exit

DHCPV6(config)#ipv6 unicast-routing

*Mar 1 00:08:32.143: ICMPv6-ND: Request to send RA for FE80::C002:7FF:FECC:0

*Mar 1 00:08:32.143: ICMPv6-ND: Sending RA from FE80::C002:7FF:FECC:0 to FF02::1 on


FastEthernet0/0

*Mar 1 00:08:32.143: ICMPv6-ND: prefix = 2001::/64 onlink autoconfig

*Mar 1 00:08:32.451: ICMPv6-ND: Received NS for FE80::C002:7FF:FECC:0 on FastEthernet0/0


from FE80::E810:80E2:47A9:F35B

To verify on the PC:


To verify on the client router:

Client1(config)#int f0/0

Client1(config-if)#ipv6 address autoconfig

Client1(config-if)#no shut

Client1#show ipv6 int f0/0

FastEthernet0/0 is up, line protocol is up

IPv6 is enabled, link-local address is FE80::C003:7FF:FECC:0

No Virtual link-local address(es):

Global unicast address(es):

2001::C003:7FF:FECC:0, subnet is 2001::/64 [EUI/CAL/PRE]

valid lifetime 2591986 preferred lifetime 604786

Joined group address(es):

FF02::1
FF02::1:FFCC:0

MTU is 1500 bytes

ICMP error messages limited to one every 100 milliseconds

ICMP redirects are enabled

ICMP unreachables are sent

ND DAD is enabled, number of DAD attempts: 1

ND reachable time is 30000 milliseconds

Default router is FE80::C002:7FF:FECC:0 on FastEthernet0/0

2- Stateless Dynamic Host Configuration Protocol for IPv6 (DHCPv6):

DHCPV6(config)#ipv6 dhcp pool LAN

DHCPV6(config-dhcp)#domain-name cisco.com

DHCPV6(config-dhcp)#dns-server 2001::4:2:2:2

DHCPV6(config-dhcp)#int f0/0

DHCPV6(config-if)#ipv6 dhcp server LAN

DHCPV6(config-if)#ipv6 nd other-config-flag

To verify on the PC:


To verify on the client router:

Client1#show ipv6 int f0/0

FastEthernet0/0 is up, line protocol is up

IPv6 is enabled, link-local address is FE80::C003:7FF:FECC:0

No Virtual link-local address(es):

Global unicast address(es):

2001::C003:7FF:FECC:0, subnet is 2001::/64 [EUI/CAL/PRE]

valid lifetime 2591838 preferred lifetime 604638

Joined group address(es):

FF02::1

FF02::1:FFCC:0
MTU is 1500 bytes

ICMP error messages limited to one every 100 milliseconds

ICMP redirects are enabled

ICMP unreachables are sent

ND DAD is enabled, number of DAD attempts: 1

ND reachable time is 30000 milliseconds

Default router is FE80::C002:7FF:FECC:0 on FastEthernet0/0

Client1#show ipv6 dhcp int f0/0

FastEthernet0/0 is in client mode

State is IDLE (1)

Information refresh timer expires in 23:53:12

List of known servers:

Reachable via address: 2001::1

DUID: 00030001C20207CC0000

Preference: 0

Configuration parameters:

DNS server: 2001::4:2:2:2

Domain name: cisco.com

Information refresh time: 0

Rapid-Commit: disabled

But to be able to use the domain lookup, we have to enable it:

Client1(config)#ip domain-lookup
3- Stateful DHCPv6:

The IOS I’m using doesn’t support stateless DHCPv6, but here is the configuration any
way.
DHCPV6(config)#ipv6 dhcp pool LAN

DHCPV6(config-dhcpv6)#address prefix 2001::/64

DHCPV6(config)#int f0/0

DHCPV6(config-if)#ipv6 nd managed-config-flag

Best Wishes

Abeer 