笔记|思科 ospf 单区域lab实验

实验拓扑

在这里插入图片描述

基础配置

给路由器接口配上ip地址

R1

interface Ethernet0/0
 ip address 172.16.12.1 255.255.255.0
 no sh

interface Ethernet0/1
 ip address 172.16.1.1 255.255.255.0
 no sh

R2

interface Ethernet0/0
 ip address 172.16.12.2 255.255.255.0
 no sh

interface Ethernet0/1
 ip address 172.16.2.2 255.255.255.0
 no sh

interface Ethernet0/2
 ip address 172.16.234.2 255.255.255.0
 no sh

R3

interface Ethernet0/0
 ip address 172.16.234.3 255.255.255.0
 no sh

interface Ethernet0/1
 ip address 172.16.3.3 255.255.255.0
 no sh

R4

interface Ethernet0/0
 ip address 172.16.234.4 255.255.255.0
 no sh
interface Ethernet0/1
 ip address 172.16.4.4 255.255.255.0
 no sh

OSPF 配置

R1

ip route 0.0.0.0 0.0.0.0 172.16.1.0 //配置到外网的静态路由
router ospf 1 //启动ospf进程
 router-id 1.1.1.1 //配置ospf的进程ID
 auto-cost reference-bandwidth 1000 //修改ospf的度量值,确保所有路由器保持一致
 network 172.16.12.1 0.0.0.0 area 0 //配置参与ospf的接口范围
 default-information originate //向ospf注入默认路由

    
interface Ethernet0/0
 ip ospf hello-interval 5  //修改ospf发送hello的间隔
 ip ospf dead-interval 20 //dead时间一般为hello时间的四倍

R2

router ospf 1
 router-id 2.2.2.2
 passive-interface Ethernet0/1 //配置被动接口
 network 172.16.2.2 0.0.0.0 area 0
 network 172.16.12.2 0.0.0.0 area 0
 network 172.16.234.2 0.0.0.0 area 0

interface Ethernet0/0
 ip ospf dead-interval 20
 ip ospf hello-interval 5


interface Ethernet0/2
 ip ospf priority 20 //修改优先级(越大越优先),使得R2成为DR,以太网接口ospf优先级默认为1

R3

router ospf 1
 router-id 3.3.3.3
 auto-cost reference-bandwidth 1000
 passive-interface Ethernet0/1
 network 172.16.3.3 0.0.0.0 area 0
 network 172.16.234.3 0.0.0.0 area 0
interface Ethernet0/0
 ip ospf priority 10 //修改优先级。使得R3为BDR

R4

router ospf 1
 router-id 4.4.4.4
 auto-cost reference-bandwidth 10000
 passive-interface Ethernet0/1
 network 172.16.4.4 0.0.0.0 area 0
 network 172.16.234.4 0.0.0.0 area 0

实验调试

R2# show ip ospf neighbor 

Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 10 FULL/BDR 00:00:35 172.16.234.3 Ethernet0/2
4.4.4.4 1 FULL/DROTHER 00:00:36 172.16.234.4 Ethernet0/2
1.1.1.1 1 FULL/BDR 00:00:19 172.16.12.1 Ethernet0/0

R2#show ip ospf interface ethernet 0/0

Ethernet0/0 is up, line protocol is up //接口为up up
Internet Address 172.16.12.2/24, Area 0, Attached via Network Statement
Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 10
Topology-MTID Cost Disabled Shutdown Topology Name
0 10 no no Base
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 2.2.2.2, Interface address 172.16.12.2
Backup Designated router (ID) 1.1.1.1, Interface address 172.16.12.1
Timer intervals configured, Hello 5, Dead 20, Wait 20, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:00
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 2
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 1.1.1.1 (Backup Designated Router)
Suppress hello for 0 neighbor(s)

R2#show ip ospf database //查看ospf数据库

Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 1945 0x80000003 0x002FFF 1
2.2.2.2 2.2.2.2 1925 0x80000004 0x003FFC 3
3.3.3.3 3.3.3.3 1926 0x80000003 0x0058D4 2
4.4.4.4 4.4.4.4 1926 0x80000003 0x009281 2

Link ID ADV Router Age Seq# Checksum
172.16.12.2 2.2.2.2 1944 0x80000001 0x00BB9F
172.16.234.2 2.2.2.2 1925 0x80000001 0x009DC2

Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 1.1.1.1 1970 0x80000001 0x001D91 1

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值