OSPF基础配置命令

第一步

如图:划分ip并进行命令配置回环配置

第二部

启动ospf并且宣告激活接口(注意宣告每个接口时要进行反掩码配置)

汇总配置

[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]ar	
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]net	
[r1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.31
[r1-ospf-1-area-0.0.0.0]net	
[r1-ospf-1-area-0.0.0.0]network 192.168.1.33 0.0.0.31

[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]ar	
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]net	
[r2-ospf-1-area-0.0.0.0]network 192.168.1.35 0.0.0.31
[r2-ospf-1-area-0.0.0.0]network 192.168.1.65 0.0.0.31

r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]a	
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]net	
[r3-ospf-1-area-0.0.0.0]network 192.168.1.34 0.0.0.31
[r3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.31
[r3-ospf-1-area-0.0.0.0]
[r3-ospf-1-area-0.0.0.0]abr	
[r3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.0 255.255.255.128
[r3-ospf-1]area 1
[r3-ospf-1-area-0.0.0.1]net
[r3-ospf-1-area-0.0.0.1]network 192.168.1.129 0.0.0.31
[r3-ospf-1-area-0.0.0.1]ab	
[r3-ospf-1-area-0.0.0.1]abr-summary 192.168.1.128 255.255.255.224
[r3-ospf-1-area-0.0.0.1]q

[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]ar	
[r4-ospf-1]area 1
[r4-ospf-1-area-0.0.0.1]net	
[r4-ospf-1-area-0.0.0.1]network  192.168.1.130 0.0.0.31

还需要在边界路由器上配一条缺省

[r4-ospf-1]default-route-advertise always

第三步

R1-R3中要求R3是DR无BDR

将r1和r2优先级设置为0     并且重启ospf

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]osp	
[r1-GigabitEthernet0/0/0]ospf dr	
[r1-GigabitEthernet0/0/0]ospf dr-priority 0

[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]os	
[r2-GigabitEthernet0/0/0]ospf dr	
[r2-GigabitEthernet0/0/0]ospf dr-priority 0

第四步

ospf认证

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]os	
[r1-GigabitEthernet0/0/0]ospf au	
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 c	
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r1-GigabitEthernet0/0/0]


[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]os	
[r2-GigabitEthernet0/0/0]ospf au	
[r2-GigabitEthernet0/0/0]ospf authentication-mode m	
[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 c	
[r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r2-GigabitEthernet0/0/0]

[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]os	
[r3-GigabitEthernet0/0/0]ospf au	
[r3-GigabitEthernet0/0/0]ospf authentication-mode md	
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 c	
[r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r3-GigabitEthernet0/0/0]q
[r3]int g0/0/1
[r3-GigabitEthernet0/0/1]os	
[r3-GigabitEthernet0/0/1]ospf au	
[r3-GigabitEthernet0/0/1]ospf authentication-mode md	
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 c	
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 123456

[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ospf au	
[r4-GigabitEthernet0/0/0]ospf authentication-mode md	
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 c	
[r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123456
[r4-GigabitEthernet0/0/0]

第五步

每台路由器上配空接口路由

[r1]ip route-static 192.168.1.0 27 NULL 0
[r2]ip route-static 192.168.1.64 27 NULL 0
[r3]ip route-static 192.168.1.96 27 NULL 0
[r4]ip route-static 192.168.1.128 27 NULL 0

全网可达: 

r1>ping 4.4.4.4
  PING 4.4.4.4: 56  data bytes, press CTRL_C to break
    Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=254 time=40 ms
    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=254 time=30 ms
    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=254 time=60 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=254 time=30 ms
    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=254 time=40 ms

  --- 4.4.4.4 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/40/60 ms

<r1>ping 192.168.1.129
  PING 192.168.1.129: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.129: bytes=56 Sequence=1 ttl=255 time=50 ms
    Reply from 192.168.1.129: bytes=56 Sequence=2 ttl=255 time=50 ms
    Reply from 192.168.1.129: bytes=56 Sequence=3 ttl=255 time=40 ms
    Reply from 192.168.1.129: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 192.168.1.129: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 192.168.1.129 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/42/50 ms

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>