Cis185 Lecture RouteOptimization Part1
Cis185 Lecture RouteOptimization Part1
• Passive Interfaces
• Route Filters
– Distribute Lists
• Policy Routing
– Route Maps
• Route Redistribution
– Multiple Routing Protocols
– Changing Administrative Distances
– Default Metrics
All by using:
– routing update controls
– policy-based routing
– route redistribution
• Passive Interfaces
• Route Filters
– Distribute Lists
• Policy Routing
– Route Maps
• Route Redistribution
– Multiple Routing Protocols
– Changing Administrative Distances
– Default Metrics
RTA(config)#router rip
RTA(config-router)#network 10.0.0.0
By default:
• RIP updates are sent out all interfaces belonging to the 10.0.0.0
network.
• All directly connected subnets belonging to 10.0.0.0 network will be
included in the RIP updates, plus any dynamically learned routes.
Rick Graziani graziani@cabrillo.edu 7
Passive Interfaces
RTA(config)#router rip
RTA(config-router)#network 10.0.0.0
Include 10.0.0.0
10.1.1.0 /24 subnets in updates
10.3.3.0 /24
10.4.4.0 /24
10.2.2.0 /24 10.1.1.0 /24 10.1.1.0 /24
10.3.3.0 /24 10.2.2.0 /24 10.2.2.0 /24
10.4.4.0 /24 10.3.4.0 /24 10.4.4.0 /24
By default:
• RIP updates are sent out all interfaces belonging to the 10.0.0.0
network.
• All directly connected subnets belonging to 10.0.0.0 network will be
included in the RIP updates, plus any dynamically learned routes.
Rick Graziani graziani@cabrillo.edu 8
Passive Interfaces
RTA(config)#router rip
RTA(config-router)#network 10.0.0.0
Passive interface
Passive Interfaces
receive—but don’t
send--updates
RTA
router rip
passive-interface default
no passive-interface ethernet0
network 10.0.0.0
• Passive Interfaces
• Route Filters
– Distribute Lists
• Policy Routing
– Route Maps
• Route Redistribution
– Multiple Routing Protocols
– Changing Administrative Distances
– Default Metrics
Inbound interfaces:
• When applied to inbound updates, the syntax for configuring a
route filter is as follows:
Router(config-router)#distribute-list access-list-number in
[interface-name]
Note: This does not permit/deny packets from entering the routers, only
what routes a router will send or receive updates about.
s0
RTZ
s0
Applies to just s0 e0
RTZ(config)#router rip
RTZ(config-router)#network 10.0.0.0
RTZ(config-router)#distribute-list 16 in s0
RTZ(config)#access-list 16 deny 10.1.1.0 0.0.0.255
RTZ(config)#access-list 16 permit any
Rick Graziani graziani@cabrillo.edu 22
Route Filters Outbound
Outbound interfaces:
• When applied to outbound updates, the syntax can
be more complicated:
RTZ(config)#router rip
RTZ(config-router)#distribute-list 1 in
RTZ(config-router)#distribute-list 2 out
RTZ(config-router)#distribute-list 3 in e0
RTZ(config-router)#distribute-list 4 out e0
RTZ(config)#router rip
RTZ(config-router)#distribute-list 1 in
RTZ(config-router)#distribute-list 2 out
RTZ(config-router)#distribute-list 3 in e0
RTZ(config-router)#distribute-list 4 out e0
RTZ#show ip protocols
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 25 seconds
Invalid after 180 seconds, hold down 180, flushed after
240
Outgoing update filter list for all interfaces is 2
Ethernet0 filtered by 4
Incoming update filter list for all interfaces is 1
Ethernet0 filtered by 3
• Passive Interfaces
• Route Filters
– Distribute Lists
• Policy Routing
– Route Maps
• Route Redistribution
– Multiple Routing Protocols
– Changing Administrative Distances
– Default Metrics
• Static routes: You can use the ip route command to dictate which
path a router will select to a given destination, based on the
destination address..
• However, through policy routing, you can manually program a router
to choose a route based not only on destination, but on source as
well.
• Human factors such as monetary expense, organizational jurisdiction,
or security issues can lead administrators to establish policies, or
rules that routed traffic should follow.
• Left to their default behavior, routing protocols may arrive at path
decisions that conflict with these policies.
• Policy routes are nothing more than sophisticated static routes.
ISP2
Routing Table
Routing Table
• Default is permit.
• Deny is more often used with route maps and redistribution. (later)
• You can use the optional sequence-number to indicate the position a new route
map is to have in the list of route maps already configured with the same name.
• If you don’t specify a sequence number, the first route map condition will be
automatically numbered as 10.
Once you have entered the route-map command, you can enter set
and match commands in the route-map configuration mode.
– Each route-map command has a list of match and set commands
associated with it.
– The match commands specify the match criteria—the conditions
that should be tested to determine whether or not to take action.
– The set commands specify the set actions—the actions to perform
if the match criteria are met.
ISP2
ISP2
Assume for this example that the policy we want to enforce is this:
• Internet-bound traffic from 192.168.1.0 /24 is to be routed to ISP1
• Internet-bound traffic from 172.16.1.0 /24 is to be routed to ISP2.
Access Lists
First we configure two access
lists with these commands:
ISP2
ISP2
RTA(config)#interface e0
RTA(config-if)#ip policy route-map ISP1
RTA(config)#interface e1
RTA(config-if)#ip policy route-map ISP2
RTA(config)#access-list 1 permit 192.168.1.0 0.0.0.255
RTA(config)#access-list 2 permit 172.16.1.0 0.0.0.255
RTA(config)#route-map ISP1 permit 10
RTA(config-route-map)#match ip address 1
RTA(config-route-map)#set interface s0
RTA(config)#route-map ISP2 permit 10
RTA(config-route-map)#match ip address 2
RTA(config-route-map)#set interface s1
Rick Graziani graziani@cabrillo.edu 43
Note 2: What about traffic between
Policy Routing Example 172.16.1.0 and 192.168.1.0?
In this case, they will not be
able to communicate.
If there was a route for those
networks on ISP1 and ISP2,
then traffic would be routed
from RTA to ISP1/ISP2 and
back to RTA for the other
LAN network.
Fix? Use extended access
lists and add a previous
route-map statement that
sends traffic to the other
LAN out the other Ethernet
ISP2 interface.
RTA(config)#interface e0
RTA(config-if)#ip policy route-map ToNet172
RTA(config-if)#ip policy route-map ISP1
RTA(config)#interface e1
RTA(config-if)#ip policy route-map ToNet192
RTA(config-if)#ip policy route-map ISP2
RTA(config)#access-list 101 permit 192.168.1.0 0.0.0.255 172.16.1.0 0.0.0.255
RTA(config)#access-list 102 permit 172.16.1.0 0.0.0.255 192.168.1.0 0.0.0.255
RTA(config)#route-map ToNet172 permit 10
RTA(config-route-map)#match ip address 101
RTA(config-route-map)#set interface e1
RTA(config)#route-map ToNet192 permit 10
RTA(config-route-map)#match ip address 102
RTA(config-route-map)#set interface e0
Rick Graziani graziani@cabrillo.edu 44
Another Policy Routing Example
Jeff Doyle, Routing TCP/IP Vol. I
CCO:
http://www.cisco.com/univercd/cc/td/doc/product/softwar
e/ios122/122cgcr/fqos_c/fqcprt1/qcfpbr.htm
172.16.4.1/24 Schroeder
Linus
S0 172.16.4.3/24 E0
172.16.3.1/24
Pigpen
Charlie
172.16.1.1/24 172.16.1.2/24
172.16.4.1/24 Schroeder
Linus
S0 172.16.4.3/24 E0
172.16.3.1/24
Pigpen
Charlie
172.16.1.1/24 172.16.1.2/24
172.16.4.1/24 Schroeder
Linus
S0 172.16.4.3/24 E0
172.16.3.1/24
Pigpen
Charlie
172.16.1.1/24 172.16.1.2/24
172.16.4.1/24 Schroeder
Linus
S0 172.16.4.3/24 E0
172.16.3.1/24
Pigpen
Charlie
172.16.1.1/24 172.16.1.2/24
172.16.4.1/24 Schroeder
Linus
S0 172.16.4.3/24 E0
172.16.3.1/24
Pigpen
Charlie
172.16.1.1/24 172.16.1.2/24
Linus:
inter S0
ip policy route-map Sally route-map Sally permit 10
match ip address 101
access-list 101 permit ip any set ip next-hop 172.16.4.2
host 172.16.1.1
access-list 102 permit ip host route-map Sally permit 15
172.16.7.1 host 172.16.1.2 match ip address 102
set ip next-hop 172.16.4.3
172.16.4.1/24 Schroeder
Linus FTP
Telnet
S0 172.16.4.3/24 E0
172.16.3.1/24
Pigpen
FTP Telnet
Charlie
172.16.1.1/24 172.16.1.2/24
Client Server
Port 1027 Port 1026 Port 21 Port 20
FTP data port FTP cmd port FTP cmd port FTP-data port
Intiate Connection
1
SP=1026 DP=21
2
Connection ACKed
SP=21 DP=1026
Data sent
SP=20 DP=1027
3
Data ACKed
4
SP=1027 DP=20
Active FTP
• FTP uses different port numbers for initiating a connection and for sending data.
• The FTP client connects from a random unprivileged source port (N > 1024) to the FTP
server's command port, destination port 21. Client: SP=1026 DP=21
• The FTP client then starts listening to port N+1 (1026+1=1027).
• The server will then connect back to the client's specified data port from its local data
port, which is source port 20 to the the client's destination port 1027. Server SP= 20
DP=1027
Intiate Connection
1
SP=1026 DP=21
2
Connection ACKed
SP=21 DP=1026
Data sent
SP=20 DP=1027
3
Data ACKed
4
SP=1027 DP=20
Active FTP
• Step 1: The client's command port contacts the server's FTP command port,
Destination port 21 (FTP), and Source port 1026, sending the command port of 1027
(N+1).
• Step 2: The server sends an ACK back to the client's command port, using Source port
21 (FTP) and Destination port 1026.
• Step 3: The server initiates a connection on its local data port, Source port 20 (FTP-
data), with the Destination port set to the FTP data port the client specified earlier as
the command port (N+1) of 1027.
• Step 4: The client sends ACKs back (windowing) with the Source port of 1027 and the
Destination port of 20 (FTP-data) .
Rick Graziani graziani@cabrillo.edu 58
For more on FTP…
inter E0
route-map Rerun permit 10
ip policy route-map Rerun
! Used when 172.16.1.1 is the client
match ip address 105
access-list 105 permit tcp 172.16.1.0 set ip next-hop 172.16.2.1
0.0.0.255 any eq ftp
! Used when 172.16.1.1 is the server route-map Rerun permit 20
access-list 105 permit tcp 172.16.1.0
0.0.0.255 eq ftp-data any
match ip address 106
access-list 106 permit tcp 172.16.1.0 set ip next-hop 172.16.3.1
0.0.0.255 eq telnet any
FTP Client
172.16.4.2/24
172.16.2.1/24
FTP Telnet
client Data sent
SP=20 DP=1027
Charlie
Data ACKed
172.16.1.1/24 172.16.1.2/24 SP=1027 DP=20
FTP Server
172.16.4.2/24
172.16.2.1/24
FTP Telnet
server Data sent
SP=20 DP=1027
Charlie
Data ACKed
172.16.1.1/24 172.16.1.2/24 SP=1027 DP=20
Both together:
172.16.6.1/24 172.16.7.1/24 172.16.8.1/24 (underline is checked)
inter E0 Client: SP=1026 DP=21
ip policy route-map Rerun
! Used when 172.16.1.1 is the client Server: SP= 20 DP=1027
1 access-list 105 permit tcp 172.16.1.0 0.0.0.255 route-map Rerun permit 10
any eq ftp
4 access-list 105 permit tcp 172.16.1.0 0.0.0.255 match ip address 105
any eq ftp-data
set ip next-hop 172.16.2.1
! Used when 172.16.1.1 is the server
3 access-list 105 permit tcp 172.16.1.0 0.0.0.255 eq
ftp-data any
route-map Rerun permit 20
2 access-list 105 permit tcp 172.16.1.0 0.0.0.255 eq
ftp any match ip address 106
access-list 106 permit tcp 172.16.1.0 0.0.0.255 eq set ip next-hop 172.16.3.1
telnet any
Rick Graziani graziani@cabrillo.edu 63
Jeff Doyle’s Peanuts Example
Single interface example – match length
Lucy
172.16.4.2/24
172.16.2.1/24
401-999
172.16.4.1/24 Schroeder
Linus 1000-1600
0 - 400
S0 172.16.4.3/24 E0
401-999
172.16.3.1/24
Pigpen
Charlie
172.16.1.1/24 172.16.1.2/24
Charlie
172.16.1.1/24 172.16.1.2/24
Schoeder
Any Questions?
• Passive Interfaces
• Route Filters
– Distribute Lists
• Policy Routing
– Route Maps
• Route Redistribution
– Multiple Routing Protocols
– Changing Administrative Distances
– Configuring Redistribution
– Default Metrics