Routing Basics
Routing Basics
Routing Basics
1
Routing Concepts
p IPv4
p Routing
p Forwarding
p Some definitions
p Policy options
p Routing Protocols
2
IPv4
p Internet uses IPv4
■ Addresses are 32 bits long
■ Range from 1.0.0.0 to 223.255.255.255
■ 0.0.0.0 to 0.255.255.255 and 224.0.0.0 to
255.255.255.255 have “special” uses
p IPv4 address has a network portion and a
host portion
3
IPv4 address format
p Address and subnet mask
■ written as
■ 12.34.56.78 255.255.255.0 or
■ 12.34.56.78/24
■ mask represents the number of network bits in
the 32 bit address
■ the remaining bits are the host bits
4
What does a router do?
5
A day in a life of a router
find path
forward packet, forward packet, forward
packet, forward packet...
find alternate path
forward packet, forward packet, forward
packet, forward packet…
repeat until powered off
6
Routing versus Forwarding
p Routing = building
maps and giving
directions
p Forwarding =
moving packets
between interfaces
according to the
“directions”
7
IP Routing – finding the path
p Path derived from information received
from a routing protocol
p Several alternative paths may exist
■ best path stored in forwarding table
p Decisions are updated periodically or as
topology changes (event driven)
p Decisions are based on:
■ topology, policies and metrics (hop count,
filtering, delay, bandwidth, etc.)
8
IP route lookup
p Based on destination IP address
p “longest match” routing
■ More specific prefix preferred over less specific
prefix
■ Example: packet with destination of
10.1.1.1/32 is sent to the router announcing
10.1/16 rather than the router announcing
10/8.
9
IP route lookup
p Based on destination IP address
10/8
Packet: Destination R3 announced
IP address: 10.1.1.1 from here
R1 R2
R4
10/8 → R3
10.1/16
10.1/16 → R4 announced from
20/8 → R5 here
30/8 → R6
…..
R2’s IP routing table 10
IP route lookup:
Longest match routing
p Based on destination IP address
10/8
Packet: Destination R3 announced
IP address: 10.1.1.1 from here
R1 R2
R4
10/8 → R3 10.1.1.1 && FF.0.0.0 10.1/16
10.1/16 → vs. Match! announced from
R4 10.0.0.0 && FF.0.0.0 here
20/8 → R5
30/8 → R6
R2…’s..IP routing table 11
IP route lookup:
Longest match routing
p Based on destination IP address
10/8
Packet: Destination R3 announced
IP address: 10.1.1.1 from here
R1 R2
10/8 → R3 R4
10.1/16
10.1/16 → R4 10.1.1.1 && FF.FF.0.0
vs. Match as wea
lln
! nounced from
20/8 → R5 here
10.1.0.0 && FF.FF.0.0
30/8 → R6
…..
R2’s IP routing table 12
IP route lookup:
Longest match routing
p Based on destination IP address
10/8
Packet: Destination R3 announced
IP address: 10.1.1.1 from here
R1 R2
R4
10/8 → R3 R 4
10.1/16 → 10.1/16
20/8 → R5 announced from
10.1.1.1 && FF.0.0.0
30/8 → R6 vs. Does not match! here
….. 20.0.0.0 && FF.0.0.0
R2’s IP routing table 13
IP route lookup:
Longest match routing
p Based on destination IP address
10/8
Packet: Destination R3 announced
IP address: 10.1.1.1 from here
R1 R2
R4
10/8 → R3 10.1/16
10.1/16 → R4 announced from
20/8 → R5 10.1.1.1 && FF.0.0.0 here
30/8 → R6 vs. Does not match!
30.0.0.0 && FF.0.0.0
…..
R2’s IP routing table 14
IP route lookup:
Longest match routing
p Based on destination IP address
10/8
Packet: Destination R3 announced
IP address: 10.1.1.1 from here
R1 R2
R4
10/8 → R3 10.1/16
10.1/16 → R4 Longest match, 16 bit netmaskannounced from
20/8 → R5 here
30/8 → R6
…..
R2’s IP routing table 15
IP Forwarding
p Router decides which interface a packet is
sent to
p Forwarding table populated by routing
process
p Forwarding decisions:
■ destination address
■ class of service (fair queuing, precedence, others)
■ local requirements (packet filtering)
p Forwarding is usually aided by special
hardware
16
Routing Tables Feed the Forwarding Table
Connected Routes
Static Routes
17
RIBs and FIBs
p FIB is the Forwarding Table
■ It contains destinations and the interfaces to get to those
destinations
■ Used by the router to figure out where to send the
packet
■ Careful! Some people still call this a route!
p RIB is the Routing Table
■ It contains a list of all the destinations and the various
next hops used to get to those destinations – and lots of
other information too!
■ One destination can have lots of possible next-hops –
only the best next-hop goes into the FIB
18
Explicit versus Default Routing
p Default:
■ simple, cheap (cycles, memory, bandwidth)
■ low granularity (metric games)
p Explicit (default free zone)
■ high overhead, complex, high cost, high
granularity
p Hybrid
■ minimise overhead
■ provide useful granularity
■
requires some filtering knowledge
19
Egress Traffic
p How packets leave your network
p Egress traffic depends on:
■ route availability (what others send you)
■ route acceptance (what you accept from
others)
■ policy and tuning (what you do with routes
from others)
■ Peering and transit agreements
20
Ingress Traffic
p How packets get to your network and your
customers’ networks
p Ingress traffic depends on:
■ what information you send and to whom
■ based on your addressing and AS’s
■ based on others’ policy (what they accept from
you and what they do with it)
21
Autonomous System (AS)
AS 100
25
Routing Flow/Packet Flow:
With multiple ASes
AS 1
AS 34
N1
AS16
AS 8
N16
AS 1
AS 34
N1
AS16
AS 8
N16
green green
packet flow
p AS99 uses red link for traffic to the red AS and
the green link for remaining traffic
p To implement this policy, AS99 has to:
■ Accept routes originating from the red AS on the red link
■ Accept all other routes on the green link
29
Routing Policy Limitations
red
red Internet
AS22 AS99
green green
packet flow
p AS99 would like packets coming from the green AS to use the
green link.
p But unless AS22 cooperates in pushing traffic from the green
AS down the green link, there is very little that AS99 can do to
achieve this aim
30
Routing Policy Issues
p Mid-August 2012:
■ 422000 prefixes
p Not realistic to set policy on all of them individually
■ 42000 origin AS’s
p Too many to try and create individual policies for
p Routes tied to a specific AS or path may
be unstable regardless of connectivity
p Solution: Groups of AS’s are a natural
abstraction for filtering purposes
31
Routing Protocols
We now know what routing means…
…but what do the routers get up
to?
And why are we doing this anyway?
32
1: How Does Routing Work?
p Internet is made up of the ISPs who
connect to each other’s networks
p How does an ISP in Kenya tell an ISP in
Japan what customers they have?
p And how does that ISP send data packets
to the customers of the ISP in Japan, and
get responses back
■ After all, as on a local ethernet, two way packet
flow is needed for communication between two
devices
33
2: How Does Routing Work?
p ISP in Kenya could buy a direct connection
to the ISP in Japan
■ But this doesn’t scale – thousands of ISPs,
would need thousands of connections, and cost
would be astronomical
p Instead, ISP in Kenya tells his
neighbouring ISPs what customers he has
■ And the neighbouring ISPs pass this
information on to their neighbours, and so on
■ This process repeats until the information
reaches the ISP in Japan
34
3: How Does Routing Work?
pThis process is called “Routing”
pThe mechanisms used are called “Routing
Protocols”
pRouting and Routing Protocols ensures that
the Internet can scale, that thousands of
ISPs can provide connectivity to each other,
giving us the Internet we see today
35
4: How Does Routing Work?
p ISP in Kenya doesn’t actually tell his neighbouring
ISPs the names of the customers
■ (network equipment does not understand names)
p Instead, he has received an IP address block as a
member of the Regional Internet Registry serving
Kenya
■ His customers have received address space from this
address block as part of their “Internet service”
■ And he announces this address block to his neighbouring
ISPs – this is called announcing a “route”
36
Routing Protocols
p Routers use “routing protocols” to
exchange routing information with each
other
■ IGP is used to refer to the process running on
routers inside an ISP’s network
■ EGP is used to refer to the process running
between routers bordering directly connected
ISP networks
37
What Is an IGP?
p Interior Gateway Protocol
p Within an Autonomous System
p Carries information about internal
infrastructure prefixes
p
Two widely used IGPs:
■ OSPF
■ ISIS
38
Why Do We Need an IGP?
p ISP backbone scaling
■ Hierarchy
■ Limiting scope of failure
■ Only used for ISP’s infrastructure addresses,
not customers or anything else
■ Design goal is to minimise number of prefixes
in IGP to aid scalability and rapid convergence
39
What Is an EGP?
p Exterior Gateway Protocol
p Used to convey routing information
between Autonomous Systems
p De-coupled from the IGP
p Current EGP is BGP
40
Why Do We Need an EGP?
p Scaling to large network
■ Hierarchy
■ Limit scope of failure
p Define Administrative Boundary
p Policy
■ Control reachability of prefixes
■ Merge separate organisations
■ Connect multiple IGPs
41
Interior versus Exterior
Routing Protocols
p Interior p Exterior
■ automatic neighbour ■ specifically
discovery configured peers
■ generally trust your ■ connecting with
IGP routers outside networks
■ prefixes go to all ■ set administrative
IGP routers boundaries
■ binds routers in one ■ binds AS’s together
AS together
42
Interior versus Exterior
Routing Protocols
p Interior p Exterior
■ Carries ISP ■ Carries customer
infrastructure prefixes
addresses only ■ Carries Internet
■ ISPs aim to keep prefixes
the IGP small for ■ EGPs are
efficiency and independent of ISP
scalability network topology
43
Hierarchy of Routing Protocols
Other ISPs
BGP4
BGP4
and OSPF/ISIS
BGP4 Static/BGP4
IXP Customers
44
FYI: Cisco IOS Default Administrative
Distances
Route Source Default Distance
Connected Interface 0
Static Route 1
Enhanced IGRP Summary Route 5
External BGP 20
Internal Enhanced IGRP 90
IGRP 100
OSPF 110
IS-IS 115
RIP 120
EGP 140
External Enhanced IGRP 170
Internal BGP 200
45
Unknown 255
46
Conference
Net
2 NetFlow,
SNMP
1
Syslog, TFTP, NOC
1. SSH to NOC AAA, DNS,
2. Telnet to router SMTP
Banner – What Is Wrong ?
banner login ^C
TCP small servers Standard TCP network services: 11.3: disabled 11.2: This is a legacy feature, no service tcp-
echo, chargen, etc enabled disable it explicitly small-servers
UDP small servers Standard UDP network 11.3: disabled 11.2: This is a legacy feature, no service udp-
services: echo, discard, etc enabled disable it explicitly small-servers
Finger Unix user lookup service, allows Enabled Unauthorized persons don’t no service
remote listing of logged in need to know this, disable it. finger
users.
HTTP server Some Cisco IOS devices offer Varies by device If not in use, explicitly no ip http
web-based configuration disable, otherwise restrict server
access
Bootp server Service to allow other routers Enabled This is rarely needed and may no ip bootp
to boot from this one open a security hole, disable server
it
Turn Off Unused Services
Feature Description Default Recommendation Command
Description Network
default 0.0.0.0 /8
loopback 127.0.0.0 /8
RFC 1918 10.0.0.0 /8
RFC 1918 172.16.0.0 /12
RFC 1918 192.168.0.0 /16
Net Test 192.0.2.0 /24
Testing devices * 192.18.0.0 /15
IPv6 to IPv4 relay * 192.88.99.0 /24
RFC 1918 nameservers * 192.175.48.0 /24
End-node auto configuration * 169.254.0.0 /16
Example Incoming IPv4 Bogon Packet
Filter
ip access-list extended DSL-Incoming
deny ip 127.0.0.0 0.255.255.255 any log
deny ip 10.0.0.0 0.255.255.255 any log
deny ip 169.254.0.0 0.0.255.255 any log
deny ip 172.16.0.0 0.15.255.255 any log
deny ip 192.168.0.0 0.0.255.255 any log
deny ip 224.0.0.0 15.255.255.255 any log
permit icmp any any ttl-exceeded
permit icmp any any echo-reply
permit icmp any any echo
permit tcp any any eq 22 log
permit udp host <ip address> eq domain <subnet range>
permit udp host <ip address> eq domain <subnet range>
permit udp host <ip address> <subnet range> eq ntp
permit udp host <ip address> <subnet range> eq ntp
permit tcp any <my sybnet> established
deny ip any any log
Example Incoming IPv4 Bogon Packet
Filter
• Bogon and fullbogon peering use different
ASNs
• Advertise all fullbogons (IPv4 and IPv6) over a
single BGP peering session
• For details: http://www.team-
cymru.org/Services/Bogons/bgp.html
RFC2827 (BCP38) – Ingress Filtering
• If an ISP is aggregating routing announcements for
multiple downstream networks, strict traffic filtering
should be used to prohibit traffic which claims to have
originated from outside of these aggregated
announcements.
• The ONLY valid source IP address for packets
originating from a customer network is the one
assigned by the ISP (whether statically or dynamically
assigned).
• An edge router could check every packet on ingress to
ensure the user is not spoofing the source address on
the packets which he is originating.
Guideline for BCP38
• Networks connecting to the Internet
– Must use inbound and outbound packet filters to
protect network
• Configuration example
– Outbound—only allow my network source
addresses out
– Inbound—only allow specific ports to specific
destinations in
Techniques for BCP 38
• Static ACLs on the edge of the network
• Unicast RPF strict mode
• IP source guard
Example Outgoing Packet Filter
Route Optimization
Route Optimization 79
Routes :
Default Route Only
Default + Full Routes
Partial Routes
Route Optimization 80