组网需求
- 某公司两个分部之间通过BGP实现网络互通
- 在两个分部都部署IPv6网络进行测试,需要部署BGP4+实现IPv6网络互通
组网拓扑
配置思路
- 配置路由器基本功能以及各个接口IPv4地址
- 配置BGP路由协议,包括:建立EBGP对等体,IPv4单播地址族使能EBGP对等体,宣告路由
- 配置全局使能IPv6以及各个接口IPv6地址
- 配置BGP路由协议,包括:建立EBGP对等体,IPv6单播地址族使能EBGP对等体,宣告路由
配置命令
配置路由器基本功能以及各个接口IPv4地址
R1配置
1
2
3
4
5
6
7sys
sys R1
int g0/0/0
ip add 10.1.12.1 30
int LoopBack 0
ip add 10.1.1.1 32
R2配置
1
2
3
4
5
6
7sys
sys R2
int g0/0/0
ip add 10.1.12.2 30
int LoopBack 0
ip add 10.1.2.2 32
配置BGP路由协议,包括:建立EBGP对等体,IPv4单播地址族使能EBGP对等体,宣告路由
R1配置
1
2
3
4
5
6sys
bgp 65001
peer 10.1.12.2 as-number 65002
ipv4-family unicast
peer 10.1.12.2 enable
network 10.1.1.1 32
R2配置
1
2
3
4
5
6sys
bgp 65001
peer 10.1.12.1 as-numner 65001
ipv4-family unicast
peer 10.1.12.1 enable
network 10.1.2.2 32
配置全局使能IPv6,各个接口配置IPv6地址
R1配置
1
2
3
4
5
6
7
8
9
10
11
12sys
ipv6
int g0/0/0
ipv6 enable
ipv6 address auto link-local
ipv6 address 2001:db8:2345:12::1/64
int LoopBack 0
ipv6 enable
ipv6 address auto link-local
ipv6 address 2001:db8:2345:1::1/128
R2配置
1
2
3
4
5
6
7
8
9
10
11
12sys
ipv6
int g0/0/0
ipv6 enable
ipv6 address auto link-local
ip6 address 2001:db8:2345:12::2/64
int LoopBack 0
ipv6 enable
ipv6 address auto lunk-local
ipv6 address 2001:db8:2345:2::2/64
配置BGP路由协议,包括:建立EBGP对等体,IPv6单播地址族使能EBGP对等体,宣告路由
R1配置
1
2
3
4
5
6sys
bgp 65001
peer 2001:db8:2345:12::2 ad-number 65002
ipv6-family unicast
peer 2001:db8:2345:12::2 enable
network 2001:db8:2345:1::1 128
R2配置
1
2
3
4
5
6sys
bgp 65002
peer 2001:db8:2345:12::1 as-number 65001
ipv6-family unicast
peer 2001:db8:2345:12::1 enable
network 2001:db8:2345:2::2 128
查看结果
IPv4网络查看结果
查看BGP邻居(对等体)
1
2
3
4
5
6
7
8
9
10
11
12
13display bgp peer
<R1>display bgp peer
BGP local router ID : 10.1.1.1
Local AS number : 65001
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
10.1.12.2 4 65002 69 70 0 01:06:36 Established
1
查看BGP路由表
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15display bgp routing-table
<R1>display bgp routing-table
BGP Local router ID is 10.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 10.1.1.1/32 0.0.0.0 0 0 i
*> 10.1.2.2/32 10.1.12.2 0 0 65002i
IPv6网络查看结果
查看BGP4+邻居(对等体)信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14display bgp ipv6 peer
<R1>display bgp ipv6 peer
BGP local router ID : 10.1.1.1
Local AS number : 65001
Total number of peers : 1 Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State Pre
fRcv
2001:DB8:2345:12::2
4 65002 63 66 0 01:00:31 Established
1
查看BGP4+路由信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21display bgp ipv6 routing-table
<R1>display bgp ipv6 routing-table
BGP Local router ID is 10.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Total Number of Routes: 2
*> Network : 2001:DB8:2345:1::1 PrefixLen : 128
NextHop : :: LocPrf :
MED : 0 PrefVal : 0
Label :
Path/Ogn : i
*> Network : 2001:DB8:2345:2::2 PrefixLen : 128
NextHop : 2001:DB8:2345:12::2 LocPrf :
MED : 0 PrefVal : 0
Label :
Path/Ogn : 65002 i
查看BGP4+ NLRI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21Border Gateway Protocol - UPDATE Message
Marker: ffffffffffffffffffffffffffffffff
Length: 85
Type: UPDATE Message (2)
Withdrawn Routes Length: 0
Total Path Attribute Length: 62
Path attributes
Path Attribute - ORIGIN: IGP
Path Attribute - AS_PATH: 65001
Path Attribute - MULTI_EXIT_DISC: 0
Path Attribute - MP_REACH_NLRI //BGP 可达的 网络层可达信息
Flags: 0x90, Optional, Extended-Length, Non-transitive, Complete
Type Code: MP_REACH_NLRI (14)
Length: 38
Address family identifier (AFI): IPv6 (2) //地址族标识
Subsequent address family identifier (SAFI): Unicast (1) //子地址族标识(地址族类型)
Next hop network address (16 bytes) // 下一跳地址
Next Hop: 2001:db8:2345:12::1
Number of Subnetwork points of attachment (SNPA): 0
Network layer reachability information (17 bytes) //网络层可达信息
2001:db8:2345:1::1/128