配置OSPF伪连接示例
配置经过MPLS VPN骨干网的路由成为OSPF区域内路由,避免在同一个OSPF区域内属于同一个VPN的site之间的通信总是通过OSPF区域内路由转发。
组网需求
如图5-19所示,CE1和CE2在同一个OSPF区域中,都属于VPN1,分别接入PE1和PE2。假设所有链路的cost值都是1。
要求CE与PE之间运行OSPF,CE1与CE2之间的VPN流量通过MPLS骨干网转发,不使用OSPF的区域内路由。
配置思路
本例配置主要思路是:
PE之间要建立MP-IBGP对等体关系,PE与CE运行OSPF协议来建立连接。
PE上创建VPN实例,并绑定与CE相连的接口。
在PE上创建OSPF伪连接。
调整用户网络转发接口的cost值,使它比sham link的cost值大。
数据准备
为完成此配置例,需准备如下的数据:
PE及P上的MPLS LSR-ID
PE上VPN实例的名称,RD及VPN-Target
配置OSPF所需数据(骨干网内部运行的OSPF进程和用户网络内部运行的OSPF进程,与PE上运行的用来与CE相连的OSPF进程都不同)
伪连接的cost值及通过用户网络转发时OSPF路由的cost值
操作步骤
- 配置用户网络上的OSPF
在CE1、RT0、CE2上配置普通OSPF,发布各接口的网段地址。
# 配置CE1。
<HUAWEI> system-view
[~HUAWEI] sysname CE1
[~CE1] interface GigabitEthernet0/2/0
[~CE1-GigabitEthernet0/2/0] ip address 10.1.1.1 24
[*CE1-GigabitEthernet0/2/0] quit
[*CE1] interface GigabitEthernet0/1/0
[*CE1-GigabitEthernet0/1/0] ip address 172.16.1.1 24
[*CE1-GigabitEthernet0/1/0] quit
[*CE1] ospf
[*CE1-ospf-1] area 0
[*CE1-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*CE1-ospf-1-area-0.0.0.0] network 172.16.1.0 0.0.0.255
[*CE1-ospf-1-area-0.0.0.0] quit
[*CE1-ospf-1] quit
[*CE1] commit
# 配置RT0。
<HUAWEI> system-view
[~HUAWEI] sysname RT0
[~RT0] interface GigabitEthernet0/1/0
[~RT0-GigabitEthernet0/1/0] ip address 10.1.1.2 24
[*RT0-GigabitEthernet0/1/0] quit
[*RT0] interface GigabitEthernet0/2/0
[*RT0-GigabitEthernet0/2/0] ip address 10.2.1.1 24
[*RT0-GigabitEthernet0/2/0] quit
[*RT0] ospf
[*RT0-ospf-1] area 0
[*RT0-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[*RT0-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[*RT0-ospf-1-area-0.0.0.0] quit
[*RT0-ospf-1] quit
[*RT0] commit
# 配置CE2。
<HUAWEI> system-view
[~HUAWEI] sysname CE2
[~CE2] interface GigabitEthernet0/2/0
[~CE2-GigabitEthernet0/2/0] ip address 10.2.1.2 24
[*CE2-GigabitEthernet0/2/0] quit
[*CE2] interface GigabitEthernet0/1/0
[*CE2-GigabitEthernet0/1/0] ip address 172.16.2.1 24
[*CE2-GigabitEthernet0/1/0] quit
[*CE2] ospf
[*CE2-ospf-1] area 0
[*CE2-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[*CE2-ospf-1-area-0.0.0.0] network 172.16.2.0 0.0.0.255
[*CE2-ospf-1-area-0.0.0.0] quit
[*CE2-ospf-1] quit
[*CE2] commit
- 配置骨干网的基本BGP/MPLS IP VPN,包括:配置骨干网的IGP;配置骨干网的MPLS和LDP;在PE之间建立MP-IBGP对等体关系
# 配置PE1。
<HUAWEI> system-view
[~HUAWEI] sysname PE1
[~PE1] interface loopback 1
[~PE1-LoopBack1] ip address 1.1.1.9 32
[*PE1-LoopBack1] quit
[*PE1] mpls lsr-id 1.1.1.9
[*PE1] mpls
[*PE1-mpls] quit
[*PE1] mpls ldp
[*PE1-mpls-ldp] quit
[*PE1] interface GigabitEthernet0/2/0
[*PE1-GigabitEthernet0/2/0] ip address 50.1.1.1 24
[*PE1-GigabitEthernet0/2/0] mpls
[*PE1-GigabitEthernet0/2/0] mpls ldp
[*PE1-GigabitEthernet0/2/0] quit
[*PE1] ospf
[*PE1-ospf-1] area 0
[*PE1-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0
[*PE1-ospf-1-area-0.0.0.0] network 50.1.1.0 0.0.0.255
[*PE1-ospf-1-area-0.0.0.0] quit
[*PE1-ospf-1] quit
[*PE1] bgp 100
[*PE1-bgp] peer 3.3.3.9 as-number 100
[*PE1-bgp] peer 3.3.3.9 connect-interface loopback 1
[*PE1-bgp] ipv4-family vpnv4
[*PE1-bgp-af-vpnv4] peer 3.3.3.9 enable
[*PE1-bgp-af-vpnv4] quit
[*PE1-bgp] quit
[*PE1] commit
# 配置P。
<HUAWEI> system-view
[~HUAWEI] sysname P
[~P] interface loopback 1
[~P-LoopBack1] ip address 2.2.2.9 32
[*P-LoopBack1] quit
[*P] mpls lsr-id 2.2.2.9
[*P] mpls
[*P-mpls] quit
[*P] mpls ldp
[*P-mpls-ldp] quit
[*P] interface GigabitEthernet0/1/0
[*P-GigabitEthernet0/1/0] ip address 50.1.1.2 24
[*P-GigabitEthernet0/1/0] mpls
[*P-GigabitEthernet0/1/0] mpls ldp
[*P-GigabitEthernet0/1/0] quit
[*P] interface GigabitEthernet0/2/0
[*P-GigabitEthernet0/2/0] ip address 40.1.1.1 24
[*P-GigabitEthernet0/2/0] mpls
[*P-GigabitEthernet0/2/0] mpls ldp
[*P-GigabitEthernet0/2/0] quit
[*P] ospf
[*P-ospf-1] area 0
[*P-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0
[*P-ospf-1-area-0.0.0.0] network 50.1.1.0 0.0.0.255
[*P-ospf-1-area-0.0.0.0] network 40.1.1.0 0.0.0.255
[*P-ospf-1-area-0.0.0.0] quit
[*P-ospf-1] quit
[*P] commit
# 配置PE2。
<HUAWEI> system-view
[~HUAWEI] sysname PE2
[~PE2] interface loopback 1
[~PE2-LoopBack1] ip address 3.3.3.9 32
[*PE2-LoopBack1] quit
[*PE2] mpls lsr-id 3.3.3.9
[*PE2] mpls
[*PE2-mpls] quit
[*PE2] mpls ldp
[*PE2-mpls-ldp] quit
[*PE2] interface GigabitEthernet0/2/0
[*PE2-GigabitEthernet0/2/0] ip address 40.1.1.2 24
[*PE2-GigabitEthernet0/2/0] mpls
[*PE2-GigabitEthernet0/2/0] mpls ldp
[*PE2-GigabitEthernet0/2/0] quit
[*PE2] ospf
[*PE2-ospf-1] area 0
[*PE2-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0
[*PE2-ospf-1-area-0.0.0.0] network 40.1.1.0 0.0.0.255
[*PE2-ospf-1-area-0.0.0.0] quit
[*PE2-ospf-1] quit
[*PE2] bgp 100
[*PE2-bgp] peer 1.1.1.9 as-number 100
[*PE2-bgp] peer 1.1.1.9 connect-interface loopback 1
[*PE2-bgp] ipv4-family vpnv4
[*PE2-bgp-af-vpnv4] peer 1.1.1.9 enable
[*PE2-bgp-af-vpnv4] quit
[*PE2-bgp] quit
[*PE2] commit
配置完成后,PE1和PE2应学到对方的Loopback接口路由,并建立MP-IBGP对等体关系。
- 配置PE与CE的连接:PE与CE间运行OSPF
# 配置PE1。
[~PE1] ip vpn-instance vpn1
[*PE1-vpn-instance-vpn1] ipv4-family
[*PE1-vpn-instance-vpn1-af-ipv4] route-distinguisher 100:1
[*PE1-vpn-instance-vpn1-af-ipv4] vpn-target 1:1
[*PE1-vpn-instance-vpn1-af-ipv4] quit
[*PE1-vpn-instance-vpn1] quit
[*PE1] interface gigabitethernet 1/0/0
[*PE1-GigabitEthernet1/0/0] ip binding vpn-instance vpn1
[*PE1-GigabitEthernet1/0/0] ip address 172.16.1.2 24
[*PE1-GigabitEthernet1/0/0] quit
[*PE1] ospf 100 vpn-instance vpn1
[*PE1-ospf-100] domain-id 10
[*PE1-ospf-100] import-route bgp
[*PE1-ospf-100] area 0
[*PE1-ospf-100-area-0.0.0.0] network 172.16.1.0 0.0.0.255
[*PE1-ospf-100-area-0.0.0.0] quit
[*PE1-ospf-100] quit
[*PE1] bgp 100
[*PE1-bgp] ipv4-family vpn-instance vpn1
[*PE1-bgp-vpn1] import-route direct
[*PE1-bgp-vpn1] import-route ospf 100
[*PE1-bgp-vpn1] quit
[*PE1-bgp] quit
[*PE1] commit
# 配置PE2。
[~PE2] ip vpn-instance vpn1
[*PE2-vpn-instance-vpn1] ipv4-family
[*PE2-vpn-instance-vpn1-af-ipv4] route-distinguisher 100:2
[*PE2-vpn-instance-vpn1-af-ipv4] vpn-target 1:1
[*PE2-vpn-instance-vpn1-af-ipv4] quit
[*PE2-vpn-instance-vpn1] quit
[*PE2] interface GigabitEthernet0/1/0
[*PE2-GigabitEthernet0/1/0] ip binding vpn-instance vpn1
[*PE2-GigabitEthernet0/1/0] ip address 172.16.2.2 24
[*PE2-GigabitEthernet0/1/0] quit
[*PE2] ospf 100 vpn-instance vpn1
[*PE2-ospf-100] import-route bgp
[*PE2-ospf-100] domain-id 10
[*PE2-ospf-100] area 0
[*PE2-ospf-100-area-0.0.0.0] network 172.16.2.0 0.0.0.255
[*PE2-ospf-100-area-0.0.0.0] quit
[*PE2-ospf-100] quit
[*PE2] bgp 100
[*PE2-bgp] ipv4-family vpn-instance vpn1
[*PE2-bgp-vpn1] import-route direct
[*PE2-bgp-vpn1] import-route ospf 100
[*PE2-bgp-vpn1] quit
[*PE2-bgp] quit
[*PE2] commit
完成上述配置后,在PE设备上执行display ip routing-table vpn-instance命令,可以看到去往对端CE的路由是通过用户网络的OSPF路由,不是通过骨干网的BGP路由。
以PE1的显示为例:
<PE1> display ip routing-table vpn-instance vpn1
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Tables: vpn1
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 OSPF 10 2 D 172.16.1.1 GigabitEthernet0/1/0
10.2.1.0/24 OSPF 10 3 D 172.16.1.1 GigabitEthernet0/1/0
172.16.1.0/24 Direct 0 0 D 172.16.1.2 GigabitEthernet0/1/0
172.16.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0
172.16.2.0/24 OSPF 10 4 D 172.16.1.1 GigabitEthernet0/1/0
- 配置Sham link
为了使VPN流量通过MPLS骨干网转发,在配置sham link时,应保证sham link的cost值小于通过用户网络转发时OSPF路由的cost值。因此,常常需要调整用户网络转发接口的cost值,使它比sham link的cost值大。
# 配置CE1。
[~CE1] interface GigabitEthernet0/2/0
[~CE1-GigabitEthernet0/2/0] ospf cost 10
# 配置CE2。
[~CE2] interface GigabitEthernet0/2/0
[~CE2-GigabitEthernet0/2/0] ospf cost 10
[~CE2] interface loopback 1
[~CE2-LoopBack1] ip address 8.8.8.8 32
[*CE2-LoopBack1] ospf enable 1 area 0
[*CE2-LoopBack1] quit
[*CE2] commit
# 配置PE1。
[~PE1] interface loopback 10
[*PE1-LoopBack10] ip binding vpn-instance vpn1
[*PE1-LoopBack10] ip address 5.5.5.5 32
[*PE1-LoopBack10] quit
[*PE1] ospf 100 router-id 11.11.11.11
[*PE1-ospf-100] area 0
[*PE1-ospf-100-area-0.0.0.0] sham-link 5.5.5.5 6.6.6.6 cost 1
[*PE1-ospf-100-area-0.0.0.0] quit
[*PE1-ospf-100] quit
[*PE1] commit
# 配置PE2。
[~PE2] interface loopback 10
[*PE2-LoopBack10] ip binding vpn-instance vpn1
[*PE2-LoopBack10] ip address 6.6.6.6 32
[*PE2-LoopBack10] quit
[*PE2] ospf 100 router-id 22.22.22.22
[*PE2-ospf-100] area 0
[*PE2-ospf-100-area-0.0.0.0] sham-link 6.6.6.6 5.5.5.5 cost 1
[*PE2-ospf-100-area-0.0.0.0] quit
[*PE2-ospf-100] quit
[*PE2] commit
- 检查配置结果
完成上述配置后,在PE设备上再次执行display ip routing-table vpn-instance命令,可以看到去往对端CE的路由变成了通过骨干网的BGP路由,并且有去往sham-link目的地址的路由。
以PE1的显示为例:
<PE1> display ip routing-table vpn-instance vpn1
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Tables: vpn1
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
5.5.5.5/32 Direct 0 0 D 127.0.0.1 LoopBack10
6.6.6.6/32 IBGP 255 0 RD 3.3.3.9 GigabitEthernet0/2/0
8.8.8.8/32 IBGP 255 2 RD 3.3.3.9 GigabitEthernet0/2/0
10.1.1.0/24 OSPF 10 11 D 172.16.1.1 GigabitEthernet0/1/0
10.2.1.0/24 OSPF 10 12 D 172.16.1.1 GigabitEthernet0/1/0
172.16.1.0/24 Direct 0 0 D 172.16.1.2 GigabitEthernet0/1/0
172.16.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0
172.16.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0
172.16.2.0/24 IBGP 255 0 RD 3.3.3.9 GigabitEthernet0/2/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
在CE设备上执行display ip routing-table命令,可以看到去往对端CE的OSPF路由开销变为3,下一跳为接入PE的GigabitEthernet接口,即,去往对端的VPN流量将通过骨干网转发。
以CE1的显示为例:
<CE1> display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : _public_
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
5.5.5.5/32 O_ASE 150 1 D 172.16.1.2 GigabitEthernet0/1/0
6.6.6.6/32 O_ASE 150 1 D 172.16.1.2 GigabitEthernet0/1/0
8.8.8.8/32 OSPF 10 3 D 172.16.1.2 GigabitEthernet0/1/0
10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet0/2/0
10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/2/0
10.2.1.0/24 OSPF 10 11 D 10.1.1.2 GigabitEthernet0/2/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
172.16.1.0/24 Direct 0 0 D 172.16.1.1 GigabitEthernet0/1/0
172.16.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0
172.16.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0
172.16.2.0/24 OSPF 10 3 D 172.16.1.2 GigabitEthernet0/1/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
CE1到CE2的OSPF路由开销 = CE1到PE1的开销 + sham link开销 + PE2到CE2的开销= 1 + 1 + 1 =3。
用命令tracert也可发现CE1发送数据到对端CE2,其下一跳为接入PE1的GigabitEthernet0/1/0接口,即,去往对端的VPN流量将通过骨干网转发。
<CE1> tracert 172.16.2.1
traceroute to 172.16.2.1(172.16.2.1), max hops: 30 ,packet length: 40,press CTRL_C to break
1 172.16.1.2 131 ms 2 ms 1 ms
2 50.1.1.2 475 ms 4 ms 4 ms
3 172.16.2.2 150 ms 3 ms 4 ms
4 172.16.2.1 76 ms 3 ms 5 ms
<CE1> tracert 10.2.1.2
traceroute to 10.2.1.2(10.2.1.2), max hops: 30 ,packet length: 40,press CTRL_C to break
1 10.1.1.2 60 ms 1 ms 1 ms
2 10.2.1.2 12 ms 2 ms 2 ms
在PE上执行display ospf sham-link命令可以看到sham-link的建立情况。
以PE1的显示为例:
<PE1> display ospf sham-link
OSPF Process 100 with Router ID 11.11.11.11
Area NeighborId Source-IP Destination-IP State Cost
0.0.0.0 22.22.22.22 5.5.5.5 6.6.6.6 P-2-P 1
执行display ospf sham-link area命令可以看到对端状态为Full:
<PE1> display ospf sham-link area 0
OSPF Process 100 with Router ID 11.11.11.11
Sham-Link: 5.5.5.5 --> 6.6.6.6
NeighborID: 22.22.22.22, State: Full, GR status: Normal
Area: 0.0.0.0
Cost: 1 , State: P-2-P , Type: Sham
Timers: Hello 10 , Dead 40 , Retransmit 5 , Transmit Delay 1
在CE设备上执行display ospf routing命令,可以看到对端CE的路由是作为区域内(Intra Area)路由学到的。
<CE1> display ospf routing
OSPF Process 1 with Router ID 10.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
8.8.8.8/32 3 Stub 172.16.1.2 10.2.1.2 0.0.0.0
10.1.1.0/24 10 Direct 10.1.1.1 10.1.1.1 0.0.0.0
10.2.1.0/24 11 Transit 10.1.1.2 10.1.1.2 0.0.0.0
172.16.1.0/24 1 Direct 172.16.1.1 10.1.1.1 0.0.0.0
172.16.2.0/24 3 Transit 172.16.1.2 10.2.1.2 0.0.0.0
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
6.6.6.6/32 1 Type2 3489661028 172.16.1.2 11.11.11.11
5.5.5.5/32 1 Type2 3489661028 172.16.1.2 22.22.22.22
Total Nets: 7
Intra Area: 5 Inter Area: 0 ASE: 2 NSSA: 0
配置文件
PE1的配置文件
#
sysname PE1
#
ip vpn-instance vpn1
ipv4-family
route-distinguisher 100:1
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
mpls lsr-id 1.1.1.9
mpls
#
mpls ldp
#
interface GigabitEthernet0/1/0
undo shutdown
ip binding vpn-instance vpn1
ip address 172.16.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 50.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 1.1.1.9 255.255.255.255
#
interface LoopBack10
ip binding vpn-instance vpn1
ip address 5.5.5.5 255.255.255.255
#
bgp 100
peer 3.3.3.9 as-number 100
peer 3.3.3.9 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 3.3.3.9 enable
#
ipv4-family vpnv4
policy vpn-target
peer 3.3.3.9 enable
#
ipv4-family vpn-instance vpn1
import-route direct
import-route ospf 100
#
ospf 1
area 0.0.0.0
network 1.1.1.9 0.0.0.0
network 50.1.1.0 0.0.0.255
#
ospf 100 router-id 11.11.11.11 vpn-instance vpn1
import-route bgp
domain-id 0.0.0.10
area 0.0.0.0
network 172.16.1.0 0.0.0.255
sham-link 5.5.5.5 6.6.6.6 cost 1
#
return
P的配置文件
#
sysname P
#
mpls lsr-id 2.2.2.9
mpls
#
mpls ldp
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 50.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 40.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 2.2.2.9 255.255.255.255
#
ospf 1
area 0.0.0.0
network 2.2.2.9 0.0.0.0
network 50.1.1.0 0.0.0.255
network 40.1.1.0 0.0.0.255
#
return
PE2的配置文件
#
sysname PE2
#
ip vpn-instance vpn1
ipv4-family
route-distinguisher 100:2
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
mpls lsr-id 3.3.3.9
mpls
#
mpls ldp
#
interface GigabitEthernet0/1/0
undo shutdown
ip binding vpn-instance vpn1
ip address 172.16.2.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 40.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 3.3.3.9 255.255.255.255
#
interface LoopBack10
ip binding vpn-instance vpn1
ip address 6.6.6.6 255.255.255.255
#
bgp 100
peer 1.1.1.9 as-number 100
peer 1.1.1.9 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 1.1.1.9 enable
#
ipv4-family vpnv4
policy vpn-target
peer 1.1.1.9 enable
#
ipv4-family vpn-instance vpn1
import-route direct
import-route ospf 100
#
ospf 1
area 0.0.0.0
network 3.3.3.9 0.0.0.0
network 40.1.1.0 0.0.0.255
#
ospf 100 router-id 22.22.22.22 vpn-instance vpn1
import-route bgp
domain-id 0.0.0.10
area 0.0.0.0
network 172.16.2.0 0.0.0.255
sham-link 6.6.6.6 5.5.5.5 cost 1
#
return
CE1的配置文件
#
sysname CE1
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 172.16.1.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
ospf cost 10
#
interface LoopBack0
ip address 8.8.8.8 255.255.255.255
ospf enable 1 area 0.0.0.0
#
ospf 1
area 0.0.0.0
network 172.16.1.0 0.0.0.255
network 10.1.1.0 0.0.0.255
#
return
CE2的配置文件
#
sysname CE2
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 172.16.2.1 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.2.1.2 255.255.255.0
ospf cost 10
#
ospf 1
area 0.0.0.0
network 10.2.1.0 0.0.0.255
network 172.16.2.0 0.0.0.255
#
return
RT0的配置文件
#
sysname RT0
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/2/0
undo shutdown
ip address 10.2.1.1 255.255.255.0
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.2.1.0 0.0.0.255
#
return