Routers build a real routing table from connected networks, static routes, OSPF, EIGRP and BGP, by administrative distance and metric. Packets follow it hop by hop: ping and traceroute take the path the tables give.
Interfaces and router-on-a-stick
Router
Under interface Gi0/0
ip address 10.0.12.1 255.255.255.252
The interface's address; its network becomes a connected route.
no shutdown
Router interfaces start shut.
Under interface Gi0/1
no shutdown
The parent of the subinterfaces must be up.
Under interface Gi0/1.10
encapsulation dot1Q 10
The subinterface handles VLAN 10's tagged frames. It needs this before an address, as in IOS.
ip address 10.0.10.1 255.255.255.0
The gateway of VLAN 10.
Under interface Gi0/1.99
encapsulation dot1Q 99 native
The native VLAN: untagged frames.
Under interface Loopback0
ip address 10.255.0.1 255.255.255.255
A loopback: always up, often the router ID.
Under interface Gi0/2
bandwidth 10000
The bandwidth OSPF uses for the interface's cost, in kb/s.
Static and floating routes
Router
In global configuration
ip route 0.0.0.0 0.0.0.0 10.0.12.2
A default route through a next hop.
ip route 0.0.0.0 0.0.0.0 10.0.13.2 10
A floating default route: distance 10, used only when the first one is gone.
ip route 192.168.50.0 255.255.255.0 Gi0/2
A route out of an interface.
ip route 10.9.0.0 255.255.0.0 Null0
A discard route, for a summary.
ip route 0.0.0.0 0.0.0.0 10.0.12.2 track 1
A route that is in the table only while track object 1 is up, for failover with IP SLA (see IP services).
In privileged EXEC
show ip route
The routing table, with codes, distance/metric and next hops.
show ip route static
Only the static routes (connected, ospf, bgp or an address work too).
traceroute 8.8.8.8
Each hop on the way, from the routing tables. A hop with an ip host entry or a PTR record on the name servers prints by name.
Options: the source, the probes per hop, the first and last TTL, and numeric to skip the name lookups (port sets the UDP port, which ACLs see).
traceroute
The extended traceroute: it asks for the target, source, numeric display, probe count, minimum and maximum TTL and port. Enter keeps the default in brackets.
ping 10.0.12.2 source Loopback0
A ping from another of the router's addresses (repeat 20 sends more).
ping 10.0.12.2 size 1500 df-bit
A 1500-byte ping that may not be fragmented: an interface on the way with a smaller ip mtu answers M.
ping
The extended ping: it asks for the target, repeat count, size and, after "Extended commands [n]: y", the source and the DF bit. Enter keeps the default in brackets.
A route whose next hop isn't reachable doesn't enter the table, and a recursive route follows another route to its next hop, as in IOS.
Administrative distance
When several sources offer the same prefix, the lowest distance wins: connected 0, static 1, EIGRP summary 5, eBGP 20, EIGRP 90, OSPF 110, EIGRP external 170, iBGP 200. A static route with a distance above a protocol's is a floating static.
Router
In global configuration
ip route 10.30.30.0 255.255.255.0 10.0.13.2 250
A floating static: in the table only while no protocol knows the prefix.
A distance per OSPF route type (any of the three).
Under router eigrp 100
distance eigrp 90 175
EIGRP internal and external distances (named mode: under topology base).
Under router bgp 65000
distance bgp 20 200 200
eBGP, iBGP and local BGP distances.
In privileged EXEC
show ip route 10.30.30.0
Which source won the prefix, with its distance and metric.
IPv6
Router
In global configuration
ipv6 unicast-routing
Lets the router forward IPv6 and send router advertisements.
Under interface Gi0/0
ipv6 address 2001:db8:12::1/64
A global address.
Under interface Gi0/1
ipv6 address 2001:db8:10::/64 eui-64
A global address from the prefix and the MAC (EUI-64).
ipv6 address fe80::1 link-local
A fixed link-local address.
In global configuration
ipv6 route ::/0 2001:db8:12::2
An IPv6 default route.
In privileged EXEC
show ipv6 interface brief
Each interface's IPv6 addresses.
show ipv6 route
The IPv6 routing table.
Hosts on a link where a router advertises a prefix configure themselves with SLAAC.
OSPFv2
OSPF forms adjacencies over the links where both ends agree: area, subnet, hello and dead intervals (10/40 on broadcast and point-to-point, 30/120 on non-broadcast and point-to-multipoint), authentication, and the stub and NSSA flags. Then it elects a DR and BDR without pre-emption, floods link-state and runs SPF. A different IP MTU leaves the neighbours in EXSTART. Point-to-point against broadcast reaches FULL, but SPF cannot join the two descriptions of the link, so no route crosses it. Costs come from the reference bandwidth. Routes from another area show as O IA; an area that does not touch area 0 is cut off until a virtual link joins it.
Router
Under router ospf 1
router-id 1.1.1.1
The router ID (otherwise the highest loopback, then the highest interface address). A change takes effect after clear ip ospf process.
network 10.0.0.0 0.0.255.255 area 0
Runs OSPF on the interfaces in that range, in area 0.
passive-interface Gi0/1
Advertises the network but forms no adjacency there (passive-interface default makes every interface passive).
default-information originate
Advertises this router's default route (always: even without one).
auto-cost reference-bandwidth 10000
The bandwidth that costs 1, in Mb/s. Set it the same on every router.
area 1 range 10.1.0.0 255.255.0.0
On an ABR: one summary for area 1's networks.
area 2 stub
A stub area: no external routes, a default route instead (no-summary on the ABR: totally stubby).
area 3 nssa
A not-so-stubby area: no type 5 LSAs, but its own ASBR imports routes as type 7 (O N1/O N2), which the ABR translates into type 5 (O E1/O E2) for the rest. Both ends must agree.
area 3 nssa no-summary
On the ABR: a totally NSSA, with a default route (O*IA) instead of the inter-area routes.
area 3 nssa default-information-originate
On the ABR: sends a type 7 default route (O*N2) into the NSSA.
area 1 virtual-link 10.255.0.3
Joins an area that does not touch area 0 through transit area 1 (both ABRs, each naming the other's router ID; not through a stub area or an NSSA).
area 0 authentication message-digest
MD5 authentication on every interface of area 0 (without message-digest: a plain password).
neighbor 10.0.34.2
On a non-broadcast network: hellos go only to the neighbours listed (one side is enough).
distribute-list prefix NO-LAB in
Keeps the routes a prefix list denies out of this router's table.
Under interface Gi0/2
ip ospf 1 area 0
Runs OSPF on one interface, instead of a network statement.
ip ospf cost 50
The interface's cost.
ip ospf priority 0
Never DR or BDR on this segment (higher wins the election).
ip ospf network point-to-point
No DR election on this link.
ip ospf network non-broadcast
Hellos by unicast to the neighbor routers only; timers 30/120, with a DR (point-to-multipoint: no DR, /32 host routes).
ip ospf hello-interval 5
The hello interval; the dead interval becomes 4 times it. Both ends must match.
ip ospf dead-interval 20
The dead interval on its own.
ip ospf authentication message-digest
MD5 on this interface (ip ospf authentication alone: a plain password; null: none, whatever the area says).
ip ospf message-digest-key 1 md5 N3tP@th
The MD5 key: the youngest key is sent, and the neighbour must hold that key number with the same string.
ip ospf authentication-key Pl41n
The plain password for ip ospf authentication.
ip ospf authentication key-chain OSPF-SHA
HMAC-SHA authentication with a key chain (its key needs a cryptographic-algorithm, such as hmac-sha-256).
ip mtu 1400
The interface's IP MTU. A different MTU at each end keeps OSPF in EXSTART.
ip ospf mtu-ignore
Lets the adjacency form anyway, on the router with the smaller MTU.
no ip mtu
Back to 1500.
In privileged EXEC
show ip ospf neighbor
Each neighbour, its state (FULL, 2WAY) and role (DR, BDR).
show ip ospf interface brief
The OSPF interfaces with area, cost, state and neighbours.
show ip ospf
The process: router ID, areas, SPF runs.
show ip ospf interface Gi0/2
One interface: area, network type, cost, timers, authentication, DR and BDR.
show ip ospf virtual-links
Each virtual link, its transit area and state.
show ip ospf database nssa-external
The type 7 LSAs of the NSSAs this router is in.
show ip ospf database external
The type 5 LSAs.
show ip protocols
The routing protocols, their networks and passive interfaces.
clear ip ospf process
Restarts OSPF, for a new router ID (asks to confirm).
OSPF in a VRF: router ospf 2 vrf RED.
OSPFv3
OSPFv3 runs in both IOS styles, which interoperate: ipv6 router ospf 1 with ipv6 ospf 1 area 0 on the interfaces, and router ospfv3 1 with address-family ipv6 unicast and ospfv3 1 ipv6 area 0. Neighbours talk over link-local addresses, so next hops are FE80:: addresses, and the two ends need not share a global subnet. Area, timers and the stub flag must match. The router ID is a 32-bit number taken from an IPv4 address: a router with no IPv4 address logs %OSPFv3-4-NORTRID until you set router-id. Routes show as O (intra-area), OI (inter-area) and OE2 (a default from default-information originate). ipv6 unicast-routing is needed first.
Router
In global configuration
ipv6 unicast-routing
Routes IPv6 (needed for OSPFv3).
Under ipv6 router ospf 1
router-id 10.255.0.9
The router ID, needed on a router without IPv4 addresses.
passive-interface Gi0/2
Advertises the interface's prefixes without forming adjacencies there.
area 1 stub
A stub area (no-summary on the ABR: totally stubby, only a default OI ::/0).
default-information originate always
Advertises a default route (OE2 ::/0); without always, only while this router has one.
Under interface Gi0/2
ipv6 ospf 1 area 0
Runs OSPFv3 process 1 on the interface, in area 0 (it starts the process if there is none).
ipv6 ospf cost 20
The interface's OSPFv3 cost.
ipv6 ospf network point-to-point
No DR election on this link.
ipv6 ospf priority 0
Never DR or BDR.
ipv6 ospf hello-interval 5
The hello interval (dead: 4 times it); both ends must match.
Under router ospfv3 2
router-id 10.255.0.8
The address-family style: the router ID belongs to the process.
Under router ospfv3 2 > address-family ipv6 unicast
passive-interface Gi0/1
Most settings go under the IPv6 address family.
area 2 stub
A stub area, in the address family.
Under interface Gi0/1
ospfv3 2 ipv6 area 0
Runs router ospfv3 2 on the interface.
ospfv3 cost 30
Its cost, in the same style.
In privileged EXEC
show ipv6 ospf neighbor
Each neighbour: router ID, state and role, the neighbour's interface ID.
show ospfv3 neighbor
The same, headed by the address family.
show ipv6 ospf interface brief
The OSPFv3 interfaces: area, interface ID, cost, state and neighbours.
show ipv6 ospf interface Gi0/2
One interface: link-local address, area, router ID, network type, timers.
show ipv6 ospf
The process: router ID, ABR, areas.
show ipv6 route ospf
The OSPFv3 routes, via link-local next hops.
show ipv6 protocols
The IPv6 routing protocols and their interfaces.
EIGRP
EIGRP forms neighbours where both ends share the AS, a subnet, the K-values and the authentication, and runs DUAL: each path keeps its reported distance (RD) and total (FD), the lowest is the successor, and a path whose RD is below the successor's FD is a feasible successor. Classic mode (router eigrp 100) and named mode (router eigrp CORP with address families) both work; named mode uses the 64-bit wide metric and can run in a VRF. Metrics come from bandwidth and delay.
Router
Under router eigrp 100
network 10.0.0.0
Runs EIGRP on the interfaces in the classful network (with a wildcard, network 10.0.12.0 0.0.0.3, only those).
passive-interface Gi0/1
Advertises the subnet but sends no hellos there (passive-interface default makes every interface passive).
eigrp router-id 1.1.1.1
The router ID (otherwise the highest loopback, then the highest interface address).
variance 9
Also installs feasible successors whose metric is below 9 × the FD, sharing traffic in proportion.
maximum-paths 6
How many paths can be installed (4 by default).
eigrp stub
A stub router: it advertises only connected and summary routes and never passes routes between neighbours (receive-only, connected, summary narrow it).
metric weights 0 1 0 1 0 0
The K-values (these are the defaults). Neighbours with different K-values never form: the log says K-value mismatch.
no auto-summary
Accepted: automatic summarization is already off in IOS 15.
Under key chain WAN-KEYS
key 1
A key in a key chain (then key-string).
Under key chain WAN-KEYS > key 1
key-string NTpath-Eigrp1
The key's secret.
Under interface Gi0/2
ip authentication mode eigrp 100 md5
MD5 authentication on the link (both ends must match, or the log says Auth failure).
ip authentication key-chain eigrp 100 WAN-KEYS
The key chain the link uses.
Under interface Gi0/1
ip summary-address eigrp 100 10.3.0.0 255.255.252.0
Sends one summary out of this interface and installs its Null0 discard route (distance 5).
no ip split-horizon eigrp 100
Lets routes go back out of the interface they came in on.
Under interface Gi0/2
delay 100
The interface delay in tens of microseconds, the usual way to steer EIGRP.
bandwidth 10000
The bandwidth in kbit/s for EIGRP and OSPF costs (it never changes the real speed).
Under router eigrp CORP > address-family ipv4 unicast autonomous-system 200
network 10.0.0.0
Named mode: the same network statement, under the address family.
HMAC-SHA-256 authentication with its password (named mode only; authentication mode md5 with authentication key-chain also works).
summary-address 10.30.0.0 255.255.252.0
A summary out of that interface.
Under router eigrp CORP > address-family ipv4 unicast autonomous-system 200 > topology base
variance 2
Named mode keeps variance, maximum-paths and distance under topology base.
In privileged EXEC
show ip eigrp neighbors
Neighbours with their interface and hold time (vrf GUEST for a VRF).
show ip eigrp topology
Successors and feasible successors with (FD/RD) per path (all-links shows every path; a prefix such as 10.3.3.0/24 shows the detail).
show ip eigrp interfaces detail
EIGRP interfaces, peers, hello and hold times, split horizon and authentication.
show eigrp address-family ipv4 neighbors
Named-mode neighbours.
show ip route eigrp
EIGRP routes, with each path's own metric when variance installs several.
show key chain
The key chains and their keys.
EIGRP for IPv6 runs the same DUAL, metrics and options. Neighbours meet over link-local addresses (no common subnet needed), but the process still needs a 32-bit router ID: on an IPv6-only router, set one. In named mode the IPv6 address family runs on every IPv6 interface at once.
Router
In global configuration
ipv6 router eigrp 100
Classic EIGRP for IPv6 (needs ipv6 unicast-routing).
Under ipv6 router eigrp 100
eigrp router-id 1.1.1.1
The router ID; without an IPv4 address the process can't start otherwise.
passive-interface Gi0/2
Advertises the interface's prefixes without hellos (passive-interface default too).
shutdown
Stops the process (no shutdown starts it again).
Under interface Gi0/0
ipv6 eigrp 100
Runs EIGRP for IPv6 on the interface (there are no network statements).
ipv6 summary-address eigrp 100 2001:db8:1::/48
Advertises a summary out of the interface, with a discard route to Null0.
no ipv6 split-horizon eigrp 100
Lets routes go back out of the interface they came in on.
ipv6 authentication mode eigrp 100 md5
MD5 authentication, with ipv6 authentication key-chain eigrp 100 NAME.
In privileged EXEC
show ipv6 eigrp neighbors
Each neighbour by its link-local address.
show ipv6 eigrp topology
The topology table: successors, feasible distance, via link-local next hops.
show ipv6 eigrp interfaces
The interfaces running EIGRP for IPv6, and their peers.
show ipv6 route eigrp
The D routes in the IPv6 routing table.
Router
Under router eigrp V6NAMED > address-family ipv6 unicast autonomous-system 600
eigrp router-id 6.6.6.6
Named mode, IPv6: the address family's router ID.
In privileged EXEC
show eigrp address-family ipv6 neighbors
The IPv6 address family's neighbours, in named mode.
Takes this interface out of EIGRP for IPv6 (named mode includes every IPv6 interface).
BGP
Sessions are TCP connections on port 179 that follow the routing table, so iBGP works between loopbacks. A session comes from the update source (or the exit interface's address), and the other side accepts it only when that address is one of its neighbours, with the right AS on both ends and the same MD5 password; then either side may open it. An eBGP neighbour must be on a connected subnet unless ebgp-multihop or disable-connected-check, and its packets leave with TTL 1. An access list that drops TCP 179 both ways keeps the session down. show ip bgp neighbors and the log say why a session is not up (%BGP-3-NOTIFICATION for a wrong AS, %TCP-6-BADAUTH for MD5).
eBGP sets the next hop to the session's address; iBGP keeps it unless next-hop-self, and a path whose next hop is not in the routing table is not valid: no *, never best, never passed on, never installed. iBGP routes go to other iBGP peers only through a route reflector, which adds the originator ID and cluster list. Local preference stays inside the AS, MED reaches the next AS only, and communities travel only with send-community (no-export stops at the AS edge, no-advertise at the router). Best path: weight, local preference, locally originated, AS-path length, origin, MED (same neighbouring AS), eBGP over iBGP, IGP metric to the next hop, router ID, cluster-list length, neighbour address. Each neighbour's policy runs in IOS order: prefix list, distribute list, filter list, route map.
Router
Under router bgp 65000
bgp router-id 1.1.1.1
The BGP router ID.
neighbor 10.0.12.2 remote-as 64501
A neighbour in another AS (eBGP), or in this one (iBGP).
neighbor 10.0.12.2 description ISP1
A note on the session.
neighbor 10.0.12.2 password S3cret
MD5 authentication of the TCP session: both sides need the same password.
neighbor 10.0.12.2 timers 10 30
Keepalive and hold time for this neighbour (the lower hold time of the two sides wins).
timers bgp 30 90
The same for every neighbour.
neighbor 10.255.0.2 remote-as 65000
An iBGP neighbour, at its loopback.
neighbor 10.255.0.2 update-source Loopback0
Opens the session from Loopback0's address, which the neighbour must know as this router.
neighbor 10.255.0.2 next-hop-self
Sends eBGP-learned routes with this router as the next hop, so iBGP peers can reach it.
neighbor 192.0.2.9 remote-as 64600
An eBGP neighbour that is not on a connected subnet (its loopback).
neighbor 192.0.2.9 ebgp-multihop 2
Allows it up to 2 hops away (TTL 2), and lifts the connected check.
neighbor 192.0.2.9 disable-connected-check
Only lifts the connected check: TTL 1 still reaches a loopback one hop away.
neighbor IBGP peer-group
A peer group: settings shared by its members.
neighbor IBGP remote-as 65000
The group's AS.
neighbor IBGP update-source Loopback0
Every member sources the session from Loopback0.
neighbor 10.255.0.3 peer-group IBGP
Puts a neighbour in the group (its own settings still win).
neighbor IBGP route-reflector-client
Makes the members route-reflector clients: their routes go to every iBGP peer, other iBGP routes go to them.
bgp cluster-id 10.255.0.2
The reflector's cluster ID (the router ID by default).
network 203.0.113.0 mask 255.255.255.0
Advertises a network that is in the routing table exactly (its IGP metric becomes the MED).
neighbor 10.0.12.2 weight 200
Prefers routes from this neighbour on this router only.
neighbor 10.0.12.2 route-map ISP1-IN in
Applies a route map to what the neighbour sends (out: to what we send).
neighbor 10.0.12.2 prefix-list NO-LAB in
Filters the neighbour's prefixes with a prefix list (in or out).
neighbor 10.0.12.2 filter-list 1 out
Filters by AS path with an ip as-path access-list.
neighbor 10.0.12.2 distribute-list 10 in
Filters by network with an access list.
neighbor 10.0.12.2 send-community
Sends the communities (both: the extended ones too); without it they are stripped.
neighbor 10.0.12.2 remove-private-as
Removes private AS numbers from what we send, when the path holds only private ones (all: every one).
neighbor 10.0.12.2 default-originate
Sends this neighbour a default route, whether or not the table has one.
neighbor 10.0.12.2 soft-reconfiguration inbound
Keeps what the neighbour sent before inbound policy, for received-routes.
neighbor 10.0.12.2 allowas-in 1
Accepts paths that hold our own AS once (two sites of one AS joined by a provider).
bgp default local-preference 150
The local preference given to the paths this router learns or originates.
bgp always-compare-med
Compares MED between paths from different neighbouring ASes too.
maximum-paths 2
Installs up to 2 equal eBGP paths (same AS path) side by side.
maximum-paths ibgp 2
The same for iBGP paths (equal IGP metric to the next hop).
neighbor 10.0.12.2 shutdown
Takes the session down without removing it.
no neighbor 10.0.12.2 shutdown
Brings it back.
In global configuration
ip as-path access-list 1 permit ^$
An AS-path list (Cisco regular expressions; ^$ is a path we originate, _ any delimiter).
ip community-list standard LAB permit 65000:60
A community list: an entry needs all its communities on the path.
ip community-list expanded CUST permit ^65000:
An expanded list: a regular expression over the communities as shown.
ip bgp-community new-format
Shows communities as AA:NN instead of one 32-bit number.
Under vrf definition CUST
rd 65000:9
A VRF needs a route distinguisher before BGP can run in it.
address-family ipv4
Its IPv4 address family.
Under router bgp 65000 > address-family ipv4 vrf CUST
neighbor 172.16.9.2 remote-as 64999
A neighbour inside VRF CUST: the session uses CUST's interfaces and routes.
network 10.9.0.0 mask 255.255.255.0
Advertises a network from CUST's routing table; the routes land in CUST only.
In privileged EXEC
show ip bgp summary
Each neighbour, its state and how many prefixes it sent.
show ip bgp
The BGP table: * valid, > best, i internal, r RIB failure (another protocol's route won), s suppressed, m multipath.
show ip bgp 203.0.113.0
Every path to one prefix, its attributes, communities, originator and cluster list, and why the best one won.
show ip bgp neighbors 10.0.12.2
One session: state, timers, update source, TTL, policies and prefix counts.
show ip bgp neighbors 10.0.12.2 advertised-routes
What we send this neighbour, after outbound policy.
show ip bgp neighbors 10.0.12.2 routes
What we accepted from it.
show ip bgp neighbors 10.0.12.2 received-routes
What it sent before inbound policy (needs soft reconfiguration).
show ip bgp regexp ^64501_
The paths whose AS path matches the expression.
show ip bgp community 65000:60
The paths that carry every community listed.
show ip bgp vpnv4 vrf CUST
The BGP table of one VRF, under its route distinguisher.
show ip as-path-access-list
The AS-path lists.
show ip community-list
The community lists.
clear ip bgp * soft
Asks for the routes again and resends ours (policy already applies at once here).
clear ip bgp 10.0.12.2
Resets a session: it goes down and comes back up, as the log shows.
MP-BGP for IPv6: a neighbour is defined once (an IPv4 or an IPv6 address) and activated per address family. Every neighbour is active in IPv4 unicast by default; no bgp default ipv4-unicast turns that off for the ones defined after it. Over an IPv4 session, the next hop of IPv6 prefixes is the IPv4-mapped ::FFFF:a.b.c.d, which is never reachable: set a real one with a route map. Routes from a directly connected eBGP neighbour are installed through its link-local address.
Router
Under router bgp 65000
no bgp default ipv4-unicast
New neighbours are no longer activated in IPv4 unicast.
neighbor 2001:DB8:12::2 remote-as 65002
A neighbour over IPv6.
address-family ipv6
The IPv6 unicast address family.
Under router bgp 65000 > address-family ipv6
network 2001:DB8:1:1::/64
Advertises an IPv6 prefix that is in the routing table.
neighbor 2001:DB8:12::2 activate
Exchanges IPv6 prefixes with the neighbour (route maps, next-hop-self and the rest follow per family).
Under route-map V6-NH permit 10
set ipv6 next-hop 2001:DB8:23::2
A route map's IPv6 next hop, for IPv6 prefixes sent over an IPv4 session.
In privileged EXEC
show bgp ipv6 unicast
The IPv6 BGP table (show ip bgp ipv6 unicast too).
show bgp ipv6 unicast summary
The neighbours active in IPv6 unicast and their prefixes.
show bgp ipv6 unicast neighbors 2001:DB8:12::2 advertised-routes
What this router sends the neighbour in IPv6.
show ipv6 route bgp
The B routes in the IPv6 routing table.
Dynamic neighbours: a hub that accepts sessions from any address in a range, with a peer group's settings (DMVPN hubs use it). The other side opens the connection; show ip bgp summary marks those neighbours with *.
Router
Under router bgp 65000
neighbor SPOKES peer-group
The peer group the dynamic neighbours belong to.
neighbor SPOKES remote-as 65000
Its AS (required).
bgp listen range 10.0.0.0/24 peer-group SPOKES
Accepts sessions from that range.
bgp listen limit 50
The most dynamic neighbours at once (100 by default).
Route maps and prefix lists
Router
In global configuration
ip prefix-list NO-LAB seq 5 deny 10.99.0.0/16 le 24
A prefix list entry (ge and le match ranges of lengths).
ip prefix-list NO-LAB seq 10 permit 0.0.0.0/0 le 32
Permits everything else.
ip prefix-list DEFAULT seq 5 permit 0.0.0.0/0
Matches the default route only.
Under route-map ISP1-IN permit 10
match ip address prefix-list DEFAULT
This entry applies to the routes the prefix list permits.
set local-preference 200
Prefers these routes across the AS.
Under route-map ISP1-IN permit 20
set weight 100
Sets the weight.
Under route-map ISP1-OUT permit 10
set as-path prepend 65000 65000
Makes our routes look longer to this neighbour, so inbound traffic prefers another way.
set metric 50
Sets the MED.
Under route-map ISP1-IN permit 30
match as-path 1
BGP paths whose AS path the AS-path list permits.
match community LAB
BGP paths whose communities the community list permits (exact-match: no others).
Under route-map ISP1-OUT permit 10
set community 65000:60 no-export additive
Sets communities (additive keeps the ones the path has; none removes them all).
Under route-map ISP1-IN permit 30
set comm-list LAB delete
Removes the communities a standard community list permits.
Under route-map ISP1-OUT permit 10
set origin igp
Sets the BGP origin (incomplete: ?).
Under route-map RM permit 20
match ip address 10
Routes whose network an access list permits (a standard ACL matches the network address).
Under route-map RM deny 5
match tag 90
Routes carrying that tag (several values: any of them).
An EIGRP seed metric (one number: an OSPF metric or a BGP MED).
In privileged EXEC
show route-map
Each route map with its entries and matches.
Route maps apply to redistribution, BGP neighbours and distribute lists. The first sequence whose every match clause fits decides; with no match clause, a sequence fits every route; anything left over is denied. A match on a prefix list or access list that does not exist fits every route, but a route map that does not exist lets nothing through.
Redistribution
redistribute copies routes from the routing table into OSPF, EIGRP or BGP, with the subnets of the interfaces that run the source protocol. OSPF needs subnets (otherwise only classful networks cross) and seeds E2 metric 20; EIGRP sends nothing without a seed metric, except for connected and static routes; BGP takes eBGP routes only. Tags travel with the routes, so two redistribution points can refuse each other's routes. When two routers redistribute both ways, the first one keeps the prefix, as on a real network.
Router
Under router ospf 1
redistribute eigrp 100 subnets
EIGRP routes into OSPF as E2, metric 20 (metric-type 1, metric, tag, route-map change that).
redistribute connected subnets route-map RM
Connected networks, through a route map.
default-metric 30
The seed metric for every redistributed source.
summary-address 172.20.0.0 255.255.252.0
On an ASBR: one external route for the redistributed networks inside it, and a discard route to Null0 (distance 254).
distribute-list route-map RM in
Keeps the routes the route map denies out of this router's table (an access list number or prefix NAME works too). The LSAs still flood.
Under router eigrp 100
redistribute ospf 1 metric 1000000 10 255 1 1500
OSPF routes into EIGRP as externals (D EX, distance 170): bandwidth, delay, reliability, load, MTU.
default-metric 1000000 10 255 1 1500
The seed metric for every source without its own.
redistribute static
Static routes, with their exit interface's metric.
distribute-list prefix NO-LAB out Gi0/1
Filters the updates sent out of Gi0/1 (in for received ones; without an interface, all of them).
Under router bgp 65000
redistribute ospf 1 match internal external
OSPF routes into BGP (internal ones only by default), origin incomplete, with the IGP metric as MED.
bgp redistribute-internal
Lets iBGP routes be redistributed into an IGP.
aggregate-address 10.0.0.0 255.0.0.0 summary-only
Advertises the aggregate while a more specific route is in the BGP table, and suppresses the specifics (s in show ip bgp).
In privileged EXEC
show ip ospf database external
The type 5 LSAs: metric type, metric and tag.
show ip protocols
What each process redistributes and its filter lists.
Policy-based routing
A route map on the interface where traffic comes in decides the next hop before the routing table. Sequences match packets with access lists (match ip address); a deny sequence, an ACL deny or no match leaves the packet to the routing table. The table itself never changes, so check PBR with traceroute and the route map's counters.
Router
Under route-map PBR permit 10
match ip address GUEST
The packets an extended access list permits (match length 0 400 matches by size).
set ip next-hop 198.51.100.1
Sends them to that next hop when it is directly connected and up; otherwise they follow the table.
set ip next-hop verify-availability 198.51.100.1 1 track 20
The same, only while track 20 is up.
Under route-map PBR permit 20
set ip default next-hop 198.51.100.1
Used only when the table has no explicit route for the destination (a default route does not count).
Under route-map PBR permit 30
set interface Gi0/1
Sends the packets out of an interface.
Under interface Gi0/2
ip policy route-map PBR
Policy-routes what enters Gi0/2.
In global configuration
ip local policy route-map PBR
Policy-routes the router's own traffic (pings, probes).
In privileged EXEC
show ip policy
Which interfaces have which route map.
show route-map PBR
The sequences with their match counters and the track state of each next hop.
VRF-lite and GRE
Router
In global configuration
vrf definition RED
A VRF: a separate routing table (ip vrf RED is the older form).
Under vrf definition RED
rd 65000:1
Its route distinguisher.
address-family ipv4
Turns IPv4 on in the VRF.
Under interface Gi0/2
vrf forwarding RED
Moves the interface into the VRF. As in IOS, this removes its address: set it again.
ip address 172.16.1.1 255.255.255.0
The address, now in VRF RED.
Under router eigrp CORP > address-family ipv4 unicast vrf RED autonomous-system 300
network 172.16.1.0 0.0.0.255
EIGRP inside the VRF, in named mode: its own AS, neighbours and routes (show ip eigrp vrf RED neighbors).
In privileged EXEC
show vrf
Each VRF and its interfaces.
show ip route vrf RED
One VRF's routing table.
ping vrf RED 172.16.1.10
A ping from inside a VRF.
Under interface Tunnel0
tunnel source Gi0/0
Where the tunnel starts (an interface or an address).
tunnel destination 10.0.12.2
The far end's address.
tunnel mode gre ip
GRE over IPv4 (the default).
ip address 172.31.0.1 255.255.255.252
The tunnel's own subnet. It is up when the destination is reachable.
In privileged EXEC
show interfaces Tunnel0
The tunnel's state, source and destination.
DMVPN: multipoint GRE and NHRP
A single-hub DMVPN: one multipoint tunnel per router. Each spoke registers its tunnel and outside (NBMA) addresses with the hub, its next-hop server, so the hub learns the spokes without per-spoke configuration. Routing protocols reach the spokes through the hub's multicast mappings. Spoke-to-spoke tunnels come up on demand: in phase 2 a spoke resolves the other spoke's tunnel address (the hub keeps it as the next hop), and in phase 3 the hub redirects and the spoke installs a shortcut.
Router
Under interface Tunnel0
tunnel mode gre multipoint
Multipoint GRE: a source and no destination. NHRP supplies the destinations.
tunnel key 100
Both ends must carry the same key, or the packets are dropped.
ip nhrp network-id 1
Turns NHRP on for the tunnel (the number is local to the router).
ip nhrp authentication NTPATH
A cleartext string (up to 8 characters) that every NHRP packet must carry.
ip nhrp map multicast dynamic
On the hub: copies multicasts (routing protocol hellos) to every spoke that registered.
ip nhrp nhs 10.0.0.1 nbma 203.0.113.2 multicast
On a spoke: the next-hop server's tunnel and NBMA addresses, and send it multicasts (the older form is ip nhrp map, ip nhrp map multicast and ip nhrp nhs).
ip nhrp map 10.0.0.1 203.0.113.2
A static mapping of a tunnel address to an NBMA address.
ip nhrp map multicast 203.0.113.2
Sends multicasts to that NBMA address.
ip nhrp holdtime 600
How long the mappings this router gives out are valid (7200 seconds by default).
ip nhrp redirect
On the hub (phase 3): tells a spoke when its packet leaves on the tunnel it came in on.
ip nhrp shortcut
On a spoke (phase 3): acts on redirects, installing an NHRP route (H) or overriding the next hop (%).
no ip split-horizon eigrp 100
On the hub: lets EIGRP pass one spoke's routes to the others over the same tunnel.
no ip next-hop-self eigrp 100
On the hub (phase 2): keeps the originating spoke as the next hop, so spokes resolve each other.
In privileged EXEC
show dmvpn
Each peer: NBMA and tunnel address, state (UP, NHRP, IKE, IPsec), attributes (S static, D dynamic, T1 route installed, T2 next-hop override).
show ip nhrp
The NHRP cache: static, registered and resolved entries, and shortcut prefixes.
show ip nhrp nhs
A spoke's next-hop servers: RE when the server responds, E while it waits for replies.
clear ip nhrp
Removes resolved entries and shortcuts: the next packet goes through the hub again.