路由重发布发生在边界路由上。当路由的两个端运行不同的路由协议时需要配置。拓扑图如下,中间路由器的两端分别使用不同的路由协议ospf、RIP,需要通过重发布配置使两端的网络连通。
二层交换机:(两端完全一样)
en
conf t
vl 10
vl 20
in f 0/1 //将交换机的端口1设置为Vlan10的Access口
sw ac v 10
in f 0/11
sw ac v 20
in g 0/1
sw m t //设置trunk默认允许所有的Vlan包通过
左侧路由:
en
conf t
in f 1/0
no sh
in f 1/0.1 //子接口封装成dot1q,即Vlan10
en d 10 //只有封装后,子接口才能配置IP地址
ip ad 192.168.10.1 255.255.255.0
in f 1/0.2 //子接口封装成dot1q,即Vlan20
en d 20
ip ad 192.168.11.1 255.255.255.0
in f 0/0
no sh
ip ad 1.1.1.1 255.255.255.252 //使用 /30的掩码
ro ospf 1 //进入OSPF协议配置模式
net 192.168.10.0 0.0.0.255 area 0 //发布192.168.10.0网段,骨干区域0
net 192.168.11.0 0.0.0.255 a 0 //0.0.0.255是通配符(主机掩码),表
//示: 192.168.10.0网段里的所有主机发的数
//据包都可以通过
net 1.1.1.0 0.0.0.3 a 0
右侧路由:
en
conf t
in f 1/0
no sh
in f 1/0.1
en d 10
ip ad 192.168.12.1 255.255.255.0
in f 1/0.2
en d 20
ip ad 192.168.13.1 255.255.255.0
in s2/0
no sh
ip ad 1.1.2.2 255.255.255.252
ro rip //进入RIP协议配置模式
ver 2 //版本2(支持VLAM无类)
net 192.168.12.0 //发布192.168.10.0网段(凡连接的网段都要发布)
net 192.168.13.0
net 1.1.2.0
中间路由:
en
conf t
in f 1/0
no sh
ip ad 192.168.14.1 255.255.255.0
in f 0/0
no sh
ip ad 1.1.1.2 255.255.255.252
in s2/0
no sh
ip ad 1.1.2.1 255.255.255.252
ro ospf 1 //进入OSPF协议配置模式
net 192.168.14.0 0.0.0.255 area 0 //发布192.168.10.0网段,骨干区域0
net 1.1.1.0 0.0.0.3 a 0
re rip metric 3 sub //重发布RIP协议到OSPF区域,并支持无类路由
ro rip //进入RIP协议配置模式
ver 2
net 1.1.2.0
re os 1 metric 3 //重发布OSPF协议到RIP区域
涉及的英文基本单词
distribute:分配,分发 redistribute:重分配(重发布)
enable:使能,使实现 encapsulation:封装 configure:配置
动态路由协议:
RIP (Routing Information Protocol):路由信息协议,适用于小规模的网络环境,主要用于一个AS(自治系统)内的路由信息的传递。属于:内部网关协议(Interior Gateway Protocol,简称IGP)
OSPF(Open Shortest Path First):开放式最短路径优先协议,属于:内部网关协议