《ospf配置实例.docx》由会员分享,可在线阅读,更多相关《ospf配置实例.docx(5页珍藏版)》请在三一办公上搜索。
1、ospf配置实例ospf配置实例 注明:R1的S0连接R2的S0端口,R1的S1连接R3的S1 R1(S0):192.168.2.1 255.255.255.0 R1(S1):192.168.3.1 255.255.255.0 R2(S0): 192.168.2.2 255.255.255.0 R3(S1):192.168.3.3 255.255.255.0 R2(f0/0):192.168.1.1 255.255.255.0 R3(f0/0):192.168.4.1 255.255.255.0 PC2:192.168.1.2 255.255.255.0 192.168.1.1 PC3:192
2、.168.4.2 255.255.255.0 192.168.4.1 具体配置如下 Press Enter to Start Router Router Routeren Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R1 R1(config)#int s0 R1(config-if)#ip addr 192.168.2.1 255.255.255.0 R1(config-if)#no shut %LINK-3-UPDOWN: Interfac
3、e Serial0, changed state to up %LINK-3-UPDOWN: Interface Serial0, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to down R1(config-if)#clock rate 64000 R1(config-if)#exit R1(config)#int s1 R1(config-if)#ip addr 192.168.3.1 255.255.255.0 R1(config-if)#no
4、shut %LINK-3-UPDOWN: Interface Serial1, changed state to up %LINK-3-UPDOWN: Interface Serial1, changed state to down %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1, changed state to down R1(config-if)#clock rate 125000 R1(config-if)#exit R1(config)# %LINK-3-UPDOWN: Interface Serial0, change
5、d state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to up %LINK-3-UPDOWN: Interface Serial1, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1, changed state to up R1(config)# R1(config)#router ospf 100 R1(config-router)#network 192.168.2.0
6、0.0.0.255 area 0 R1(config-router)#network 192.168.3.0 0.0.0.255 area 0 R1(config-router)#end R1#wr R1#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area E1 - OSPF external type 1, E2 - OSPF external t
7、ype 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default U - per-user static route Gateway of last resort is not set C 192.168.2.0/24 is directly connected, Serial0 C 192.168.3.0/24 is directly connected, Serial1 R1# Press Enter to Start Router Routeren Router#conf t E
8、nter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R2 R2(config)#int s0 R2(config-if)#ip addr 192.168.2.2 255.255.255.0 R2(config-if)#no shut %LINK-3-UPDOWN: Interface Serial0, changed state to up R2(config-if)#exit R2(config)#int f0/0 R2(config-if)#ip addr 192.168.1
9、.1 255.255.255.0 R2(config-if)#no shut %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up R2(config-if)#exit R2(config)# R2(config)#router ospf 100 R2(config-router)#192.168.1.0 0.0.0.255 area 0 % Invalid input detected at marker. R2(config-router)#network 192.168.1.0 0.0.0.255 area 0 R2
10、(config-router)#network 192.168.2.0 0.0.0.255 area 0 R2(config-router)#end R2#wr R2#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i -
11、IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default U - per-user static route Gateway of last resort is not set C 192.168.2.0/24 is directly connected, Serial0 C 192.168.1.0/24 is directly connected, FastEthernet0/0 R2# Press Enter to Start Router Routeren Router#conf Configuring fr
12、om terminal, memory, or network terminal? Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R3 R3(config)#int s1 R3(config-if)#ip addr 192.168.3.3 255.255.255.0 R3(config-if)#no shut %LINK-3-UPDOWN: Interface Serial1, changed state to up R3(config-if)#exit R3(confi
13、g)#int f0/0 R3(config-if)#ip addr 192.168.4.1 255.255.255.0 R3(config-if)#no shut %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up R3(config-if)#exit R3(config)# R3(config)#router ospf 100 R3(config-router)#network 192.168.3.0 0.0.0.255 area 0 R3(config-router)#network 192.168.4.0 0.0.0.255 area 0 R3(config-router)#end R3#wr R3#