Monday, March 1, 2010

Configure Multiple IP Address on a Cisco Router Interface

Original source from here

Cisco IOS supports multiple IP Addresses on an interface. There will be one Primary IP Address on the interaface and multiple Secondary IP Addresses on the interface. There is no limit on the number of IP Addresses that can be configure on an interface. Configurng multiple IP Addresses on your cisco routers can sometime help where you have multiple subnets having one physical router interface.

The IP Addresses can be from different subnets and from different networks.

To configure multiple IP Addresses,

Configure primary IP Address

From the Interface configuration mode, configure the primary IP Address

ciscorouter# conf term
ciscorouter(config)# int fa0/0
ciscorouter(config-if)# ip address 172.20.20.1 255.255.255.0
That configures the primary IP Address.

Configure Secondary IP Address

Now, add the required secondary IP Addresses onto the same interface

ciscorouter(config-if)# ip address 172.20.21.1 255.255.255.0 secondary
This adds the additional IP Address onto the interface. In the command above, the keyword "secondary" at the end defines the additional IP Address as a secondary IP Address.

How the Routing should be then?

Original source from here

=============

The easiest way to configure multiple routes on the same interface is to use the secondary IP command.

How do I add a static route into my Cisco router?
- Pretty simple
router# config t ; get into the configuration mode
router(config)# ip route A.B.C.D (destination network/host) A.B.C.D (mask) A.B.C.D (next hop); this is a simple static route

Example: -->>

Router 1
!
interface serial 0
ip address 192.0.0.1 255.255.255.0
ip address 192.0.0.2 255.255.255.0 secondary ! second route on same interface

interface serial 1
ip address 192.1.0.1 255.255.255.0
ip address 192.1.0.2 255.255.255.0 secondary

ip route 200.2.0.0 255.255.255.0 196.0.0.4; goes to serial 0
ip route 200.2.0.0 255.255.255.0 196.0.0.5; goes to serial 0
ip route 200.2.0.0 255.255.255.0 196.1.0.4; goes to serial 1