How to configure loopback interface appear as /24 in OSPF routing table ?

各位可能都設定過OSPF & interface loopback,不過各位有沒有注意到不論loopback interface中的ip address mask為何,在OSPF交換之後還是顯示/32 ?

R1
interface Loopback0
ip address 210.210.210.1 255.255.255.0
!
interface FastEthernet1/0
ip address 10.10.10.1 255.255.255.0
!
router ospf 1
network 10.10.10.0 0.0.0.255 area 0
network 210.210.210.0 0.0.0.255 area 0


R2
interface FastEthernet1/0
ip address 10.10.10.2 255.255.255.0
!
router ospf 1
network 10.10.10.0 0.0.0.255 area 0


以上述兩個Router為例,在R2上看到的路由表仍然會是210.210.210.1/32

R2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

210.210.210.0/32 is subnetted, 1 subnets
O 210.210.210.1 [110/1] via 10.10.10.1, 00:00:05, FastEthernet1/0


所以我們可以在R1 interface loopback 0加上一行ip ospf network point-to-point,那麼R2看到的路由就不會再是/32而是原來實際的mask /24

R1
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int lo0
R1(config-if)#ip ospf network point-to-point


R2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

O 210.210.210.0/24 [110/1] via 10.10.10.1, 00:00:24, FastEthernet1/0

Comments

Popular posts from this blog

L2TPv3 Enables Layer 2 Services for IP Networks

TCP/IP 明確擁塞通知 (ECN)

Q-in-Q(Dot1Q Tunnel) Sample Configuration