CCNA 4 - Configure IP Routing Protocols
By Sheldon L |
Published at 2020-05-14 |
Updated at 2020-05-14 |
Configuration
Tips for Configuration
- Router CLI commands are similar to Switches, but a couple of topics do work differently, as follows:
- The configuration of IP addresses differs in some ways, with switches using a VLAN interface and routers using an IP address configured on each working interface.
- Many Cisco router models have an auxiliary (Aux) port, intended to be connected to an external modem and phone line to allow remote users to dial in to the router, and access the CLI, by making a phone call. Cisco switches do not have auxiliary ports.
- Router IOS defaults to disallow both Telnet and SSH into the router because of the typical router default setting of
transport input none
in vty configuration mode. Cisco Catalyst LAN switches typically default to allow both Telnet and SSH.
ip subnet-zero
line aux 0
password [password]
login
# Pipe
sh run | ?
sh run | begin interface
sh ip route | include 192.168.3.32
# Serial Interface Commands
int s0/0/0 # slot/subslot/port
clock rate ? # need if controller differs
clock rate 1000000
sh controllers s0/0/0
bandwidth ?
bandwidth 1000
# Bringing Up an Interface
int f0/1
ip address [address] [musk] # connected routes
ip address 172.16.10.2 255.255.255.0
ip address 172.16.20.2 255.255.255.0 secondary
do sh run
ip route # static routes
router rip # nothing
ip routing
router rip # something
ip address [address] [musk] encapsulation dot1q [vlan-id] native
channel-group
no switchport
Host# arp -a
Router# show ip route
Router# show ip arp
Router# show ip interface
Exercise
- Tree routers:
- Router Corp
- Serial 0/0: 172.16.10.1/30
- Serial 0/1: 172.16.10.5/30
- Fa0/0: 10.10.10.1/24
- Router SF
- S0/0/0: 172.16.10.2/30
- Fa0/0: 192.168.10.1/24
- Router LA
- S0/0/0: 172.16.10.6/30
- Fa0/0: 192.168.20.1/24
Router# erase startup-config
Router# reload
Router# show controllers int
Router(config)# hostname Corp
Corp(config)# enable secret GlobalNet
! Stops the router from trying to resolve hostnames
! which is an annoying feature unless you’ve configured a host table or DNS.
Corp(config)# no ip domain-lookup
! F0/0
Corp(config)# int f0/0
Corp(config-if)# desc Connection to LAN BackBone
Corp(config-if)# ip address 10.10.10.1 255.255.255.0
Corp(config-if)# no shut
! S0/0
Corp(config-if)# int s0/0
Corp(config-if)# desc WAN connection to SF
Corp(config-if)# ip address 172.16.10.1 255.255.255.252
Corp(config-if)# no shut
! S0/1
Corp(config-if)# int s0/1
Corp(config-if)# desc WAN connection to LA
Corp(config-if)# ip address 172.16.10.5 255.255.255.252
Corp(config-if)# no shut
! console
Corp(config-if)# line con 0
Corp(config-line)# password console
Corp(config-line)# logging
Corp(config-line)# logging sync
Corp(config-line)# exit
! vty
Corp(config)# line vty 0 ?
<1-181> Last Line number
<cr>
Corp(config)# line vty 0 181
Corp(config-line)# password telnet
Corp(config-line)# login
Corp(config-line)# exit
! banner
Corp(config)# banner motd # This is my Corp Router #
Corp(config)#^Z
! save
Corp# copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
! verification
Corp# sh ip route
[Unimportant...]
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, FastEthernet0/0
L 10.10.10.1/32 is directly connected, FastEthernet0/0
Corp#
! you won’t see the serial interfaces come up
! until the other side of the links are operational
Router# erase startup-config
Router# reload
Router# show controllers int
Router(config)# hostname SF
SF(config)# enable secret GlobalNet
SF(config)# no ip domain-lookup
SF(config)# int s0/0/0
SF(config-if)# desc WAN Connection to Corp
SF(config-if)# ip address 172.16.10.2 255.255.255.252
SF(config-if)# no shut
! Since the SF router has a DCE cable connection,
! I needed to add clock rate to this interface because DTE receives clock.
! Keep in mind that the new ISR routers will autodetect this
! and set the clock rate to 2000000.
SF(config-if)# clock rate 1000000
SF(config-if)# int f0/0
SF(config-if)# desc SF LAN
SF(config-if)# ip address 192.168.10.1 255.255.255.0
SF(config-if)# no shut
SF(config-if)# line con 0
SF(config-line)# password console
SF(config-line)# login
SF(config-line)# logging sync
SF(config-line)# exit
SF(config)# line vty 0 ?
<1-1180> Last Line number
<cr>
SF(config)# line vty 0 1180
SF(config-line)# password telnet
SF(config-line)# login
SF(config-line)# banner motd #This is the SF Branch router#
SF(config)# exit
SF# copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
! look at configuration of the interfaces
SF# sh run | begin int
SF# sh ip int brief
SF# sh ip route
C 192.168.10.0/24 is directly connected, FastEthernet0/0
L 192.168.10.1/32 is directly connected, FastEthernet0/0
172.16.0.0/30 is subnetted, 1 subnets
C 172.16.10.0 is directly connected, Serial0/0/0
L 172.16.10.2/32 is directly connected, Serial0/0/0
! Serial shown, we can now ping to the Corp router from SF
SF# ping 172.16.10.1
Corp> sh ip route
172.16.0.0/30 is subnetted, 1 subnets
C 172.16.10.0 is directly connected, Serial0/0
L 172.16.10.1/32 is directly connected, Serial0/0
10.0.0.0/24 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, FastEthernet0/0
L 10.10.10.1/32 is directly connected, FastEthernet0/0
! Serial shown
! see our clocking in FS
SF# sh controllers s0/0/0
Interface Serial0/0/0
Hardware is GT96K
DCE V.35, clock rate 1000000
! see our clocking in Corp
Corp> sh controllers s0/0
Interface Serial0/0
Hardware is PowerQUICC MPC860
DTE V.35 TX and RX clocks detected.
Router# show controllers int
Router(config)# hostname LA
LA(config)# enable secret GlobalNet
LA(config)# no ip domain-lookup
LA(config)# int s0/0/1
LA(config-if)# ip address 172.16.10.6 255.255.255.252
LA(config-if)# no shut
LA(config-if)# clock rate 1000000
LA(config-if)# description WAN To Corporate
LA(config-if)# int f0/0
LA(config-if)# ip address 192.168.20.1 255.255.255.0
LA(config-if)# no shut
LA(config-if)# description LA LAN
LA(config-if)# line con 0
LA(config-line)# password console
LA(config-line)# login
LA(config-line)# logging sync
LA(config-line)# exit
LA(config)# line vty 0 ?
<1-1180> Last Line number
<cr>
LA(config)# line vty 0 1180
LA(config-line)# password telnet
LA(config-line)# login
LA(config-line)# exit
LA(config)# banner motd #This is my LA Router#
LA(config)# exit
LA#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
LA# sh ip route
Corp# config t
Corp(config)# ip dhcp excluded-address 192.168.10.1
Corp(config)# ip dhcp excluded-address 192.168.20.1
Corp(config)# ip dhcp pool SF_LAN
Corp(dhcp-config)# network 192.168.10.0 255.255.255.0
Corp(dhcp-config)# default-router 192.168.10.1
Corp(dhcp-config)# dns-server 4.4.4.4
Corp(dhcp-config)# exit
Corp(config)# ip dhcp pool LA_LAN
Corp(dhcp-config)# network 192.168.20.0 255.255.255.0
Corp(dhcp-config)# default-router 192.168.20.1
Corp(dhcp-config)# dns-server 4.4.4.4
Corp(dhcp-config)# exit
Corp# copy run start
Destination filename [startup-config]?
Building configuration...
! Remote LA
LA# config t
LA(config)# int f0/0
LA(config-if)# ip helper-address 172.16.10.5
! Remote SF
SF# config t
SF(config)# int f0/0
SF(config-if)# ip helper-address 172.16.10.1
ip route [dest_network] [mask] [next-hop|exit_interface] [admin_distance] [permanent]
! Static Routing in Corp
Corp# config t
Corp(config)# ip route 192.168.10.0 255.255.255.0 172.16.10.2 150
Corp(config)# ip route 192.168.20.0 255.255.255.0 s0/1 150
Corp(config)# do show run | begin ip route
ip route 192.168.10.0 255.255.255.0 172.16.10.2 150
ip route 192.168.20.0 255.255.255.0 Serial0/1 150
Corp(config)# do show ip route
S 192.168.10.0/24 [150/0] via 172.16.10.2
172.16.0.0/30 is subnetted, 2 subnets
C 172.16.10.4 is directly connected, Serial0/1
L 172.16.10.5/32 is directly connected, Serial0/1
C 172.16.10.0 is directly connected, Serial0/0
L 172.16.10.1/32 is directly connected, Serial0/0
S 192.168.20.0/24 is directly connected, Serial0/1
10.0.0.0/24 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, FastEthernet0/0
L 10.10.10.1/32 is directly connected, FastEthernet0/0
! Instead of using a next-hop address, we can use an exit interface
! that will make the route show up as a directly connected network.
! The default AD of directly connected is 1, we set 150 here,
! for floating static route, AD should be high.
! If the routes don’t appear in the routing table,
! it’s because the router can’t communicate with the next-hop address.
! But you can still use the permanent parameter to keep the route.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Static Routing in SF
! We’ll never create a static route to any network we're directly connected to.
! We must use the next hop of 172.16.10.1 since that’s our only router connection.
SF(config)# ip route 10.10.10.0 255.255.255.0 172.16.10.1 150
SF(config)# ip route 172.16.10.4 255.255.255.252 172.16.10.1 150
SF(config)# ip route 192.168.20.0 255.255.255.0 172.16.10.1 150
SF(config)# do show run | begin ip route
ip route 10.10.10.0 255.255.255.0 172.16.10.1 150
ip route 172.16.10.4 255.255.255.252 172.16.10.1 150
ip route 192.168.20.0 255.255.255.0 172.16.10.1 150
SF(config)#do show ip route
C 192.168.10.0/24 is directly connected, FastEthernet0/0
L 192.168.10.1/32 is directly connected, FastEthernet0/0
172.16.0.0/30 is subnetted, 3 subnets
S 172.16.10.4 [150/0] via 172.16.10.1
C 172.16.10.0 is directly connected, Serial0/0/0
L 172.16.10.2/32 is directly connected, Serial0/0
S 192.168.20.0/24 [150/0] via 172.16.10.1
10.0.0.0/24 is subnetted, 1 subnets
S 10.10.10.0 [150/0] via 172.16.10.1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Static Routing in LA
LA# config t
LA(config)# ip route 10.10.10.0 255.255.255.0 172.16.10.5 150
LA(config)# ip route 172.16.10.0 255.255.255.252 172.16.10.5 150
LA(config)# ip route 192.168.10.0 255.255.255.0 172.16.10.5 150
LA(config)# do show run | begin ip route
ip route 10.10.10.0 255.255.255.0 172.16.10.5 150
ip route 172.16.10.0 255.255.255.252 172.16.10.5 150
ip route 192.168.10.0 255.255.255.0 172.16.10.5 150
LA(config)#do sho ip route
S 192.168.10.0/24 [150/0] via 172.16.10.5
172.16.0.0/30 is subnetted, 3 subnets
C 172.16.10.4 is directly connected, Serial0/0/1
L 172.16.10.6/32 is directly connected, Serial0/0/1
S 172.16.10.0 [150/0] via 172.16.10.5
C 192.168.20.0/24 is directly connected, FastEthernet0/0
L 192.168.20.1/32 is directly connected, FastEthernet0/0
10.0.0.0/24 is subnetted, 1 subnets
S 10.10.10.0 [150/0] via 172.16.10.5
- The SF and LA routers are stub routers, indicates that the networks in this design have only one way out, which means that instead of creating multiple static routes, we can just use a single default route.
ip route 0.0.0.0 0.0.0.0 [default_gateway]
LA# config t
LA(config)# no ip route 10.10.10.0 255.255.255.0 172.16.10.5 150
LA(config)# no ip route 172.16.10.0 255.255.255.252 172.16.10.5 150
LA(config)# no ip route 192.168.10.0 255.255.255.0 172.16.10.5 150
LA(config)# ip route 0.0.0.0 0.0.0.0 172.16.10.5
LA(config)# do sho ip route
[output cut]
ip route 10.10.10.0 255.255.255.0 172.16.10.5 150
ip route 172.16.10.0 255.255.255.252 172.16.10.5 150
ip route 192.168.10.0 255.255.255.0 172.16.10.5 150
route 0.0.0.0 0.0.0.0 172.16.10.5
! Same as SF
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Verification
Corp# ping 192.168.10.1
Corp# ping 192.168.20.1
! DHCP clients
SF_PC(config)#int e0
SF_PC(config-if)#ip address dhcp
SF_PC(config-if)#no shut
Interface Ethernet0 assigned DHCP address 192.168.10.8, mask 255.255.255.0
LA_PC(config)#int e0
LA_PC(config-if)#ip addr dhcp
LA_PC(config-if)#no shut
Interface Ethernet0 assigned DHCP address 192.168.20.4, mask 255.255.255.0
! Verify DHCP server
Corp# sh ip dhcp binding
Corp# sh ip dhcp pool SF_LAN
Corp# sh ip dhcp pool SA_LAN
Corp# sh ip dhcp conflict
-
Administrative Distances
Route Source |
Default AD |
Connected interface |
0 |
Static route |
1 |
External BGP |
20 |
Internal EIGRP |
90 |
IGRP |
100 |
OSPF |
110 |
IS-IS |
115 |
RIP |
120 |
External EIGRP |
170 |
Internal BGP |
200 |
DHCP Default Route |
254 |
Unknown |
255 (This route will never be used.) |
- There are three classes of routing protocols:
- Distance vector: the route with the least number of hops to the network will be chosen as the best one. E.g. RIP, sending the complete routing table out of all active interfaces every 30 seconds, it has a maximum allowable hop count of 15 by default. RIP version 1 uses only classful routing, must use the same subnet mask. RIP version 2 provides something called prefix routing and does send subnet mask information with its route updates. This is called classless routing.
- Link state: the routers each create three separate tables (the directly attached neighbors, the topology of the entire internetwork, and the routing table). Triggered updates containing only specific link-state information are sent. Periodic keepalives that are small and efficient, in the form of hello messages, are exchanged between directly connected neighbors to establish and maintain neighbor relationships. E.g. SPF
- Advanced distance vector: use aspects of both distance-vector and link-state protocols. E.g. EIGRP
- Two types of routing protocols are used in internetworks:
- Interior gateway protocols (IGPs): used to exchange routing information with routers in the same autonomous system (AS). An AS is either a single network or a collection of networks under a common administrative domain, which basically means that all routers sharing the same routing-table information are in the same AS.
- Exterior gateway protocols (EGPs): used to communicate between ASs. An example of an EGP is Border Gateway Protocol (BGP)
RIP
! RIP in Corp
Corp# sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 10.10.10.1 YES manual up up
Serial0/0 172.16.10.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Serial0/1 172.16.10.5 YES manual up up
Corp# config t
Corp(config)# router rip
! It’s up to the routing protocol to find the subnets
! and populate the routing tables
Corp(config-router)# network 10.0.0.0
Corp(config-router)# network 172.16.0.0
Corp(config-router)# version 2
! We typically don’t want our routing protocols summarizing for us
! because it’s better to do that manually.
! Both RIP and EIGRP (before 15.x code) auto-summarize by default.
Corp(config-router)# no auto-summary
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! RIP in SF
SF# sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.10.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Serial0/0/0 172.16.10.2 YES manual up up
Serial0/0/1 unassigned YES unset administratively down down
SF# config
SF(config)# router rip
SF(config-router)# network 192.168.10.0
SF(config-router)# network 172.16.0.0
SF(config-router)# version 2
SF(config-router)# no auto-summary
SF(config-router)# do show ip route
C 192.168.10.0/24 is directly connected, FastEthernet0/0
L 192.168.10.1/32 is directly connected, FastEthernet0/0
172.16.0.0/30 is subnetted, 3 subnets
R 172.16.10.4 [120/1] via 172.16.10.1, 00:00:08, Serial0/0/0
C 172.16.10.0 is directly connected, Serial0/0/0
L 172.16.10.2/32 is directly connected, Serial0/0
S 192.168.20.0/24 [150/0] via 172.16.10.1
10.0.0.0/24 is subnetted, 1 subnets
R 10.10.10.0 [120/1] via 172.16.10.1, 00:00:08, Serial0/0/0
! An R indicates that the networks were added dynamically
! using the RIP routing protocol.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! RIP in SF
LA# config t
LA(config)# no ip route 0.0.0.0 0.0.0.0
LA(config)# router rip
LA(config-router)# network 192.168.20.0
LA(config-router)# network 172.16.0.0
LA(config-router)# no auto
LA(config-router)# vers 2
LA(config-router)# do show ip route
R 192.168.10.0/24 [120/2] via 172.16.10.5, 00:00:10, Serial0/0/1
172.16.0.0/30 is subnetted, 3 subnets
C 172.16.10.4 is directly connected, Serial0/0/1
L 172.16.10.6/32 is directly connected, Serial0/0/1
R 172.16.10.0 [120/1] via 172.16.10.5, 00:00:10, Serial0/0/1
C 192.168.20.0/24 is directly connected, FastEthernet0/0
L 192.168.20.1/32 is directly connected, FastEthernet0/0
10.0.0.0/24 is subnetted, 1 subnets
R 10.10.10.0 [120/1] via 172.16.10.5, 00:00:10, Serial0/0/1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! AD and hop count
Router(config-router)# do show ip route
10.0.0.0/24 is subnetted, 12 subnets
C 10.1.11.0 is directly connected, FastEthernet0/1
L 10.1.11.1/32 is directly connected, FastEthernet0/1
C 10.1.10.0 is directly connected, FastEthernet0/0
L 10.1.10.1/32 is directly connected, FastEthernet/0/0
R 10.1.9.0 [120/2] via 10.1.5.1, 00:00:15, Serial0/0/1
R 10.1.8.0 [120/2] via 10.1.5.1, 00:00:15, Serial0/0/1
R 10.1.12.0 [120/1] via 10.1.11.2, 00:00:00, FastEthernet0/1
R 10.1.3.0 [120/15] via 10.1.5.1, 00:00:15, Serial0/0/1
[Unimportant...]
! Notice: R 10.1.3.0 [120/15] via 10.1.5.1, 00:00:15, Serial0/0/1
! the administrative distance is 120 (default for RIP)
! but the hop count is 15 (max hop of RIP)
! means that that's bad route, and will be discard
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Stop unwanted RIP updates (30 sec by default)
! Configure a passive-interface on the Corp router’s Fa0/1
Corp# config t
Corp(config)# router rip
Corp(config-router)# passive-interface FastEthernet 0/1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Advertising a Default Route Using RIP, the same way with OSPF
! Imagine that our Corp router’s Fa0/0 interface is connected to
! some type of Metro-Ethernet as a connection to the Internet.
! All routers in our AS (SF and LA) must know where to send packets
! destined for networks on the Internet.
! Most people will place a default route on every router.
! But since I’m running RIPv2 on all routers,
! I’ll just add a default route on the Corp router to our ISP.
Corp(config)# ip route 0.0.0.0 0.0.0.0 fa0/0
Corp(config)# router rip
Corp(config-router)# default-information originate
! Verification
LA# sh ip route
Gateway of last resort is 172.16.10.5 to network 0.0.0.0
R 192.168.10.0/24 [120/2] via 172.16.10.5, 00:00:04, Serial0/0/1
172.16.0.0/30 is subnetted, 2 subnets
C 172.16.10.4 is directly connected, Serial0/0/1
L 172.16.10.5/32 is directly connected, Serial0/0/1
R 172.16.10.0 [120/1] via 172.16.10.5, 00:00:04, Serial0/0/1
C 192.168.20.0/24 is directly connected, FastEthernet0/0
L 192.168.20.1/32 is directly connected, FastEthernet0/0
10.0.0.0/24 is subnetted, 1 subnets
R 10.10.10.0 [120/1] via 172.16.10.5, 00:00:04, Serial0/0/1
R 192.168.218.0/24 [120/3] via 172.16.10.5, 00:00:04, Serial0/0/1
R 192.168.118.0/24 [120/2] via 172.16.10.5, 00:00:05, Serial0/0/1
R* 0.0.0.0/0 [120/1] via 172.16.10.5, 00:00:05, Serial0/0/1
! Notice: Gateway of last resort is 172.16.10.5 to network 0.0.0.0
! Notice: R* 0.0.0.0/0 [120/1] via 172.16.10.5, 00:00:05, Serial0/0/1
SF# sh ip route
OSPF
- Link: A link is a network or router interface assigned to any given network.
- Router ID: The router ID (RID) is an IP address used to identify the router. The highest IP address (of all loopback interfaces if configured).
- Neighbor: Neighbors are two or more routers that have an interface on a common network, such as two routers connected on a point-to-point serial link. OSPF neighbors must have a number of common configuration options to be able to successfully establish a neighbor relationship, and all of these options must be configured exactly the same way:
- Area ID
- Stub area flag
- Authentication password (if using one)
- Hello and Dead intervals
- Adjacency: An adjacency is a relationship between two OSPF routers that permits the direct exchange of route updates. OSPF is really picky about sharing routing information and will directly share routes only with neighbors that have also established adjacencies. In multi-access networks, routers form adjacencies with designated and backup designated routers. In point-to-point and point-to-multipoint networks, routers form adjacencies with the router on the opposite side of the connection.
- Designated router: A designated router (DR) is elected whenever OSPF routers are connected to the same broadcast network to minimize the number of adjacencies formed and to publicize received routing information to and from the remaining routers on the broadcast network or link.
- Backup designated router: A backup designated router (BDR) is a hot standby for the DR on broadcast, or multi-access, links. The BDR receives all routing updates from OSPF adjacent routers but does not disperse LSA (Link State Advertisement) updates.
- Hello protocol: The OSPF Hello protocol provides dynamic neighbor discovery and maintains neighbor relationships.
- Neighborship database: The neighborship database is a list of all OSPF routers for which Hello packets have been seen.
- Topological database: The topological database contains information from all of the Link State Advertisement packets that have been received for an area. LSA packets are used to update and maintain the topological database.
- Link State Advertisement: A Link State Advertisement (LSA) is an OSPF data packet containing link-state and routing information that’s shared among OSPF routers.
- OSPF areas: An OSPF area is a grouping of contiguous networks and routers. All routers in the same area share a common area ID. Because a router can be a member of more than one area at a time, the area ID is associated with specific interfaces on the router.
- Broadcast (multi-access) (224.0.0.6): Broadcast (multi-access) networks like Ethernet allow multiple devices to connect to or access the same network, enabling a broadcast ability so a single packet can be delivered to all nodes on the network. In OSPF, a DR and BDR must be
elected for each broadcast multi-access network.
- Nonbroadcast multi-access: Nonbroadcast multi-access (NBMA) networks like Frame Relay, X.25, and Asynchronous Transfer Mode (ATM) allow for multi-access without broadcast ability like Ethernet.
- Point-to-point (224.0.0.5): Point-to-point is a type of network topology made up of a direct connection between two routers that provides a single communication path. Can be physical or logical. Either way, point-to-point confi gurations eliminate the need for DRs or BDRs.
- Point-to-multipoint: Point-to-multipoint is a network topology made up of a series of connections between a single interface on one router and multiple destination routers. Point-to-multipoint networks can be further classified according to whether they support broadcasts or not. This is important because it defines the kind of OSPF configurations you can deploy.
!
Router(config)# router ospf [process-id]
! Optional:
! Setting router-id
Router(config-router)# router-id [id-value]
! OR Setting loopback the highest
Router(config)# interface loopback [number]
Router(config-router)# ip address [address] [mask]
! OR rely on the highest interface IP address
Router(config-router)# network [ip-address] [wildcard-mask] area [area-id]
!
! Migrating to OSPFv2:
! remove the network commands
Router(config)# router ospf [process-id]
Router(config-router)# no network [network-id] area [area-id]
Router(config-router)# exit
Router(config)# interface [type] [number]
Router(config-if)# ip ospf [process-id] area [area-id]
!
Router(config)# router ospf ?
<1-65535> Process ID
! A value in the range from 1 to 65,535 identifies the OSPF process ID,
! it can’t start at 0 because that’s for the backbone.
Router(config)# router ospf 1
Router(config-router)# network 10.0.0.0 0.255.255.255 area ?
<0-4294967295> OSPF area ID as a decimal value
A.B.C.D OSPF area ID in IP address format
Router(config-router)# network 10.0.0.0 0.255.255.255 area 0
- Example 1: You have a router with these four subnets connected to four different interfaces, all interfaces need to be in area 0:
- 192.168.10.64/28
- 192.168.10.80/28
- 192.168.10.96/28
- 192.168.10.8/30
Test# config t
Test(config)# router ospf 1
Test(config-router)# network 192.168.10.64 0.0.0.15 area 0
Test(config-router)# network 192.168.10.80 0.0.0.15 area 0
Test(config-router)# network 192.168.10.96 0.0.0.15 area 0
Test(config-router)# network 192.168.10.8 0.0.0.3 area 0
(X) R1 (X) R2 (X) R3
G0/0 (10.255.255.81/30) -- G0/1 (10.255.255.82/30)
G0/0 (10.255.255.9/30) -- G0/1 (10.255.255.10/30)
F0/0 (192.168.10.65/29) F0/0 (192.168.10.49/29) F0/0 (192.168.10.17/29)
| | |
[_] PC [_] PC [_] PC
R1# config t
R1(config)# router ospf 1
R1(config-router)# network 192.168.10.64 0.0.0.7 area 0
R1(config-router)# network 10.255.255.80 0.0.0.3 area 0
R2# config t
R2(config)# router ospf 1
R2(config-router)# network 192.168.10.48 0.0.0.7 area 0
R2(config-router)# network 10.255.255.80 0.0.0.3 area 0
R2(config-router)# network 10.255.255.8 0.0.0.3 area 0
R3# config t
R3(config)# router ospf 1
R3(config-router)# network 192.168.10.16 0.0.0.7 area 0
R3(config-router)# network 10.255.255.8 0.0.0.3 area 0
(X) Corp (X) Boulder
F0/0 (10.10.10.1/24) ------ F0/0 (10.10.10.2/24)
S0/0/0 (172.16.10.1/30)---
S0/0/1 (172.16.10.5/30) |
| |
(X) LA | | (X) SF
S0/0/1 (172.16.10.6/30) --- S0/0/0 (172.16.10.1/30)
F0/0 (192.168.20.1/24)--- F0/0 (192.168.10.1/24)
F0/1 (Non-OSPF network) | |
| |
[_] PC ------------------ [_] PC
!
Corp# sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 10.10.10.1 YES manual up up
Serial0/0 172.16.10.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Serial0/1 172.16.10.5 YES manual up up
Corp# config t
Corp(config)# no router rip
Corp(config)# router ospf 132
Corp(config-router)# network 10.10.10.1 0.0.0.0 area 0
Corp(config-router)# network 172.16.10.1 0.0.0.0 area 0
Corp(config-router)# network 172.16.10.5 0.0.0.0 area 0
! OR, easier
Corp(config-router)#network 172.16.10.0 0.0.0.255 area 0
!
SF# sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.10.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Serial0/0/0 172.16.10.2 YES manual up up
Serial0/0/1 unassigned YES unset administratively down down
SF# config t
SF(config)# no router rip
SF(config)# router ospf 300
SF(config-router)#network 192.168.10.1 0.0.0.0 area 0
SF(config-router)#network 172.16.10.2 0.0.0.0 area 0
!
LA# sh ip int brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.20.1 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Serial0/0/0 unassigned YES unset administratively down down
Serial0/0/1 172.16.10.6 YES manual up up
LA# config t
LA(config)# router ospf 100
LA(config-router)# network 192.168.20.0 0.0.0.255 area 0
LA(config-router)# network 172.16.0.0 0.0.255.255 area 0
LA(config)# router ospf 100
LA(config-router)# passive-interface fastEthernet 0/1
!
Corp# config t
Corp(config)# ip route 0.0.0.0 0.0.0.0 Fa0/0
Corp(config)# router ospf 1
Corp(config-router)# default-information originate
!
SF#show ip route
!
Boulder(config)# int f0/0
Boulder(config-if)# ip address 10.10.10.2 255.255.255.0
Boulder(config-if)# no shut
Boulder(config-if)#router ospf 2
Boulder(config-router)#network 10.0.0.0 0.255.255.255 area 0
- Configuring Loopback Interfaces
- Loopback interfaces are logical interfaces, which means they’re virtual, software-only interfaces. A big reason we use loopback interfaces with OSPF configurations is because they ensure an interface is always active and available for OSPF processes.
- The highest IP address of any logical interface will always become a router’s RID:
- Highest active interface by default.
- Highest logical interface overrides a physical interface.
- The router-id overrides the interface and loopback interface.
!
Corp# sh ip ospf
Routing Process "ospf 1" with ID 172.16.10.5
!
Corp(config)# int loopback 0
Corp(config-if)# ip address 172.31.1.1 255.255.255.255
!
SF(config)# int loopback 0
SF(config-if)# ip address 172.31.1.2 255.255.255.255
!
LA(config)# int loopback 0
LA(config-if)# ip address 172.31.1.3 255.255.255.255
!
Corp# sh ip ospf
Routing Process "ospf 1" with ID 172.31.1.1
!
Corp(config)# router ospf 1
Corp(config-router)# router-id 223.255.255.254
Corp(config-router)# do clear ip ospf process
Corp(config-router)# do sh ip ospf
! A loopback interface will not override the router-id command,
! and we don’t have to reboot the router to make it take effect as the RID!
- Verifying OSPF Configuration
Corp# show ip route
O 192.168.10.0/24 [110/65] via 172.16.10.2, 1d17h, Serial0/0
172.131.0.0/32 is subnetted, 1 subnets
172.131.0.0/32 is subnetted, 1 subnets
C 172.131.1.1 is directly connected, Loopback0
172.16.0.0/30 is subnetted, 4 subnets
C 172.16.10.4 is directly connected, Serial0/1
L 172.16.10.5/32 is directly connected, Serial0/1
C 172.16.10.0 is directly connected, Serial0/0
L 172.16.10.1/32 is directly connected, Serial0/0
O 192.168.20.0/24 [110/65] via 172.16.10.6, 1d17h, Serial0/1
10.0.0.0/24 is subnetted, 2 subnets
C 10.10.10.0 is directly connected, FastEthernet0/0
L 10.10.10.1/32 is directly connected, FastEthernet0/0
! 110/65—that’s our administrative distance/metric.
Corp# sh ip ospf
Routing Process "ospf 1" with ID 223.255.255.254
[...]
Corp# sh ip ospf database
Corp# sh ip ospf int f0/0
Corp# sh ip ospf neighbor
Corp# sh ip protocols