Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Anura Abayaratne
MTT Network - Sri Lanka
anuraa@iee.org
APRICOT 2006
22nd Feb 3rd Mar 2006
Perth Western Australia
Agenda
Overview
Installation
Basic
commands
Setting up BGP
Filtering
+ Daemon
Server
Router
APRICOT 2006 - Perth Western A
Routing daemons
Low-cost solution
Expertise required for set-up
Lack of support
Commercial routers
Pricy
Better performance
Fully supported
APRICOT 2006 - Perth Western A
Routing Daemons
Zebra
http://www.zebra.org
First daemon
Wide support: RIP,OSPF,BGP
Certain Vulnerabilities
Quagga
http://www.quagga.net
Based on Zebra
Wide support:
RIP,OSPF,BGP,ISIS
Development libraries
Overview
Overview
About Zebra
ripd
bgpd
zebra
10
Supported Platform
Linux
11
12
Installation
Steps
There
First
gzip d zebra-0.95a.tar.gz
tar xvf zebra-0.95a.tar
cd zebra-0.95a
APRICOT 2006 - Perth Western A
14
-prefix=/home/zebra
%./configure disable-ripd
APRICOT 2006 - Perth Western A
15
16
17
18
# zebra vty
# RIPd vty
# RIPngd vty
# OSPFd vty
# BGPd vty
# OSPF6d vty
19
Basic Commands
Config Commands
21
22
23
24
25
26
27
28
29
-b, --batch
Runs in batch mode
-d, --daemon
Runs in daemon mode
-f, --config_file Set configuration file name
-i, --pid_file
Set process identifier file name
-k, --keep_kernel Don't delete old routes which installed by zebra.
-l, --log_mode
Set verbose log mode flag
-A, --vty_addr
Set vty's bind address
-P, --vty_port
Set vty's port number
-r, --retain
When program terminates, retain added route by zebra.
-v, --version
Print program version
-h, --help
Display this help and exit
Example: /home/zebra/sbin/zebra -d
30
31
VTY Overview
32
VTY Modes
Three VTY modes
VTY View Mode : Read-Only access
to the CLI
VTY Enable mode : Read-write
access to the CLI
VTY Other modes
33
Zebra Daemon
Interface Commands
interface ifname
shutdown , no shutdown up or down the
current interface
ip address address (e.g. 10.0.0.1/8)
description description
multicast , no multicast - Enable or
disable multicast flag for the interface
bandwidth <1-10000000> Bandwidth in kilobits
no bandwidth <1-10000000>
35
Example
Router> enable
Password: XXXXX
Router# configure terminal
Router(config)# interface eth0
Router(config-if)# ip address 10.0.1.2/24
Router(config-if)# no ip address 10.0.2.2/24
Router(config-if)#end
Router#exit
36
37
Static Route C
38
39
BGP
Border Gateway Protocol
Introduction to BGP
Routing
41
Autonomous System
AS100
42
43
Starting BGP
Default
44
BGP
Add the address to be announced
Add the address and AS numbers of
neighboring routers (peers)
Apply policy with BGP
Allow only the routes that originate here
to be announced to the neighboring AS
Announced routes
Receiving routes
APRICOT 2006 - Perth Western A
45
BGP Router
46
Configuration example
bgpd
AS100
bgpd
B
AS200
47
RouterA#configure terminal
RouterA(config)#router bgp 100
RouterA(config-router)#bgp router-id 172.16.1.1
APRICOT 2006 - Perth Western A
48
BGP
Add the address to be announced
Add the address and AS numbers of
neighboring routers (peers)
Apply policy with BGP
Allow only the routes that originate here
to be announced to the neighboring AS
Announced routes
Receiving routes
APRICOT 2006 - Perth Western A
49
network A.B.C.D/M
router bgp 100
network 10.1.0.0/16
no network 172.16.0.0/16
APRICOT 2006 - Perth Western A
50
Configuration example
bgpd
AS100
bgpd
B
AS200
RouterA#configure terminal
RouterA(config)#router bgp 100
RouterA(config-router)# network 10.1.0.0/16
RouterA(config-router)#end
RouterA#exit
51
Redistribute to BGP
redistribute kernel
Redistribute kernel route to BGP process.
redistribute static
Redistribute static route to BGP process.
redistribute connected
Redistribute connected route to BGP process.
redistribute rip
Redistribute RIP route to BGP process.
redistribute ospf
Redistribute OSPF route to BGP process.
APRICOT 2006 - Perth Western A
52
Configuration example
router bgp 100
network 10.1.0.0/16
redistribute static
redistribute connected
neighbor 192.168.8.140 remote-as 200
53
BGP
Add the address to be announced
Add the address and AS numbers of
neighboring routers (peers)
Apply policy with BGP
Allow only the routes that originate here
to be announced to the neighboring AS
Announced routes
Receiving routes
APRICOT 2006 - Perth Western A
54
BGP Peers
neighbor
55
Configuration example
bgpd
AS100
bgpd
B
AS200
RouterA#configure terminal
RouterA(config)#router bgp 100
RouterA(config-router)#neighbor 192.168.8.140
remote-as 200
RouterA(config-router)# network 10.1.0.0/16
RouterA(config-router)#end
Display commands-
56
Configuration example
RouterA#show ip bgp summary
Neighbor
V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.8.140 4 200
99
113
0
0
0
00:03:30
1
Total number of neighbors 1
57
58
59
Configuration example
bgpd
AS100
bgpd
B
AS200
RouterA#configure terminal
RouterA(config)#router bgp 100
RouterA(config-router)#neighbor 192.168.8.140 remote-as
200
RouterA(config-router)#neighbor 192.168.8.140
description eBGP to RouterB
RouterA(config-router)#neighbor 192.168.8.140 version
4
RouterA(config-router)#neighbor 192.168.8.140
shutdown
RouterA(config-router)# network 10.1.0.0/16
APRICOT 2006 - Perth Western A
60
61
peer send-community
neighbor peer weight weight
specifies a default weight value for the
neighbors routes. Local to the router
Higher weight wins
62
Configuration example
bgpd
AS100
bgpd
B
AS200
RouterA#
router bgp 100
network 10.1.0.0/16
neighbor 192.168.8.140 remote-as 200
neighbor 192.168.8.140 update-source ehternet0
neighbor 192.168.8.140 default-originate
neighbor 192.168.8.140 send-community
neighbor 192.168.8.140 weight 50
To apply changes :
clear ip bgp 192.168.8.140 out
RouterB#show ip route bgp
RouterB#show ip
route 2006 - Perth Western A
APRICOT
RouterB#show ip bgp
63
Configuration example
RouterB#
Network
*> 0.0.0.0
*> 10.1.0.0/16
show ip bgp
Next Hop
192.168.8.139
192.168.8.139
0 100 i
0 100 i
64
BGP
Add the address to be announced
Add the address and AS numbers of
neighboring routers (peers)
Apply policy with BGP
Allow only the routes that originate here
to be announced to the neighboring AS
Announced routes
Receiving routes
APRICOT 2006 - Perth Western A
65
Policy Control
Policy based on AS path, community and
prefixes
Rejecting, accepting selected routes
Set attribute to influence path selection
66
67
Prefix List
ip prefix-list provides the most powerful
prefix based filtering mechanism.
add or delete prefix based filters to
arbitrary points of prefix-list using
sequential number specification.
If no ip prefix-list is specified, it acts as
permit. If ip prefix-list is defined, and no
match is found, default deny is applied.
68
show ip prefix-list
69
Configuration example
RouterA
router bgp 100
network 10.1.0.0/16
neighbor 192.168.8.140 remote-as 200
neighbor 192.168.8.140 prefix-list PEER-IN in
neighbor 192.168.8.140 prefix-list PEER-OUT out
ip prefix-list PEER-IN deny 172.16.2.0/24
ip prefix-list PEER-IN permit 0.0.0.0/0 le 32
ip prefix-list PEER-OUT permit 10.1.0.0/16
To apply changes :
clear ip bgp 192.168.8.140 in
clear ip bgp 192.168.8.140 out
A>show ip bgp summary
B>show ip bgp
B>Show ip route bgp
A>show ip bgp neighbors <peerIPAddress> advertisedroutes
APRICOT 2006 - Perth Western A
70
Filter List
Filter
71
Configuration example
router bgp 100
network 10.1.0.0/16
neighbor 192.168.8.140 remote-as 200
neighbor 192.168.8.140 filter-list 6 in
neighbor 192.168.8.140 filter-list 5 out
ip as-path access-list 5 permit ^100$
ip as-path access-list 6 permit ^200$
To apply the changes
clear ip bgp 192.168.8.140 in
clear ip bgp 192.168.8.140 out
A>show ip bgp summary
B>show ip bgp
B>Show ip route bgp
A>show ip bgp neighbors <peerIPAddress> advertisedroutes
APRICOT 2006 - Perth Western A
B>show ip bgp neighbors <peerIPAddress> routes
72
Regular Expressions
73
Examples
.* match anything
.+ match at least one character
^$ match routes local to this AS
_100$ originated by AS100
^100_ received from AS100
_100_ via AS100
_200_100_ via AS100 and AS200
_(100_)+ multiple AS100 in sequence
(used to match AS-PATH prepends)
_\(65530\)_ via AS65530 (confederations)
APRICOT 2006 - Perth Western A
74
75
Example
ip
76
Route Maps
Route
77
78
79
80
81
82
83
aggregate-address A.B.C.D/M
This command specifies an aggregate address.
no aggregate-address A.B.C.D/M
aggregate-address A.B.C.D/M summaryonly
84
BGP
Add the address to be announced
Add the address and AS numbers of
neighboring routers (peers)
Apply policy with BGP
Allow only the routes that originate here
to be announced to the neighboring AS
Announced routes
Receiving routes
APRICOT 2006 - Perth Western A
85
Example Network
AS400
AS300
AS200 C
192.168.1.2
B
192.168.2.2
10.2.0.0/16
10.2.0.0/16
192.168.1.1
192.168.2.1
AS100
10.1.0.0/16
86
AS400
AS200 C
192.168.1.2
10.2.0.0/16
10.2.0.0/16
192.168.1.1
RouterA
192.168.2.1
AS100
10.1.0.0/16
remote-as 200
prefix-list PEERC-OUT out
remote-as 300
prefix-list PEERB-OUT out
route-map set-as-path out
AS300
B
192.168.2.2
RouterC
RouterB
87
88
Route Refresh
Peer IP address/ASN
89
90
Soft Reconfiguration
91
92
93
Configuration example
(Without peer groups)
ip
ip
ip
ip
ip
network 10.1.0.0/16
neighbor 192.168.8.140
neighbor 192.168.8.140
neighbor 192.168.8.140
neighbor 192.168.8.140
neighbor 192.168.8.140
remote-as 200
prefix-list PEER-IN in
prefix-list PEER-OUT out
filter-list 6 in
filter-list 5 out
neighbor
neighbor
neighbor
neighbor
neighbor
remote-as 150
prefix-list PEER-IN in
prefix-list PEER-OUT out
filter-list 6 in
filter-list 5 out
192.168.8.150
192.168.8.150
192.168.8.150
192.168.8.150
192.168.8.150
94
Configuration example
(With peer groups)
95
96
show ip
show ip
show ip
show ip
show ip
routes
show ip
bgp summary
bgp
bgp A.B.C.D
route bgp
bgp neighbors <peerIPAddr> advertisedbgp neighbors <peerIPAddr> routes
APRICOT 2006 - Perth Western A
97
Route Server
At an Internet Exchange point, many ISPs
are connected to each other by external
BGP peering. Normally these external BGP
connection are done by full mesh method.
As with internal BGP full mesh formation,
this method has a scaling problem.
Route Server is a method to resolve the
problem.
Each ISPs BGP router only peers to Route
Server.
Route Server serves as BGP information
exchange to other BGP routers.
98
several
99
Multiple instance
100
10.0.0.1 remote-as 1
neighbor 10.0.0.1 send-community
101
Example
RouterA#configure terminal
RouterA(config)# bgp multiple-instance
RouterA(config)# bgp config-type cisco
RouterA(config)# Ctrl Z
RouterA#
102
BGP Views
2
3
4
5
103
You can setup different AS at the same time when BGP multiple
instance feature is enabled.
router bgp as-number
Make a new BGP instance. You can use arbitrary word for the name.
bgp multiple-instance
!
router bgp 1
neighbor 10.0.0.1 remote-as 2
neighbor 10.0.0.2 remote-as 3
!
router bgp 2
neighbor 10.0.0.3 remote-as 4
neighbor 10.0.0.4 remote-as 5
104
Routing policy
You can set different routing policy for a peer. For example, you can set
different filter for a peer.
bgp multiple-instance
!
router bgp 1 view 1
neighbor 10.0.0.1 remote-as 2
neighbor 10.0.0.1 distribute-list 1 in
!
router bgp 1 view 2
neighbor 10.0.0.1 remote-as 2
neighbor 10.0.0.1 distribute-list 2 in
access-list 1 permit 192.168.1.0 0.0.0.255
access-list 2 permit 192.168.2.0 0.0.0.255
This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and
view 2. When the update is inserted into view 1, distribute-list 1 is applied.
On the other hand, when the update is inserted into view 2, distribute-list 2
is applied.
105
106
Filtering
Tools
IP
Access List
IP Prefix List
Route Map
108
IP Access List
access-list name permit ipv4-network
access-list name deny ipv4-network
Basic filtering is done by access-list as
shown in the following example.
109
APRICOT 2006
22nd Feb 3rd Mar 2006
Perth Western Australia