三层交换机路由配置

ぃ、小莉子 提交于 2019-12-04 00:19:57

目的:

1.用三层交换机配置静态路由实现不同vlan间通信
2.rip动态路由配置
3.ospf动态路由配置
4.默认路由配置

拓扑图:

三层交换机配置静态路由拓扑图

步骤:

1.配置静态路由

一:给两台pc设置IP、掩码和网关
pc0:192.168.1.2 255.255.255.0
pc1:192.168.2.2 255.255.255.0

二:给两台三层交换机划分vlan、注意:两台交换机连线处vlan可以不同。
s0:
enable
configure terminal
vlan 2
exit
vlan 3
exit
interface fa0/1
switchport access vlan 2 —–主机划分到vlan2
interface fa0/2
switchport access vlan 3
interface vlan 2
ip address 192.168.1.1 255.255.255.0
interface vlan 3
ip address 192.168.3.1 255.255.255.0

s1:
enable
configure terminal
vlan 4
exit
vlan 3
exit
interface fa0/1
switchport access vlan 3
interface fa0/2
switchport access vlan 4 ——-主机划分到vlan4
interface vlan 3
ip address 192.168.3.2 255.255.255.0
interface vlan 4
ip address 192.168.2.1 255.255.255.0

三、配置静态路由和开启路由功能。配置静态路由命令为ip route 目的IP网络号 掩码 下一跳地址
s0:
enable
configure terminal
ip route 192.168.2.0 255.255.255.0 192.168.3.2 ——配置静态路由,目的地址是网段,还可以是具体某一IP,但是掩码必须为255.255.255.255,表示标志唯一的IP。
ip routing

s1:
enable
configure terminal
ip route 192.168.1.0 255.255.255.0 192.168.3.1 ——配置静态路由,目的地址是网段
ip routing

完整实验:
https://download.csdn.net/download/qq_39414668/10279187

2.rip动态路由配置:删除静态路由里配置的静态路由,其它不变,然后配置rip

步骤:
s0:
enable
configure terminal
no ip route 192.168.2.2 255.255.255.0 192.168.3.2
router rip
network 192.168.1.0 ——宣告直连网络
network 192.168.3.0

s1:
enable
configure terminal
no ip route 192.168.1.2 255.255.255.0 192.168.3.1
router rip
network 192.168.2.0 ——宣告直连网络
network 192.168.3.0

完整实验:
https://download.csdn.net/download/qq_39414668/10279292

3.ospf动态路由配置:删除静态路由里配置的静态路由,其它不变,然后配置rip

s0:
enable
configure terminal
no ip route 192.168.2.2 255.255.255.0 192.168.3.2
router ospf 1 —–1是进程号
network 192.168.1.0 0.0.0.255 area 0 ——宣告直连网络,掩码为反掩码
network 192.168.3.0 0.0.0.255 area 0

s1:
enable
configure terminal
no ip route 192.168.1.2 255.255.255.0 192.168.3.1
router rip
network 192.168.2.0 0.0.0.255 area 0 ——宣告直连网络
network 192.168.3.0 0.0.0.255 area 0

完整实验:
https://download.csdn.net/download/qq_39414668/10279502

4.默认路由配置:删除静态路由里配置的静态路由,其它不变,然后配置默认路由

s0:
enable
configure terminal
no ip route 192.168.2.2 255.255.255.0 192.168.3.2
ip route 0.0.0.0 0.0.0.0 192.168.3.2

s1:
enable
configure terminal
no ip route 192.168.1.2 255.255.255.0 192.168.3.1
ip route 0.0.0.0 0.0.0.0 192.168.3.1

完整实验:
https://download.csdn.net/download/qq_39414668/10279512

注:

1.删除vlan里的IP要用no ip address,用no ip address 具体IP 掩码 是无效的
2.路由器是基于端口的,三层交换机是基于vlan的。建议做是实验对比。

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!