Significance of Secondary IP address(es) on Cisco Router Interface

Significance of Secondary IP address(es) on Cisco Router Interface

It is possible to attach multiple IPv4 networks to the same interface by attaching a secondary IPv4 address to the same interface with the command ip address ip-address subnetmask secondary.

Real world scenario:

There might not be enough host addresses for a particular network segment. For example, suppose your subnetting allows up to 254 hosts per logical subnet, but on one physical subnet you must have 300 host addresses. Using secondary IP addresses on the routers or access servers allows you to have two logical subnets using one physical subnet.

Topology

In the above topology, R2 is configured as a DHCP server to provide IPv4 addresses for VLAN 10 and VLAN 20 PC’s.

The DHCP smart-relay command configures secondary addresses on an interface and forwards DHCP requests through each IP network. When there is no DHCPOFFER message from the DHCP server, the relay agent will count the number of times the client retries sending a request. After three retries, the relay agent will set the gateway address to the secondary address.

To demonstrate DHCP smart-relay, VLAN 10 and VLAN 20-Primary DHCP pools has only two addresses; out of which one is reserved to use as a default gateways on the router sub-interfaces – e0/0.10, e0/0.20 respectively.

Sub-interface for VLAN 20 (e0/0.20) is configured with secondary IPv4 address (192.168.100.1). When the IP addresses from VLAN20-Primary pool are exhausted, DHCP clients obtain the IP addresses from the third pool (VLAN-20-Secondary) configured for secondary IP address on R2.

R1 Configuration

Router>en

Router#config t

Router(config)#hostname R1

R1(config)#line console 0

R1(config-line)#logg synchronous

R1(config-line)#no exec-timeout

R1(config-line)#exit

R1(config)#interface e0/0

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#interface e0/0.10

R1(config-subif)#encapsulation dot1Q 10

R1(config-subif)#ip address 192.168.10.1 255.255.255.0

R1(config-subif)#ip helper-address 12.12.12.2

R1(config-subif)#exit

R1(config)#interface e0/0.20

R1(config-subif)#encapsulation dot1Q 20

R1(config-subif)#ip address 192.168.20.1 255.255.255.252

R1(config-subif)#ip helper-address 12.12.12.2

R1(config-subif)#exit

R1(config)#interface e0/0.20

R1(config-subif)#ip address 192.168.100.1 255.255.255.0 secondary

R1(config-subif)#exit

R1(config)#ip dhcp smart-relay

R1(config)#int s2/1

R1(config-if)#ip address 12.12.12.1 255.255.255.252

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#router eigrp 1

R1(config-router)#no auto-summary

R1(config-router)#network 0.0.0.0

R1(config-router)#end

R1#

R2 Configuration

Router>en

Router#config t

Router(config)#hostname R2

R2(config)#line console 0

R2(config-line)#logg synchronous

R2(config-line)#no exec-timeout

R2(config-line)#exit

R2(config)#

R2(config)#interface s2/1

R2(config-if)#ip address 12.12.12.2 255.255.255.252

R2(config-if)#no shut

R2(config-if)#interface e0/0

R2(config-if)#ip address 192.168.30.1 255.255.255.0

R2(config-if)#no shut

R2(config-if)#exit

R2(config)#ip dhcp excluded-address 192.168.10.1

R2(config)#ip dhcp excluded-address 192.168.20.1

R2(config)#ip dhcp excluded-address 192.168.100.1

R2(config)#

R2(config)#ip dhcp pool VLAN-10

R2(dhcp-config)#network 192.168.10.0 255.255.255.252

R2(dhcp-config)#default-router 192.168.10.1

R2(dhcp-config)#exit

R2(config)#ip dhcp pool VLAN-20-Primary

R2(dhcp-config)#network 192.168.20.0 255.255.255.252

R2(dhcp-config)#default-router 192.168.20.1

R2(dhcp-config)#exit

R2(config)#ip dhcp pool VLAN-20-Secondary

R2(dhcp-config)#network 192.168.100.0 255.255.255.0

R2(dhcp-config)#default-router 192.168.100.1

R2(dhcp-config)#exit

R2(config)#

R2(config)#interface e0/0

R2(config-if)#ip address 192.168.30.1 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#exit

R2(config)#

R2(config)#router eigrp 1

R2(config-router)#no auto-summary

R2(config-router)#network 0.0.0.0

R2(config-router)#end

R2#

SW1 Configuration

Switch>en

Switch#config t

Switch(config)#host SW1

SW1(config)#line console 0

SW1(config-line)#logg synchronous

SW1(config-line)#no exec-timeout

SW1(config-line)#end

SW1#confi t

SW1(config)#interface e0/0

SW1(config-if)#switchport trunk encapsulation dot1q

SW1(config-if)#switchport mode trunk

SW1(config-if)#exit

SW1(config)#interface e0/1

SW1(config-if)#switchport mode access

SW1(config-if)#switchport access vlan 10

SW1(config-if)#exit

SW1(config)#interface range e0/2 – 3, e1/0

SW1(config-if-range)#switchport mode access

SW1(config-if-range)#switchport access vlan 20

SW1(config-if-range)#exit

SW1(config)#

VPC5
VPC6
VPC7

Tags:
No Comments

Post A Comment

× WhatsApp us!