Cisco Two or More IP Addresses

I wanted to take an opportunity to share an experience I had recently and explain how I resolved it.  The situation I walked into was quite ugly.  A small consulting firm had helped install some new switches at a medium sized business.  They basically did a rip and replace.  Before the replacement the network was configured with four VLANs; One VLAN for IP cameras, IP Phones, a few isolated APs, and of course corporate PC data.  The bad news was that the fly-by-night consulting firm had a tech on this job that knew nothing about VLANs.  Can you see the direction this is going?

The result was that most of the corporate PCs still had connectivity because they simply got addresses via DHCP.  The phones didn’t work because they DHCPed in the data VLAN and couldn’t contact the phone system that was IP addressed in a different subnet that there was no route to.  Cameras and wireless APs could also not contact their controllers for the same reasons.

Needless to say when I arrived many people were violently frustrated so a quick and dirty fix was in order to get things at least working and blood pressures down.  The solution was to stack every previous default gateway address on the single VLAN 1 attached interface.

Typically an interface is configured with a single IP address and that’s the end of the story.  However, there are always those cases when a second IP is configured to accommodate a network that ran out of address space and a host of other situations.  Typically, an address or two is normally the max seen.  In fact, for whatever reason, I never really thought to try assigning a third address as the “ip address <ip address> <subnet mask> secondary” command indicates “secondary” rather than “additional” addresses.

Like I said… ugly, but it worked.  After restoring connectivity I could then create the VLANs that needed to exist and could slowly start moving devices back into place with some simple “switchport access vlan <vlan id>” commands.  I migrated the subnets similarly to my suggestions in the Moving Subnets to Different VLANs article.

To give you an idea of what this looked like within IOS I included a few lines of output below.  This works with Switch Virtual Interfaces as well as physical router interfaces by the way.

SW1#show run interface vlan 1
interface Vlan1
 ip address 192.168.2.1 255.255.255.0 secondary
 ip address 192.168.3.1 255.255.255.0 secondary
 ip address 192.168.4.1 255.255.255.0 secondary
 ip address 192.168.1.1 255.255.255.0
SW1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
C    192.168.4.0/24 is directly connected, Vlan1
C    192.168.1.0/24 is directly connected, Vlan1
C    192.168.2.0/24 is directly connected, Vlan1
C    192.168.3.0/24 is directly connected, Vlan1

 

I hope someone finds this useful to resolve an issue or to at least better understand the capabilities of the Cisco IOS!

This entry was posted in Networking and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.