[Sysname] sysname SwitchA
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0
[SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] network 11.1.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# Configure OSPF on Switch B.
<Sysname> system-view
[Sysname] sysname SwitchB
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0
[SwitchB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit
# Configure OSPF on Switch C.
<Sysname> system-view
[Sysname] sysname SwitchC
[SwitchC] ospf
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0
[SwitchC-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] network 21.1.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
# Execute the display ip routing-table command on each switch. You will see that each switch has
learned the routes to other switches. Take Switch A as an example:
[SwitchA] display ip routing-table
Routing Tables: Public
Destinations : 11
Destination/Mask
1.1.1.9/32
2.2.2.9/32
3.3.3.9/32
10.1.1.0/24
10.1.1.1/32
11.1.1.0/24
11.1.1.1/32
20.1.1.0/24
21.1.1.0/24
127.0.0.0/8
127.0.0.1/32
Enable MPLS and MPLS LDP:
3.
Routes : 11
Proto
Pre
Cost
Direct 0
0
OSPF
10
1
OSPF
10
2
Direct 0
0
Direct 0
0
Direct 0
0
Direct 0
0
OSPF
10
2
OSPF
10
3
Direct 0
0
Direct 0
0
85
NextHop
Interface
127.0.0.1
InLoop0
10.1.1.2
Vlan2
10.1.1.2
Vlan2
10.1.1.1
Vlan2
127.0.0.1
InLoop0
11.1.1.1
Vlan4
127.0.0.1
InLoop0
10.1.1.2
Vlan2
10.1.1.2
Vlan2
127.0.0.1
InLoop0
127.0.0.1
InLoop0