四台路由器
全网互通
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 15.0.0.1 30
[R1-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R1-GigabitEthernet0/0/1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 30
[R1-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]int loo 0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1-LoopBack0]q
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 0
[R1-ospf-1-area-0.0.0.0]network 12.0.0.0 0.0.0.3
[R1-ospf-1-area-0.0.0.0]network 15.0.0.0 0.0.0.3
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]q
[R1-ospf-1]q
[R1]bgp 100
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 2.2.2.2 as-number 100
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R1-bgp]peer 5.5.5.5 as-number 100
[R1-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R1-bgp]q
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 14 Routes : 14
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.2/32 OSPF 10 1 D 12.0.0.2 GigabitEthernet
0/0/0
5.5.5.5/32 OSPF 10 1 D 15.0.0.2 GigabitEthernet
0/0/1
12.0.0.0/30 Direct 0 0 D 12.0.0.1 GigabitEthernet
0/0/0
12.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
15.0.0.0/30 Direct 0 0 D 15.0.0.1 GigabitEthernet
0/0/1
15.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
15.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.0/30 OSPF 10 2 D 12.0.0.2 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 16 Routes : 16
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.2/32 OSPF 10 1 D 12.0.0.2 GigabitEthernet
0/0/0
5.5.5.5/32 OSPF 10 1 D 15.0.0.2 GigabitEthernet
0/0/1
12.0.0.0/30 Direct 0 0 D 12.0.0.1 GigabitEthernet
0/0/0
12.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
15.0.0.0/30 Direct 0 0 D 15.0.0.1 GigabitEthernet
0/0/1
15.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
15.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.0/30 OSPF 10 2 D 12.0.0.2 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
202.0.0.0/24 IBGP 255 0 RD 5.5.5.5 GigabitEthernet
0/0/1
202.0.1.0/24 IBGP 255 0 RD 5.5.5.5 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 30
[R2-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 23.0.0.1 30
[R2-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R2-GigabitEthernet0/0/1]int loo 0
[R2-LoopBack0]ip add 2.2.2.2 32
[R2-LoopBack0]q
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]network 12.0.0.0 0.0.0.3
[R2-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.3
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]q
[R2]bgp 100
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 1.1.1.1 as-number 100
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 5.5.5.5 as-number 100
[R2-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[R2-bgp]q
[R2]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 14 Routes : 14
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 OSPF 10 1 D 12.0.0.1 GigabitEthernet
0/0/0
2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0
5.5.5.5/32 OSPF 10 2 D 12.0.0.1 GigabitEthernet
0/0/0
12.0.0.0/30 Direct 0 0 D 12.0.0.2 GigabitEthernet
0/0/0
12.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
15.0.0.0/30 OSPF 10 2 D 12.0.0.1 GigabitEthernet
0/0/0
23.0.0.0/30 Direct 0 0 D 23.0.0.1 GigabitEthernet
0/0/1
23.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R2]rip 1
[R2-rip-1]v 2
[R2-rip-1]un summary
[R2-rip-1]network 23.0.0.0
[R2-rip-1]network 2.0.0.0
[R2-rip-1]q
[R2]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 OSPF 10 1 D 12.0.0.1 GigabitEthernet
0/0/0
2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0
3.3.3.3/32 RIP 100 1 D 23.0.0.2 GigabitEthernet
0/0/1
5.5.5.5/32 OSPF 10 2 D 12.0.0.1 GigabitEthernet
0/0/0
12.0.0.0/30 Direct 0 0 D 12.0.0.2 GigabitEthernet
0/0/0
12.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
15.0.0.0/30 OSPF 10 2 D 12.0.0.1 GigabitEthernet
0/0/0
23.0.0.0/30 Direct 0 0 D 23.0.0.1 GigabitEthernet
0/0/1
23.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R2]bgp 100
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 3.3.3.3 as-number 200
[R2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R2-bgp]peer 3.3.3.3 ebgp-max-hop 2
[R2-bgp]q
[R2]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 17 Routes : 17
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 OSPF 10 1 D 12.0.0.1 GigabitEthernet
0/0/0
2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0
3.3.3.3/32 RIP 100 1 D 23.0.0.2 GigabitEthernet
0/0/1
5.5.5.5/32 OSPF 10 2 D 12.0.0.1 GigabitEthernet
0/0/0
12.0.0.0/30 Direct 0 0 D 12.0.0.2 GigabitEthernet
0/0/0
12.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
15.0.0.0/30 OSPF 10 2 D 12.0.0.1 GigabitEthernet
0/0/0
23.0.0.0/30 Direct 0 0 D 23.0.0.1 GigabitEthernet
0/0/1
23.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
202.0.0.0/24 IBGP 255 0 RD 5.5.5.5 GigabitEthernet
0/0/0
202.0.1.0/24 IBGP 255 0 RD 5.5.5.5 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R5
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]ip add 15.0.0.2 30
[R5-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R5-GigabitEthernet0/0/1]int loo 0
[R5-LoopBack0]ip add 5.5.5.5 32
[R5-LoopBack0]q
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]network 15.0.0.0 0.0.0.3
[R5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]q
[R5-ospf-1]q
[R5]bgp 100
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 1.1.1.1 as-number 100
[R5-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R5-bgp]peer 2.2.2.2 as-number 100
[R5-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R5-bgp]q
[R5]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 OSPF 10 1 D 15.0.0.1 GigabitEthernet
0/0/1
2.2.2.2/32 OSPF 10 2 D 15.0.0.1 GigabitEthernet
0/0/1
5.5.5.5/32 Direct 0 0 D 127.0.0.1 LoopBack0
12.0.0.0/30 OSPF 10 2 D 15.0.0.1 GigabitEthernet
0/0/1
15.0.0.0/30 Direct 0 0 D 15.0.0.2 GigabitEthernet
0/0/1
15.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
15.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.0/30 OSPF 10 3 D 15.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R5]int loo 1
[R5-LoopBack1]ip add 202.0.0.1 24
[R5-LoopBack1]int loo 2
[R5-LoopBack2]ip add 202.0.1.1 24
[R5-LoopBack2]q
[R5]bgp 100
[R5-bgp]network 202.0.0.0 24
[R5-bgp]network 202.0.1.0 24
[R5-bgp]undo network 202.0.0.0 24
[R5-bgp]undo network 202.0.1.0 24
[R5-bgp]import-route direct
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 23.0.0.2 30
[R3-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R3-GigabitEthernet0/0/1]int loo 0
[R3-LoopBack0]ip add 3.3.3.3 32
[R3-LoopBack0]q
[R3]rip 1
[R3-rip-1]v 2
[R3-rip-1]un summary
[R3-rip-1]network 23.0.0.0
[R3-rip-1]network 3.0.0.0
[R3-rip-1]q
[R3]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 RIP 100 1 D 23.0.0.1 GigabitEthernet
0/0/1
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
23.0.0.0/30 Direct 0 0 D 23.0.0.2 GigabitEthernet
0/0/1
23.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R3]bgp 200
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 2.2.2.2 as-number 100
[R3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R3-bgp]peer 2.2.2.2 ebgp-max-hop 2
[R3-bgp]q
[R3]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 RIP 100 1 D 23.0.0.1 GigabitEthernet
0/0/1
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
23.0.0.0/30 Direct 0 0 D 23.0.0.2 GigabitEthernet
0/0/1
23.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
202.0.0.0/24 EBGP 255 0 RD 2.2.2.2 GigabitEthernet
0/0/1
202.0.1.0/24 EBGP 255 0 RD 2.2.2.2 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R3]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 RIP 100 1 D 23.0.0.1 GigabitEthernet
0/0/1
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
23.0.0.0/30 Direct 0 0 D 23.0.0.2 GigabitEthernet
0/0/1
23.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R3]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 RIP 100 1 D 23.0.0.1 GigabitEthernet
0/0/1
3.3.3.3/32 Direct 0 0 D 127.0.0.1 LoopBack0
15.0.0.0/30 EBGP 255 0 RD 2.2.2.2 GigabitEthernet
0/0/1
23.0.0.0/30 Direct 0 0 D 23.0.0.2 GigabitEthernet
0/0/1
23.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.0.0.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
202.0.0.0/24 EBGP 255 0 RD 2.2.2.2 GigabitEthernet
0/0/1
202.0.1.0/24 EBGP 255 0 RD 2.2.2.2 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0