当前位置:首页 > 原创教程 > H3C三层交换机配置OSPF动态路由

H3C三层交换机配置OSPF动态路由

原创教程 / 星之宇 / 2024-10-18 10:04 / 浏览:526 / 评论:0

开放式最短路径优先(Open Shortest Path First,OSPF)是广泛使用的一种动态路由协议,它属于链路状态路由协议,具有路由变化收敛速度快、无路由环路、支持变长子网掩码(VLSM)和汇总、层次区域划分等优点。


本文主要讲三层交换机配置OSPF动态路由

1、环境介绍

1.1 网络拓扑图

494-1.png


1.2 设备IP信息

区域 设备 VLAN IP 网关
A区 R1交换机 5 192.168.1.1/24 -
A区 PC_1 10 192.168.10.10/23 192.168.10.1
A区 PC_2 20 192.168.20.20/24 192.168.20.1
B区 R2交换机 5 192.168.1.2/24 -
B区 PC_3 30 192.168.30.30/23 192.168.30.1
B区 PC_4 40 192.168.40.40/224 192.168.40.1


2、交换机配置

2.1 R1交换机vlan配置以及端口划分

<H3C>sys
[H3C]hotname R1
[R1]vlan 5
[R1-vlan5]quit
[R1]int vlan 5
[R1-Vlan-interface5]ip address 192.168.1.1 255.255.255.0
[R1-Vlan-interface5]quit
[R1]vlan 10
[R1-vlan10]quit
[R1]int vlan 10
[R1-Vlan-interface10]ip address 192.168.10.1 255.255.254.0
[R1-Vlan-interface10]quit
[R1]vlan 20
[R1-vlan20]quit
[R1]int vlan 20
[R1-Vlan-interface20]ip address 192.168.20.1 255.255.255.0
[R1-Vlan-interface20]quit
[R1]int f1/0/53
[R1-FortyGigE1/0/53]port link-type access
[R1-FortyGigE1/0/53]port access vlan 5
[R1-FortyGigE1/0/53]quit
[R1]int range g1/0/1 to g1/0/8
[R1-if-range]port link-type access
[R1-if-range]port access vlan 10
[R1]int range g1/0/9 to g1/0/16
[R1-if-range]port link-type access
[R1-if-range]port access vlan 20


2.2 R2交换机vlan配置

<H3C>sys
[H3C]hotname R2
[R2]vlan 5
[R2-vlan5]quit
[R2]int vlan 5
[R2-Vlan-interface5]ip address 192.168.1.2 255.255.255.0
[R2-Vlan-interface5]quit
[R2]vlan 30
[R2-vlan10]quit
[R2]int vlan 30
[R2-Vlan-interface30]ip address 192.168.30.1 255.255.254.0
[R2-Vlan-interface30]quit
[R2]vlan 40
[R2-vlan40]quit
[R2]int vlan 40
[R2-Vlan-interface40]ip address 192.168.40.1 255.255.255.0
[R2-Vlan-interface40]quit
[R2]int f1/0/53
[R2-FortyGigE1/0/53]port link-type access
[R2-FortyGigE1/0/53]port access vlan 5
[R2-FortyGigE1/0/53]quit
[R2]int range g1/0/1 to g1/0/24
[R2-if-range]port link-type access
[R2-if-range]port access vlan 30
[R2]int range g1/0/25 to g1/0/48
[R2-if-range]port link-type access
[R2-if-range]port access vlan 40


2.3 R1交换机OSPF设置

[R1]ospf
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]network 192.168.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]network 192.168.10.0 0.0.1.255
[R1-ospf-1-area-0.0.0.1]network 192.168.20.0 0.0.0.255
[R1-ospf-1-area-0.0.0.1]quit
[R1-ospf-1]quit


2.4 R2交换机OSPF设置

[R2]ospf
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]network 192.168.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.1]network 192.168.30.0 0.0.1.255
[R2-ospf-1-area-0.0.0.1]network 192.168.40.0 0.0.0.255
[R2-ospf-1-area-0.0.0.1]quit
[R2-ospf-1]quit


3、交换机状态

3.1 R1 ospf状态和路由表

494-2.png


3.2 R2 ospf状态和路由表

494-3.png

目前有 0 条评论

    • 昵称
    • 邮箱
    • 网址