< Free Open Study > |
9-2 network ip-address mask network-maskSyntax Description:
Defaults: None Limitations: Up to 200 instances of the network command may be used in the configuration. For Cisco IOS Software Release 12.0 and later, this restriction has been removed. Purpose: Interior Gateway Protocols such as RIP and OSPF use the network command to determine on which interfaces the protocol will be active. The BGP neighbor command is used to determine which interfaces will run BGP. The BGP network command is used to determine the networks that will be advertised to BGP neighbors. In order for a network to be advertised by BGP, it must be known to the originating router. Routes learned via EBGP are automatically advertised to other EBGP neighbors. A known network is one that is directly connected, static, or learned through a dynamic routing protocol. The first form of the network command requires a classful IP address. A classful address is either Class A with an 8-bit subnet mask, Class B with a 16-bit subnet mask, or Class C with a 24-bit subnet mask. The second form can be used with either a classful or classless prefix. Cisco IOS Software Release: 10.0 Configuration Example 1: Directly Connected NetworksFigure 9-1 illustrates a basic scenario for the use of the network command. Router A has two directly connected networks that are advertised to router B via BGP. Figure 9-1. Basic Use of the network Command
Router A interface loopback 0 ip address 172.16.1.1 255.255.255.0 ! interface loopback 1 ip address 192.16.1.1 255.255.255.0 ! router bgp 1 neighbor 10.1.1.2 remote-as 2 network 172.16.1.0 mask 255.255.255.0 network 192.16.1.0 ___________________________________________________________________________ Router B router bgp 2 neighbor 10.1.1.1 remote-as 1 Notice that the mask option was used with network 172.16.1.0. The classful address for this network is 172.16.0.0. Because we want to advertise a subnet of 172.16.0.0, the mask option is required. VerificationBefore using the network command, verify that the networks are in the IP routing table using the show ip route command: rtrA# show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default U - per-user static route, o - ODR, P - periodic downloaded static route T - traffic engineered route Gateway of last resort is not set 172.16.0.0/24 is subnetted, 1 subnets C 172.16.1.0 is directly connected, Loopback0 10.0.0.0/30 is subnetted, 1 subnets C 10.1.1.0 is directly connected, Serial0 C 192.16.1.0/24 is directly connected, Loopback1 The networks to be advertised are in the IP routing table. The next step is to add the network commands to the BGP router configuration and to verify that the networks are in the BGP routing table using the show ip bgp command: rtrA# show ip bgp BGP table version is 538, local router ID is 10.1.1.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 192.16.1.0 0.0.0.0 0 32768 i *> 172.16.1.0 0.0.0.0 0 32768 i Configuration Example 2: Aggregation Using Static RoutesA static route can be used to allow BGP to advertise any network prefix. Configuring a static route installs the static network in the local IP routing table. Any route in the IP routing table can be advertised by BGP using the network command. Of course, the router should advertise only networks that it can actually reach. The main use of static routes with BGP is to allow the advertisement of an aggregate address. Figure 9-2 shows an ISP that owns the range of Class C addresses from 192.16.0.x through 192.16.255.x. The network command could be used 256 times ”once for each Class C prefix ”or we could use a static route to create an aggregate prefix. Figure 9-2. Using a Static Route and the network Command to Advertise an Aggregate Prefix
Router A router bgp 1 neighbor 10.1.1.2 remote-as 2 ___________________________________________________________________________ Router B router bgp 2 neighbor 10.1.1.1 remote-as 1 network 192.16.0.0 mask 255.255.0.0 ! ip route 192.16.0.0 255.255.0.0 null 0 The optional mask parameter is needed because 192.16.0.0/16 is a supernet of the Class C address 192.16.0.0/24. The static route has the next hop as the interface null 0. Router B has more specific routes to networks contained in the range 192.16.0.x to 192.16.255.x. Assume that network 192.16.8.0 is down. Router A thinks that 192.16.8.0 is reachable because it is receiving the advertisement to 192.16.x.x from Router B. When Router B receives a packet destined for network 192.16.8.0, the route is looked up in the IP routing table. A specific match is not found, because the network is down. Router B tries to find a shorter match. It finds 192.16.x.x and instructs Router B to send the packet to null 0 or simply discard the packet. Prefixes can also be aggregated using the aggregate-address command, covered in Chapter 1, "Route Aggregation." VerificationBGP won't advertise the aggregate route unless it is in the IP routing table. As before, verify that the route is in the IP routing table and the BGP table: rtrB# show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default U - per-user static route, o - ODR, P - periodic downloaded static route T - traffic engineered route Gateway of last resort is not set 10.0.0.0/30 is subnetted, 2 subnets C 10.1.1.0 is directly connected, Serial0 S 192.16.0.0/16 is directly connected, Null0 __________________________________________________________________________ rtrB# show ip bgp BGP table version is 44, local router ID is 192.16.1.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 192.16.0.0/16 0.0.0.0 0 32768 i Troubleshooting
|
< Free Open Study > |