生活的道路一旦选定,就要勇敢地走到底,决不回头。

首页 » 阅读时间 » 科技 » EdgeMax 配置 OSPF(命令行)

EdgeMax 配置 OSPF(命令行)

发布时间:2022年11月20日 修改时间:2024年05月15日 已有 63889 人围观

1.ospf 配置方式 1

指定 ospf 的区域号(可以用十进制或点分十进制方式表示)并宣告本地网段

set protocols ospf area <区域号> network <x.x.x.x/x>

指定 ospf 的 router-id

set protocols ospf parameters router-id <x.x.x.x>

2.ospf 配置方式 2

指定 ospf 区域号

set protocols ospf area <区域号>

指定 ospf router-id

set protocols ospf parameters router-id <x.x.x.x>

指定 ospf 的邻居

set protocols ospf neighbor <邻居的 ip 地址>

3.ospf 下发默认路由

ospf 下发默认路由,加上 always 为强制下发

set protocols ospf default-information originate

指定下发的默认路由的 metric 值

set protocols ospf default-information originate metric <0-16777214>

指定 ospf 的下发的默认路由的类型为 OE1 还是 OE2

set protocols ospf default-information originate metric-type <1/2>

案例


1.网络拓扑及说明

  • ER3 路由器 eth0 口 IP 地址:168.1.1,接在一台 TS8 交换机上面配置一个 lo0,IP 地址:10.10.1.1 用于本地网段测试。
  • TS8 接 ER3,和 ER5,下接一台电脑
  • ER5-A 路由器 eth0 口 IP 地址:168.1.2,接在 TS8 上,eth1 口 IP 地址:192.168.2.1 连接 ER5-B 路由器的 eth0
  • ER5-B 路由器 eth0 口 IP 地址:168.2.2,配置一个 lo0 口 IP 地址:10.10.2.1 用于本地网段测试。

2.配置

ER3 :

set interfaces ethernet eth0 address 192.168.1.1 set interfaces ethernet eth0 vif 10 description lo0 set interfaces ethernet eth0 vif 10 address 10.10.1.1/32 set protocols ospf area 0 network 192.168.1.0/24 set protocols ospf area 0 network 10.10.1.1/32

ER5-A:

set interfaces ethernet eth0 address 192.168.1.2 set protocols ospf area 0 network 192.168.1.0/24 set interfaces ethernet eth1 address 192.168.2.1 set protocols ospf area 0 network 192.168.2.0/24

ER5-B:

set interfaces ethernet eth0 address 192.168.2.2 set interfaces ethernet eth0 vif 10 description lo0 set interfaces ethernet eth0 vif 10 address 10.10.2.1/32 set protocols ospf area 0 network 192.168.2.0/24 set protocols ospf area 0 network 10.10.2.1/32

3.查看路由表

ER3:ER3 上面已经学习到了 192.168.2.0/24 和 10.10.2.0/24 的网段。

ER5-A:在 ER5-A 上面已经通过 OSPF 学习到了 10.10.1.0/24 和 10.10.2.0/24 网段。

ER5-B:ER5-B 已经通过 OSPF 协议学习到了 10.10.1.0/24 和 192.168.1.0/24 网段

4.测试连通性

ER3:在 ER3 上面 ping192.168.2.2 和 10.10.2.1,可以 ping 通,证明 ER3 以到达这两个网段。

ER5-A:ping 10.10.1.1 和 10.10.2.1,可以 ping 通,证明 ER5-A 可以到达这两个网段

PC: