H3C设备之OSPF单区域_OSPF 

配置单区域的OSPF,使两台client可以互访:

[RTA]int e0/1
[RTA-Ethernet0/1]ip add 10.0.0.1 24
[RTA-Ethernet0/1]undo shutdown 
[RTA-Ethernet0/1]int e0/0
[RTA-Ethernet0/0]ip add 20.0.0.1 24
[RTA-Ethernet0/0]undo shutdown 
[RTA-Ethernet0/0]int loop1
[RTA-LoopBack1]ip add 1.1.1.1 32

[RTB]int e0/0
[RTB-Ethernet0/0]ip add 20.0.0.2 24
[RTB-Ethernet0/0]undo shutdown 
[RTB-Ethernet0/0]int e0/1
[RTB-Ethernet0/1]ip add 10.1.0.1 24
[RTB-Ethernet0/1]undo shutdown 
[RTB]int loop1
[RTB-LoopBack1]ip add 2.2.2.2 32

PCA:10.0.0.2 255.255.255.0 GT:10.0.0.1

PCB:10.1.0.2 255.255.255.0 GT:10.1.0.1

[RTA]router id 1.1.1.1                                         指定RID
[RTA]ospf 1                                                        启用OSPF
[RTA-ospf-1]area 0                                             指定区域
[RTA-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0           使接口能OSPF
[RTA-ospf-1-area-0.0.0.0]network 10.0.0.0 0.0.0.255
[RTA-ospf-1-area-0.0.0.0]network 20.0.0.0 0.0.0.255

[RTB]router id 2.2.2.2
[RTB]ospf 1
[RTB-ospf-1]area 0
[RTB-ospf-1-area-0.0.0.0]network 20.0.0.0 0.0.0.255
[RTB-ospf-1-area-0.0.0.0]network 10.1.0.0 0.0.0.255     
[RTB-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0

此时RTA,RTB已经成功学习到对端的路由信息。PCA和PCB可相互通讯:

[RTA]disp ip routing-table
Routing Tables: Public
        Destinations : 9        Routes : 9

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

1.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0
2.2.2.2/32          OSPF   10   10           20.0.0.2        Eth0/0
10.0.0.0/24         Direct 0    0            10.0.0.1        Eth0/1
10.0.0.1/32         Direct 0    0            127.0.0.1       InLoop0
10.1.0.0/24         OSPF   10   20           20.0.0.2        Eth0/0
20.0.0.0/24         Direct 0    0            20.0.0.1        Eth0/0
20.0.0.1/32         Direct 0    0            127.0.0.1       InLoop0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

[RTB]disp ip routing-table
Routing Tables: Public
        Destinations : 9        Routes : 9

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

1.1.1.1/32          OSPF   10   10           20.0.0.1        Eth0/0
2.2.2.2/32          Direct 0    0            127.0.0.1       InLoop0
10.0.0.0/24         OSPF   10   20           20.0.0.1        Eth0/0
10.1.0.0/24         Direct 0    0            10.1.0.1        Eth0/1
10.1.0.1/32         Direct 0    0            127.0.0.1       InLoop0
20.0.0.0/24         Direct 0    0            20.0.0.2        Eth0/0
20.0.0.2/32         Direct 0    0            127.0.0.1       InLoop0
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

PCA:C:\Documents and Settings\xiaofei>ping 10.1.0.2

Pinging 10.1.0.2 with 32 bytes of data:

Reply from 10.1.0.2: bytes=32 time=5ms TTL=253
Reply from 10.1.0.2: bytes=32 time=2ms TTL=253
Reply from 10.1.0.2: bytes=32 time=1ms TTL=253
Reply from 10.1.0.2: bytes=32 time=1ms TTL=253

Ping statistics for 10.1.0.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 5ms, Average = 2ms

PCB:C:\Documents and Settings\xiaofei>ping 10.0.0.2

Pinging 10.1.0.2 with 32 bytes of data:

Reply from 10.0.0.2: bytes=32 time=5ms TTL=253
Reply from 10.0.0.2: bytes=32 time=2ms TTL=253
Reply from 10.0.0.2: bytes=32 time=1ms TTL=253
Reply from 10.0.0.2: bytes=32 time=1ms TTL=253

Ping statistics for 10.0.0.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 5ms, Average = 2ms