Monday, April 12, 2010

BGP synchronization

BGP Synchronization Rule
The BGP synchronization rule states that a BGP router should not use, or advertise to an external neighbor, a route learned by IBGP, unless that route is local or is learned from the IGP.

If synchronization is enabled and your autonomous system is passing traffic from one autonomous system to another, BGP should not advertise a route before all routers in your autonomous system have learned about the route via IGP. In other words, BGP and the IGP must be synchronized before networks learned from an IBGP neighbor can be used.

Routes redistribution and Administrative distance manipulation

I've seen the great example of problems with 2-way redistribution of routes between OSPF and RIP.
When we redistributing routes from RIP domain to OSPF on both P3R1 and P3R2, the curious thing happens. Let's say redistribution is configured on P3R1, then P3R2 will have only OSPF routes in it's routing table. The routes from RIP domain will have next-hop IP address on s0/0/0 interface of P3R1! Even loopback address on directly connected P3R4! This situation, of course, leads to suboptimal routing decisions.
One of the ways to fix the problem is to change administrative distance of OSPF routes learned via redistribution. We can rise the AD of these routes to make them appear less attractive then native RIP routes. In this way, native RIP routes will appear in the routing table instead of redistributed into OSPF routes.

hostname P3R2
!
router ospf 1
redistribute rip metric 10000 metric-type 1 subnets
network 172.31.0.0 0.0.255.255 area 0
distance 125 0.0.0.0 255.255.255.255 64
!
router rip
version 2
redistribute ospf 1 metric 5
network 10.0.0.0
no auto-summary
!
access-list 64 permit 10.3.1.0
access-list 64 permit 10.3.3.0
access-list 64 permit 10.3.2.0
access-list 64 permit 10.200.200.31
access-list 64 permit 10.200.200.32
access-list 64 permit 10.200.200.33
access-list 64 permit 10.200.200.34
Now the router will keep original AD of all native OSPF routes, except routes redistributed from OSPF(these routes will have AD of 125 > than native RIP routes).

The most important feature of using administrative distance to control route preference is that no path information is lost; in this example, the OSPF information is still in the OSPF database. If the primary path (via the RIP routes) is lost, the OSPF path reasserts itself, and the router maintains connectivity with those networks.

P.S. Routes must be in the routing table for them to be redistributed.

Saturday, April 10, 2010

BSCI Preparation

OSPF network types:
OSPF defaults to point-to-point mode on the point-to-point subinterface and to nonbroadcast mode on the multipoint subinterface.

LSA Type 3: Summary LSA
The ABR sends type 3 summary LSAs. A type 3 LSA advertises any networks owned by an area to the rest of the areas in the OSPF autonomous system.

LSA Type 4: Summary LSA
A type 4 summary LSA is used only when an ASBR exists within an area. A type 4 LSA identifies the ASBR and provides a route to it. The link-state ID is set to the ASBR’s router ID. When an ABR receives a type 1 LSA from an ASBR, it sends out a type 4 summary LSA to advertise the presence of the ASBR to other areas.

Summary LSAs do not, by default, contain summarized routes. Therefore, by default, all subnets in an area will be advertised.

LSA Type 5: External LSA
Type 5 external LSAs describe routes to networks outside the OSPF autonomous system. Type 5 LSAs are originated by the ASBR and are flooded to the entire autonomous system.

Route summarization on ABR:
area area-id range address mask [advertise | not-advertise] [cost cost]
Route summarization on ASBR:
summary-address ip-address mask [not-advertise] [tag tag]
Areas
To configure stub area - use area area-id stub router configuration command.
To configure totally stub area - use no-summary parameter to the area area-id stub command at the ABR only!
To configure NSSA area, area area-id nssa [no-redistribution] [default-informationoriginate] [metric metric-value] [metric-type type-value] [no-summary] command is used.
Configuring OSPF Virtual Links
area area-id virtual-link router-id
area-id parameter is a number of an area where router-id resides.
OSPF authentication:
interface Serial0/0/1
ip address 192.168.1.101 255.255.255.224
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 secretpass


EIGRP

Hello timer on fast links - 5 seconds, on slow link (
Hold timer X3 hello timer, by default. Doesn't reflect the change of hello timer.

To pass default route ip default-network network-number must be used

When you configure the ip default-network command and specify a subnet, a static route (the ip route command) is generated in the router’s configuration; This can be confusing when you want to remove the default network; the configuration must be removed with the no ip route command, not with the no ip default-network command.

Summarization (same as RIP)
ip summary-address eigrp as-number address mask [admin-distance] interface configuration command.
Authentication
ip authentication mode eigrp 100 md5
ip authentication key-chain eigrp 100 R1chain

Quote:
1. A remote router extends the query about a network only if it has an exact match in the routing table.
2. Stub routers are not queried. Instead, hub routers connected to the stub router answer the query on behalf of the stub router.

Stub routers.
To configure a router as an EIGRP stub, use the eigrp stub [receive-only | connected | static |summary] router configuration command. A router configured as a stub with this command shares information about connected and summary routes with all neighbor routers by default.
The connected keyword permits the EIGRP stub routing feature to send connected routes. If a network command does not include the connected routes, it might be necessary to redistribute connected routes with the redistribute connected command under the EIGRP process.
The static keyword permits the EIGRP stub routing feature to send static routes. Redistributing static routes with the redistribute static command is still necessary.

IS IS
Level 1 intra-area routing is based on system IDs;
The area address is used to route between areas; the system ID is not considered.
The system ID is used to route within an area; the area address is not considered.

Routers on a LAN establish adjacencies with all other routers on the LAN.

Criteria for DIS selection are, first, highest priority and second, highest SNPA (recall that on LANs the SNPA is the MAC address). Cisco router interfaces have a default L1 and L2 priority of 64.


LSPs on broadcast media (LANs) are sent as multicast, and LSPs on point-to-point links are sent
as unicast.

Routers calculate ES reachability with a partial route calculation (PRC), based on the L1 and L2 SPF trees.

Example:
R2(config)#router isis
R2(config-router)#net 49.0001.0000.0000.0002.00
R2(config-router)#is-type {level-1 | level-1-2 | level-2-only}
R2(config)#interface FastEthernet0/0
R2(config-if)#ip router isis
R2(config-if)#isis circuit-type level-1
R2(config)#interface serial 0/0/1
R2(config-if)#ip router isis
R2(config-if)#isis circuit-type level-2-only
R2(config-if)#isis metric 35 level-2

R2(config-router)#summary-address address mask [level-1 | level-2 | level-1-2] [tag tag-number] [metric metric-value] router configuration command.
The summary-address command works on all IS-IS routers (L1 and L2), but it will only summarize the external IS-IS L1 routes (routes that were redistributed into IS-IS L1).

Manipulating routing updates

Routes must be in the routing table for them to be redistributed.
The default-metric router configuration command establishes the seed metric for all redistributed routes. Cisco routers also allow the seed metric to be specified as part of the redistribute command, either with the metric option or by using a route map.

When redistributing routing information, set the seed metric to a value larger than the largest metric within the receiving autonomous system, to help prevent suboptimal routing and routing loops.

The redistribute Command for RIP (EIGRP is the same)
Use the redistribute protocol [process-id] [match route-type] [metric metric-value] [route-map map-tag] router configuration command to redistribute routes into RIP.
When redistributing into RIP, the default metric is infinity except when redistributing a static route (including a default static route defined using the ip route 0.0.0.0 0.0.0.0 command) or connected route. In that case, the default metric is 1.
When redistributing a static or connected route into EIGRP, the default metric is equal to the metric of the associated static or connected interface.
The redistribute Command for OSPF
Use the redistribute protocol [process-id] [metric metric-value] [metric-type type-value] [route-map map-tag] [subnets] [tag tag-value] router configuration command to redistribute routes into OSPF.
When redistributing into OSPF, the default metric is 20, the default metric type is 2, and subnets are not redistributed by default.

The redistribute Command for IS-IS
Use the redistribute protocol [process-id] [level level-value] [metric metric-value] [metric-type type-value] [route-map map-tag] router configuration command to redistribute routes into IS-IS.
By default, routes are introduced into IS-IS as Level 2, with a metric of 0.

Default Routes and Routing Protocols
The ip default-network command is used to distribute default route information to other routers. For RIP, this command provides no functionality for the router on which it is configured.

For example, EIGRP does not redistribute the 0.0.0.0 0.0.0.0 default route by default. However, if the network 0.0.0.0 command is added to the EIGRP configuration, it redistributes a default route as a result of the ip route 0.0.0.0 0.0.0.0 interface command (but not as a result of the ip route 0.0.0.0 0.0.0.0 address or ip default-network commands).


Distribute Lists
(config-router)#distribute-list 7 out Serial0/0/0
!
access-list 7 permit 172.16.0.0 0.0.255.255
Route Maps
1. Only one condition listed on the same match statement must match for the entire statement to be considered a match.
2. However, all match statements within a route map statement must match for the route map to be considered matched.

BGP
BGP specifies that a BGP router can advertise to its peers in neighboring autonomous systems only those routes that it uses. This rule reflects the hop-by-hop routing paradigm generally used throughout the current Internet.
BGP does not let one AS send traffic to a neighboring AS, intending that the traffic take a different route from that taken by traffic originating in the neighboring AS.

To avoid routing loops within an AS, BGP specifies that routes learned through IBGP are never propagated to other IBGP peers.
By fully meshing all IBGP neighbors, when a change is received from an external AS, the BGP router for the local AS is responsible for informing all other IBGP neighbors of the change. IBGP neighbors that receive this update do not send it to any other IBGP neighbor, because they assume that the sending IBGP neighbor is fully meshed with all other IBGP speakers and has sent each IBGP neighbor the update.

The BGP synchronization rule states that a BGP router should not use, or advertise to an external
neighbor, a route learned by IBGP, unless that route is local or is learned from the IGP.

BGP sends BGP/TCP keepalives by default every 60 seconds.
The default hold time is 180 seconds.

BGP defines the following message types:
■ Open
■ Keepalive
■ Update
■ Notification

The attributes defined by BGP include the following:
■ Well-known mandatory attributes:
— AS-path
— Next hop
— Origin
■ Well-known discretionary attributes:
— Local preference
— Atomic aggregate
■ Optional transitive attributes:
— Aggregator
— Community
■ Optional nontransitive attribute:
— Multiexit-discriminator (MED)
In addition, Cisco has defined a weight attribute for BGP. The weight is configured locally on a router and is not propagated to any other BGP routers.

BGP Path Selection
0. Synchronized
1. Weight
2. Local Preference
3. Self Originated
4. AS-Path
5. Origin
6. MED
7. External (eBGP>iBGP)
8. IGP Cost
9. eBGP peering (oldest)
10. RID

EBGP Next Hop
For EBGP, the next hop is the IP address of the neighbor that sent the update.
IBGP Next Hop
For IBGP, the protocol states that the next hop advertised by EBGP should be carried into IBGP. It is very important, therefore, that Router C knows how to reach the subnet, advertised via IBGP as next-hop, either via an IGP or a static route; otherwise, it will drop packets because it will not be able to get to the next-hop address for that network. The IBGP neighboring router performs a recursive lookup to find out how to reach the BGP next-hop address by using its IGP entries in the routing table.

The MED indicates to external neighbors the preferred path into an AS. This is a dynamic way for an AS to try to influence another AS as to which way it should choose to reach a certain route if there are multiple entry points into the AS.
Unlike local preference, the MED is exchanged between autonomous systems. The MED is sent to EBGP peers; those routers propagate the MED within their AS, and the routers within the AS use the MED, but do not pass it on to the next AS.

Paths that the router originates have a weight of 32768 by default, and other paths have a weight of 0 by default.

Network command
The BGP network command determines which networks this router advertises. The list of network commands must include all networks in your AS that you want to advertise, not just those locally connected to your router. Note that the prefix must exactly match (address and mask) an entry in the IP routing table.
 If you configure network 192.168.0.0 mask 255.255.0.0 to advertise a CIDR block, BGP looks for 192.168.0.0/16 in the routing table. It might find 192.168.1.0/24 or 192.168.1.1/32; however, if it never finds 192.168.0.0/16, BGP does not announce the 192.168.0.0/16 network to any neighbors. In this case, you can configure the static route ip route 192.168.0.0 255.255.0.0 null0 toward the null interface so that BGP can find an exact match in the routing table.

Example:
router bgp 65000
neighbor 10.1.1.2 remote-as 64520
neighbor 192.168.2.2 remote-as 65000
neighbor 192.168.2.2 update-source loopback 0
neighbor 192.168.2.2 next-hop-self
network 172.16.10.0 mask 255.255.255.0
network 192.168.1.0
network 192.168.3.0

Example2. Influencing traffic entrance to AS:

neighbor 192.168.28.1 route-map med_65004 out
!
route-map med_65004 permit 10
match ip address 66
set metric 100
route-map med_65004 permit 100
set metric 200

Example3 Influencing outbound traffic:
neighbor 192.168.28.1 remote-as 65002
neighbor 192.168.28.1 route-map local_pref in
!
route-map local_pref permit 10
match ip address 65
set local-preference 400
!
route-map local_pref permit 20
!
access-list 65 permit 172.30.0.0 0.0.255.255


Configuring Weight
neighbor {ip-address | peer-group-name} weight weight router configuration command.
Local Preference
Router(config-router)# bgp default local-preference value
MED
Router(config-router)# default-metric value



Multicast

Link-local addresses (224.0.0.0/24);
Source-specific multicast (232.0.0.0/8);
GLOP (233.0.0.0/8);
Administratively scoped addresses (239.0.0.0/8) - private;
Globally scoped addresses (224.0.1.0–231.255.255.255 and 234.0.0.0–238.255.255.255)

IGMP
ip igmp snooping
ip igmp version {1 | 2 | 3}


ip multicast-routing global configuration command
ip pim sparse-dense-mode interface configuration command
ip pim send-rp-announce interface type scope ttl group-list access-list global configuration command on a router that you want to be an RP.
ip igmp join-group group-address interface configuration command. With this command, the router joins the specified group; the router accepts multicast packets in addition to forwarding them.
ip igmp static-group group-address interface configuration command. With this command, the router itself is a statically connected member of the group. The router does not accept the group’s packets itself, but only forwards them.