前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >3层交换技术

3层交换技术

作者头像
py3study
发布2020-01-09 17:10:16
3480
发布2020-01-09 17:10:16
举报
文章被收录于专栏:python3

我们知道不同的vlan之间要相互的通行必须要借用第三层,也就是网络层,可以路由器也可以是三层的交换机。三层拓扑图

图1-6

创建Vlan并设置为服务端

Switch>en

Switch#vlan database

Switch(vlan)#vlan 2 name vlan2

VLAN 2 added:

Name:vlan2

Switch(vlan)#vlan 3 name vlan3

VLAN 3 added:

Name:vlan3

Switch(vlan)#vtp server

Switch(vlan)#vtp domain lcl

VTP domain lcl modified

Switch(vlan)#exit

APPLY completed.

Exiting....

设f0/1为干道

Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#int f0/1

Switch(config-if)#switchport trunk encapsulation dot1q

Switch(config-if)#switchport mode trunk

Switch(config-if)#end

进入vlan配置ip

Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#ip routing

Switch(config)#int vlan 2

Switch(config-if)#ip address 192.168.2.1 255.255.255.0

Switch(config-if)#no shut

Switch(config-if)#exit

Switch(config)#int vlan 3

Switch(config-if)#ip address 192.168.3.1 255.255.255.0

Switch(config-if)#no shut

Switch(config-if)#exit

设置为客户端

Switch>en

Switch#vlan database

Switch(vlan)#vtp client

Switch(vlan)#vtp domain lcl

Changing VTP domain from NULL to lcl

Switch(vlan)#exit

APPLY completed.

Exiting....

设f0/1为干道

Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#int f0/1

Switch(config-if)#switchport trunk encapsulation dot1q

Switch(config-if)#switchport mode trunk

Switch(config-if)#end

端口加入Vlan

Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#int f0/2

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 2

Switch(config-if)#exit

Switch(config)#int f0/2

Switch(config-if)#exit

Switch(config)#int f0/3

Switch(config-if)#switchport mode access

Switch(config-if)#switchport access vlan 3

Switch(config-if)#end

结果两个不同vlan的两台PC互ping成功

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/08/25 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档