network 3.3.3.0/24 area 0.0.0.0
network 192.168.0.0/16 area 0.0.0.0
!
line vty
!
End
-------------------------------------------------------
R2:
配置文件如下:
ospfd# show running-config
Current configuration:
!
hostname ospfd
password zebra
log stdout
!
!
!
interface lo
!
interface eth0
!
interface eth1
!
interface eth2
!
interface dummy0
!
router ospf
network 2.2.2.0/24 area 0.0.0.0
network 192.168.0.0/16 area 0.0.0.0
!
line vty
!
End
---------------------------------------------------
R3:
配置如下:
ospfd# show running-config
Current configuration:
!
hostname ospfd
password zebra
log file /root/ospfd.log
log stdout
!
!
!
interface lo
!
interface eth0
!
interface eth1
!
interface eth2
!
interface dummy0
!
router ospf
network 4.4.4.0/24 area 0.0.0.0
network 192.168.0.0/16 area 0.0.0.0
!
line vty
!
End
----------------------------------------
各个运行状态如下:
R1:
ospfd# show ip ospf route
============ OSPF network routing table ============
N 2.2.2.0/24 [20] area: 0.0.0.0
via 192.168.101.1, eth1
N 3.3.3.0/24 [10] area: 0.0.0.0
directly attached to eth3
N 4.4.4.0/24 [20] area: 0.0.0.0
via 192.168.102.2, eth2
N 192.168.100.0/30 [20] area: 0.0.0.0
via 192.168.101.1, eth1
via 192.168.102.2, eth2
N 192.168.101.0/30 [10] area: 0.0.0.0
directly attached to eth1
N 192.168.102.0/30 [10] area: 0.0.0.0
directly attached to eth2
============ OSPF router routing table =============
============ OSPF external routing table ===========
路由表:
bash-2.05# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.0 192.168.101.1 255.255.255.252 UG 20 0 0 eth1
192.168.101.0 0.0.0.0 255.255.255.252 U 0 0 0 eth1
192.168.102.0 0.0.0.0 255.255.255.252 U 0 0 0 eth2
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
2.2.2.0 192.168.101.1 255.255.255.0 UG 20 0 0 eth1
3.3.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3
4.4.4.0 192.168.102.2 255.255.255.0 UG 20 0 0 eth2
10.100.100.0 0.0.0.0 255.255.254.0 U 0 0 0 tap0
0.0.0.0 10.0.1.163 0.0.0.0 UG 0 0 0 eth0
------------------------------
R2:
ospfd# sh ip ospf route
============ OSPF network routing table ============
N 2.2.2.0/24 [10] area: 0.0.0.0
directly attached to dummy0
N 3.3.3.0/24 [20] area: 0.0.0.0
via 192.168.101.2, eth2
N 4.4.4.0/24 [20] area: 0.0.0.0
via 192.168.100.2, eth1
N 192.168.100.0/30 [10] area: 0.0.0.0
directly attached to eth1
N 192.168.101.0/30 [10] area: 0.0.0.0
directly attached to eth2
N 192.168.102.0/30 [20] area: 0.0.0.0
via 192.168.100.2, eth1
via 192.168.101.2, eth2
============ OSPF router routing table =============
============ OSPF external routing table ===========
路由表:
无
-----------------------------------
R3:
ospfd# sh ip ospf rou
============ OSPF network routing table ============
N 2.2.2.0/24 [20] area: 0.0.0.0