BGP基本配置(H3C)
BGP基本实验
一.实验拓扑图
二 实验步骤
bgp 30router-id 1.1.1.1peer 10.0.1.6 as-nupeer 10.0.1.6 as-number 10net 10.0.1.4 ?INTEGER<0-32>Mask length of the IP addressX.X.X.X Specify an ipv4 network maskroute-policy Specify a route policyshort-cut Specify a short-cut route<cr>
net 10.0.1.4 255.255.255.252net 1.1.1.1 255.255.255.255net 10.30.1.1 32peer 10.0.1.2 as-num 40net 10.0.1.0 255.255.255.252
bgp 40router-id 4.4.4.4peer 10.0.1.1 as-num 30peer 10.0.1.%Aug 28 20:57:25:344 2012 R4 RM/3/RMLOG: BGP.: 10.0.1.1 State is changed from OPENCONFIRM to ESTABLISHED.10 as-num 10net 10.0.1.0 30net 10.0.1.8 30net 4.4.4.4 32net 10.40.4.1 32
bgp 10router-id 2.2.2.2peer 10.0.1.5 as-num 30net 2.2.2.2 32net 10.0.1.5%Aug 28 21:00:23:218 2012 R2 RM/3/RMLOG: BGP.: 10.0.1.5 State is changed from OPENCONFIRM to ESTABLISHED.
undo net 10.0.1.5net 10.0.1.4 30undo net 2.2.2.2 32undo net 10.0.1.4 30peer 3.3.3.3 as-num 10peer 3.3.3.3 connect-int lo0peer 3.3.3.3 next-hop-local default-route-advertisequiip route 0.0.0.0 0.0.0.0 10.0.1.5
bgp 10router-id 3.3.3.3peer 10.0.1.9 as-num 40peer 2.2.2.2 as-num %Aug 28 21:12:13:828 2012 R3 RM/3/RMLOG: BGP.: 10.0.1.9 State is changed from OPENCONFIRM to ESTABLISHED.10 ^ % Unrecognized command found at '^' position.peer 2.2.2.2 as-num 10peer 2.2.2.2 connect-int lo0peer 2.2.2.2 next-hop-local%Aug 28 21:18:58:859 2012 R3 RM/3/RMLOG: BGP.: 2.2.2.2 State is changed from OPENCONFIRM to ESTABLISHED.
default-route-advertise quiip rout 0.0.0.0 0.0.0.0 10.0.1.9
R2上要配上一条指向外部的缺省静态路由,再配下发缺省的LSA,这样做当指向外部的链路down了,R2就不会下发缺省的LSA下去了R3同样
EBGP 之间:R1和R2之间建立BGP邻居时如果用loopback接口,就需要配两个方向的静态路由,还要改TTL值,因为EBGP之间的默认TTL是1,即1跳IBGP之间:R2和R3之间就不用这样,因为有IGP路由(OSPF)TTL值最大是255
为什么IBGP之间用loopback接口建立邻居,更可靠,防止物理端口down,物理端口down了就建立不起邻居了。而EBGP之间也可以用loopback接口,只是太麻烦了。
<R2>dis bgp rou
Total Number of Routes: 7
BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped, h - history,i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Network NextHop MED LocPrf PrefVal Path/Ogn
*>1.1.1.1/32 10.0.1.5 0 0 30i *>4.4.4.4/32 10.0.1.5 0 30 40i *>10.0.1.0/30 10.0.1.5 0 0 30i * 10.0.1.4/30 10.0.1.5 0 0 30i * 10.0.1.8/30 10.0.1.5 0 30 40i *>10.30.1.1/32 10.0.1.5 0 0 30i *>10.40.4.1/32 10.0.1.5 0 30 40i
<R2>dis ip routRouting Tables: Public Destinations : 22 Routes : 22
Destination/Mask ProtoPreCost NextHop Interface
0.0.0.0/0 Static 60 0 10.0.1.5 Eth0/1/01.1.1.1/32 BGP 2550 10.0.1.5 Eth0/1/02.2.2.2/32 Direct 0 0 127.0.0.1 InLoop03.3.3.3/32 OSPF 10 30 10.0.1.18 Eth0/1/24.4.4.4/32 BGP 2550 10.0.1.5 Eth0/1/05.5.5.5/32 OSPF 10 10 10.0.1.18 Eth0/1/26.6.6.6/32 OSPF 10 20 10.0.1.18 Eth0/1/210.0.1.0/30 BGP 2550 10.0.1.5 Eth0/1/010.0.1.4/30 Direct 0 0 10.0.1.6 Eth0/1/010.0.1.6/32 Direct 0 0 127.0.0.1 InLoop010.0.1.8/30 OSPF 10 40 10.0.1.18 Eth0/1/210.0.1.12/30 Direct 0 0 10.0.1.13 S0/2/010.0.1.13/32 Direct 0 0 127.0.0.1 InLoop010.0.1.14/32 Direct 0 0 10.0.1.14 S0/2/010.0.1.16/30 Direct 0 0 10.0.1.17 Eth0/1/210.0.1.17/32 Direct 0 0 127.0.0.1 InLoop010.0.1.20/30 OSPF 10 30 10.0.1.18 Eth0/1/210.0.1.24/30 OSPF 10 20 10.0.1.18 Eth0/1/210.30.1.1/32 BGP 2550 10.0.1.5 Eth0/1/010.40.4.1/32 BGP 2550 10.0.1.5 Eth0/1/0127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
<R2>tra -a 2.2.2.2 3.3.3.3 traceroute to 3.3.3.3(3.3.3.3) 30 hops max,40 bytes packet, press CTRL_C to break 110.0.1.18 4 ms 20 ms 15 ms 210.0.1.26 15 ms 10 ms 20 ms 33.3.3.3 30 ms 20 ms 10 ms
学会通过路由表分析,看是否有目标网段的路由,逐段排查。
<R5>dis ip routRouting Tables: Public Destinations : 16 Routes : 16
Destination/Mask ProtoPreCost NextHop Interface
0.0.0.0/0 O_ASE1501 10.0.1.17 Eth0/1/02.2.2.2/32 OSPF 10 10 10.0.1.17 Eth0/1/03.3.3.3/32 OSPF 10 20 10.0.1.26 Eth0/1/25.5.5.5/32 Direct 0 0 127.0.0.1 InLoop06.6.6.6/32 OSPF 10 10 10.0.1.26 Eth0/1/210.0.1.4/30 OSPF 10 20 10.0.1.17 Eth0/1/010.0.1.8/30 OSPF 10 30 10.0.1.26 Eth0/1/210.0.1.12/30 OSPF 10 1572 10.0.1.17 Eth0/1/010.0.1.16/30 Direct 0 0 10.0.1.18 Eth0/1/010.0.1.18/32 Direct 0 0 127.0.0.1 InLoop010.0.1.20/30 OSPF 10 20 10.0.1.26 Eth0/1/210.0.1.24/30 Direct 0 0 10.0.1.25 Eth0/1/210.0.1.25/32 Direct 0 0 127.0.0.1 InLoop010.10.5.1/32 Direct 0 0 127.0.0.1 InLoop0127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
dis ip routRouting Tables: Public Destinations : 16 Routes : 16
Destination/Mask ProtoPreCost NextHop Interface
0.0.0.0/0 O_ASE1501 10.0.1.21 Eth0/1/12.2.2.2/32 OSPF 10 20 10.0.1.25 Eth0/1/03.3.3.3/32 OSPF 10 10 10.0.1.21 Eth0/1/15.5.5.5/32 OSPF 10 10 10.0.1.25 Eth0/1/06.6.6.6/32 Direct 0 0 127.0.0.1 InLoop010.0.1.4/30 OSPF 10 30 10.0.1.25 Eth0/1/010.0.1.8/30 OSPF 10 20 10.0.1.21 Eth0/1/110.0.1.12/30 OSPF 10 1572 10.0.1.21 Eth0/1/110.0.1.16/30 OSPF 10 20 10.0.1.25 Eth0/1/010.0.1.20/30 Direct 0 0 10.0.1.22 Eth0/1/110.0.1.22/32 Direct 0 0 127.0.0.1 InLoop010.0.1.24/30 Direct 0 0 10.0.1.26 Eth0/1/010.0.1.26/32 Direct 0 0 127.0.0.1 InLoop010.10.6.1/32 Direct 0 0 127.0.0.1 InLoop0127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
注意R5,R6没有外部的明细路由,只有到外部的缺省路由,因为他们不是IBGP dis bgp rout
<R5> dis bgp rout<R5>
<R1>dis ip routRouting Tables: Public Destinations : 11 Routes : 11
Destination/Mask ProtoPreCost NextHop Interface
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop04.4.4.4/32 BGP 2550 10.0.1.2 Eth0/1/210.0.1.0/30 Direct 0 0 10.0.1.1 Eth0/1/210.0.1.1/32 Direct 0 0 127.0.0.1 InLoop010.0.1.4/30 Direct 0 0 10.0.1.5 Eth0/1/010.0.1.5/32 Direct 0 0 127.0.0.1 InLoop010.0.1.8/30 BGP 2550 10.0.1.2 Eth0/1/210.30.1.1/32 Direct 0 0 127.0.0.1 InLoop010.40.4.1/32 BGP 2550 10.0.1.2 Eth0/1/2127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
<R1> dis bgp rout
Total Number of Routes: 10
BGP Local router ID is 1.1.1.1 Status codes: * - valid, > - best, d - damped, h - history,i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Network NextHop MED LocPrf PrefVal Path/Ogn
*>1.1.1.1/32 0.0.0.0 0 0 i *>4.4.4.4/32 10.0.1.2 0 0 40i * 10.0.1.6 0 10 40i *>10.0.1.0/30 0.0.0.0 0 0 i * 10.0.1.2 0 0 40i *>10.0.1.4/30 0.0.0.0 0 0 i *>10.0.1.8/30 10.0.1.2 0 0 40i *>10.30.1.1/32 0.0.0.0 0 0 i *>10.40.4.1/32 10.0.1.2 0 0 40i * 10.0.1.6 0 10 40i
R1到4.4.4.4的路由选择下一跳是10.0.1.2是由于开销
<R2>dis ip routRouting Tables: Public Destinations : 23 Routes : 23
Destination/Mask ProtoPreCost NextHop Interface
0.0.0.0/0 Static 60 0 10.0.1.5 Eth0/1/01.1.1.1/32 BGP 2550 10.0.1.5 Eth0/1/02.2.2.2/32 Direct 0 0 127.0.0.1 InLoop03.3.3.3/32 OSPF 10 30 10.0.1.18 Eth0/1/24.4.4.4/32 BGP 2550 3.3.3.3 Eth0/1/25.5.5.5/32 OSPF 10 10 10.0.1.18 Eth0/1/26.6.6.6/32 OSPF 10 20 10.0.1.18 Eth0/1/210.0.1.0/30 BGP 2550 10.0.1.5 Eth0/1/010.0.1.4/30 Direct 0 0 10.0.1.6 Eth0/1/010.0.1.6/32 Direct 0 0 127.0.0.1 InLoop010.0.1.8/30 OSPF 10 40 10.0.1.18 Eth0/1/210.0.1.12/30 Direct 0 0 10.0.1.13 S0/2/010.0.1.13/32 Direct 0 0 127.0.0.1 InLoop010.0.1.14/32 Direct 0 0 10.0.1.14 S0/2/010.0.1.16/30 Direct 0 0 10.0.1.17 Eth0/1/210.0.1.17/32 Direct 0 0 127.0.0.1 InLoop010.0.1.20/30 OSPF 10 30 10.0.1.18 Eth0/1/210.0.1.24/30 OSPF 10 20 10.0.1.18 Eth0/1/210.10.6.1/32 OSPF 10 20 10.0.1.18 Eth0/1/210.30.1.1/32 BGP 2550 10.0.1.5 Eth0/1/010.40.4.1/32 BGP 2550 3.3.3.3 Eth0/1/2127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
<R2>dis bgprout
Total Number of Routes: 10
BGP Local router ID is 2.2.2.2 Status codes: * - valid, > - best, d - damped, h - history,i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Network NextHop MED LocPrf PrefVal Path/Ogn
*>1.1.1.1/32 10.0.1.5 0 0 30i *>i 4.4.4.4/32 3.3.3.3 0 100 0 40i * 10.0.1.5 0 30 40i *>10.0.1.0/30 10.0.1.5 0 0 30i * i 3.3.3.3 0 100 0 40i * 10.0.1.4/30 10.0.1.5 0 0 30i * 10.0.1.8/30 10.0.1.5 0 30 40i *>10.30.1.1/32 10.0.1.5 0 0 30i *>i 10.40.4.1/32 3.3.3.3 0 100 0 40i * 10.0.1.5 0 30 40i 我真想亲口管你爷爷叫声:爹! 恐龙说:“遇到色狼,不慌不忙;遇到禽兽,慢慢享受……” 花前月下,不如花钱“日”下!*^_^* 啥时硬件也可以COPY就好了! 佛曰,色即是空,空即是色!今晚,偶想空一下 睡眠是一门艺术——谁也无法阻挡我追求艺术的脚步!
页:
[1]