DHCP Failover configuration for VLANs

In this lab, we will simulate 2 different DHCP server on the same network for failover backup. Our primary DHCP server is 192.168.30.100 and secondary DHCP server is 192.168.100.100 . We have 4 VLANs;

VLAN 10 and VLAN 20 are used for end users. VLAN 30 and VLAN 100 are used for system and network management purposes. We will configure end user VLANs with 2 different DHCP server as primary and secondary. So just in case if any issue happens on first server, devices will be able to get IP addresses from secondary DHCP server.

Cisco does not natively support DHCP failover like Windows DHCP (with lease replication), but we can simulate DHCP backup using:

  1. DHCP helper addresses (on Layer 3 interface).
  2. Primary & secondary IP helper-addresses pointing to both servers.
  3. To set a DHCP server for each VLAN we will use this syntax on CLI “ip helper-address 192.168.x.x

CORE SWITCH CONFIGURATION

Switch>enable

Switch#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#hostname CORESW

CORESW(config)#vlan 10

CORESW(config-vlan)#vlan 20

CORESW(config-vlan)#vlan 30

CORESW(config-vlan)#exit

CORESW(config)#vlan 100

CORESW(config-vlan)#exit

CORESW(config)#interface vlan 10

CORESW(config-if)#

%LINK-5-CHANGED: Interface Vlan10, changed state to up

CORESW(config-if)#ip address 192.168.10.1 255.255.255.0

CORESW(config-if)#ip helper-address 192.168.30.100

CORESW(config-if)#ip helper-address 192.168.100.100

CORESW(config-if)#no shutdown

CORESW(config-if)#exit

CORESW(config)#interface vlan 20

CORESW(config-if)#

%LINK-5-CHANGED: Interface Vlan20, changed state to up

CORESW(config-if)#ip address 192.168.20.1 255.255.255.0

CORESW(config-if)#ip helper-address 192.168.30.100

CORESW(config-if)#ip helper-address 192.168.100.100

CORESW(config-if)#no shutdown

CORESW(config-if)#exit

CORESW(config)#interface vlan 30

CORESW(config-if)#

%LINK-5-CHANGED: Interface Vlan30, changed state to up

CORESW(config-if)#ip address 192.168.30.1 255.255.255.0

CORESW(config-if)#no shutdown

CORESW(config-if)#exit

CORESW(config)#interface vlan 100

CORESW(config-if)#

%LINK-5-CHANGED: Interface Vlan100, changed state to up

CORESW(config-if)#ip address 192.168.100.1 255.255.255.0

CORESW(config-if)#no shutdown

CORESW(config-if)#exit

CORESW(config)#ip routing

CORESW(config)#interface range g1/0/1-2

CORESW(config-if-range)#switchport mode trunk

CORESW(config-if-range)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan100, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/2, changed state to up

CORESW(config-if-range)#switchport trunk allow vlan all

CORESW(config-if-range)#no shutdown

CORESW(config-if-range)#exit

CORESW(config)#interface g1/0/3

CORESW(config-if)#switchport mode access

CORESW(config-if)#switchport access vlan 30

CORESW(config-if)#no shutdown

CORESW(config-if)#description

CORESW(config-if)#description DHCP_SERVER_1

CORESW(config-if)#exit

CORESW(config)#interface g1/0/4

CORESW(config-if)#switchport mode access

CORESW(config-if)#switchport access vlan 100

CORESW(config-if)#description DHCP_SERVER_2

CORESW(config-if)#no shutdown

CORESW(config-if)#exit

CORESW(config)#do copy run start

Destination filename [startup-config]?

Building configuration…

[OK]

ACCESS SWITCH 1 CONFIGURATION

Switch>enable

Switch#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#hostname ACCESS1

ACCESS1(config)#vlan 10

ACCESS1(config-vlan)#vlan 20

ACCESS1(config-vlan)#exit

ACCESS1(config)#interface g1/0/2

ACCESS1(config-if)#switchport mode access

ACCESS1(config-if)#switchport access vlan 10

ACCESS1(config-if)#no shutdown

ACCESS1(config-if)#exit

ACCESS1(config)#interface g1/0/3

ACCESS1(config-if)#switchport mode access

ACCESS1(config-if)#switchport access vlan 20

ACCESS1(config-if)#no shutdown

ACCESS1(config-if)#exit

ACCESS1(config)#interface g1/0/1

ACCESS1(config-if)#switchport mode trunk

ACCESS1(config-if)#switchport trunk allow vlan all

ACCESS1(config-if)#no shutdown

ACCESS1(config-if)#exit

ACCESS1(config)#do copy run start

Destination filename [startup-config]?

Building configuration…

[OK]

ACCESS SWITCH 2 CONFIGURATION

Switch>enable

Switch#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#hostname ACCESS2

ACCESS2(config)#interface g1/0/1

ACCESS2(config-if)#switchport mode trunk

ACCESS2(config-if)#switchport trunk allow vlan all

ACCESS2(config-if)#no shutdown

ACCESS2(config-if)#exit

ACCESS2(config)#vlan 10

ACCESS2(config-vlan)#exit

ACCESS2(config)#vlan 20

ACCESS2(config-vlan)#exit

ACCESS2(config)#interface g1/0/2

ACCESS2(config-if)#switchport mode acc

ACCESS2(config-if)#switchport access vlan 10

ACCESS2(config-if)#no shutdown

ACCESS2(config-if)#exit

ACCESS2(config)#interface g1/0/3

ACCESS2(config-if)#switchport mode access

ACCESS2(config-if)#switchport access vlan 20

ACCESS2(config-if)#no shutdown

ACCESS2(config-if)#exit

ACCESS2(config)#do copy run start

Destination filename [startup-config]?

Building configuration…

[OK]

DHCP SERVER 1 192.168.30.100 (vlan 30)

DHCP SERVER 2 192.168.100.100 (vlan 100)

We set the same IP subnets on both servers as shown.

FAILOVER TEST

We will shutdown the first DHCP server to see if our config is working fine. After shutting down first DHCP server, go to one end user computer and from Desktop tab, click on DHCP option then it should receive an automatic IP address from assigned subnet.

If you have any further questions, dont hesitate to contact with me.

Happy networking đŸ™‚

You can download the Cisco Packet Tracer simulation from this link

Back To Top
error: Content is protected !!