当前位置: 首页 > news >正文

【实操】配置VLAN间路由

原创:厦门微思网络

点击查看【相关学习】

【干货】什么是VLAN?

【技术分享】常见VLAN部署方式

【必看】华为设备配置单臂路由实现VLAN间通信

实验目的

1. 理解VLAN间路由的原理

2. 掌握VLAN间路由的配置方法

实验拓扑

图片

实验需求

1、根据实验拓扑图,完成设备的基本配置;

2、配置单臂路由实现VLAN10和VLAN20之间的互访。

实验步骤

步骤1:设备的基本配置

配置PC1:

VPCS> set pcname PC1   //设置主机名PC1> ip 192.168.1.1/24 192.168.1.254    //设置IP地址与网关

配置PC2

VPCS> set pcname PC2PC2> ip 172.16.1.1/24 172.16.1.254

配置R1:

Router>enableRouter#configure terminalRouter(config)#hostname R1R1(config)#no ip domain-lookupR1(config)#line console 0R1(config-line)#exec-timeout 0 0R1(config-line)#logging synchronousR1(config-line)#endR1#

配置SW1

Switch>enableSwitch#configure terminalSwitch(config)#hostname SW1SW1(config)#no ip domain-lookupSW1(config)#line console 0SW1(config-line)#exec-timeout 0 0SW1(config-line)#logging synchronousSW1(config-line)#endSW1#

步骤2:单臂路由的配置

配置R1

R1(config)#interface Ethernet0/0R1(config-if)#no shutdownR1(config-if)#exitR1(config)#interface Ethernet0/0.10R1(config-if)#encapsulation dot1Q 10R1(config-if)#ip address 192.168.1.254 255.255.255.0R1(config-if)#exitR1(config)#interface Ethernet0/0.20R1(config-if)#encapsulation dot1Q 20R1(config-if)#ip address 172.16.1.254 255.255.255.0R1(config-if)#endR1#

配置SW1

SW1(config)#vlan 10SW1(config-vlan)#name ITSW1(config-vlan)#exitSW1(config)#vlan 20SW1(config-vlan)#name HRSW1(config-vlan)#exitSW1(config)#interface Ethernet0/0SW1(config-if)#switchport trunk encapsulation dot1qSW1(config-if)#switchport mode trunkSW1(config)#interface Ethernet0/1SW1(config-if)#switchport mode accessSW1(config-if)#switchport access vlan 10SW1(config)#interface Ethernet0/2SW1(config-if)#switchport mode accessSW1(config-if)#switchport access vlan 20

实验检查

步骤1:检查R1

检查R1的接口状态:

R1#show ip interface briefInterface                  IP-Address      OK? Method Status                ProtocolEthernet0/0                unassigned      YES unset  up                    up      Ethernet0/0.10192.168.1.254YES manual up                    up      Ethernet0/0.20172.16.1.254YES manual up                    up      Ethernet0/1                unassigned      YES unset  administratively down down    Ethernet0/2                unassigned      YES unset  administratively down down    Ethernet0/3                unassigned      YES unset  administratively down down

检查R1的子接口信息:

R1#showvlansVirtualLAN ID:  1 (IEEE 802.1Q Encapsulation)vLANTrunk Interface:   Ethernet0/0Thisis configured as native Vlan for the following interface(s) :Ethernet0/0ProtocolsConfigured:   Address:              Received:        Transmitted:Ethernet0/0(1)Other0                  200packets, 0 bytes input20packets, 1440 bytes output
VirtualLAN ID:  10 (IEEE 802.1Q Encapsulation)vLANTrunk Interface:   Ethernet0/0.10ProtocolsConfigured:   Address:              Received:        Transmitted:Ethernet0/0.10(10)IP192.168.1.254               14                   9Other0                   372packets, 5232 bytes input12packets, 1056 bytes output
VirtualLAN ID:  20 (IEEE 802.1Q Encapsulation)vLANTrunk Interface:   Ethernet0/0.20ProtocolsConfigured:   Address:              Received:        Transmitted:Ethernet0/0.20(20)IP172.16.1.254                14                   9Other0                   372packets, 5232 bytes input12packets, 1056 bytes output子接口E0/0.10的VLANID是10,IP地址是192.168.1.254;子接口E0/0.20的VLANID是20,IP地址是172.16.1.254。

步骤2:检查SW1

检查SW1的VLAN信息:

SW1#showvlan briefVLANName                             Status    Ports------------------------------------ --------- -------------------------------1default                             active    Et0/310VLAN0010                         active    Et0/120VLAN0020                         active    Et0/21002fddi-default                     act/unsup1003token-ring-default               act/unsup1004fddinet-default                  act/unsup1005trnet-default                    act/unsup

检查SW1的Trunk状态:​​​​​​​

SW1#show interfaces trunkPort        Mode             Encapsulation  Status        Native vlanEt0/0       on               802.1q         trunking      1Port        Vlans allowed on trunkEt0/01-4094Port        Vlans allowed and active in management domainEt0/01,10,20Port        Vlans in spanning tree forwarding state andnot prunedEt0/01,10,20

步骤3:测试网络连通性

PC1访问PC2

PC1> ping 172.16.1.184 bytes from172.16.1.1 icmp_seq=1 ttl=63 time=1.597 ms84 bytes from172.16.1.1 icmp_seq=2 ttl=63 time=1.237 ms84 bytes from172.16.1.1 icmp_seq=3 ttl=63 time=1.975 ms84 bytes from172.16.1.1 icmp_seq=4 ttl=63 time=1.274 ms84 bytes from172.16.1.1 icmp_seq=5 ttl=63 time=1.243 ms
PC1> trace 172.16.1.1traceto 172.16.1.1, 8 hopsmax, pressCtrl+Ctostop 1   192.168.1.254   0.443ms  0.400ms  0.715ms 2   *172.16.1.1   1.938ms (ICMPtype:3, code:3, Destinationportunreachable)通过Trace看到,数据包先到网关(R1),再到PC2。


END

微思网络,始于2002年

专业IT认证培训23年,面向全国招生!

图片


微思-主要课程有:

*网络技术:华为HCIA/ HCIP/HCIE;思科CCNA/CCNP/CCIE

*Linux技术:红帽 RHCE/RHCA

*K8S&容器:CKA/CKS

*数据库:ORACLE OCP/ OCM ;MySQL ;达梦数据库

*虚拟化:VMware VCP/VCAP

*安全认证:CISP体系/CISSP/ CISA;CCSK;CISAW体系

*管理类:PMP 项目管理;软考中/高项;ITIL体系;Togaf

其他课程如:ACP;Azure...

http://www.xdnf.cn/news/738919.html

相关文章:

  • 山洪灾害声光电监测预警解决方案
  • 第六章 进阶14 项目周报的妙用
  • python训练营打卡第39天
  • OAuth详解和应用
  • AI互联网辅助工具
  • 8位单通道数据保存为JPG
  • 【有向图 拓扑排序 】P8405 [COCI 2021/2022 #6] Naboj|普及+
  • 为什么arc中,(cons ‘a (cons 1 (cons “foo“ ‘(b) ))) 是(a 1 “foo“ b)
  • 使用函数证明给定的三个数是否能构成三角形
  • 偏序集、哈斯图、Dilworth
  • 如何做好一份技术文档
  • java25
  • python笔面试题汇总
  • 如何选择合适的培养基过滤器
  • python打卡训练营打卡记录day40
  • 案例分享--血管支架的径向力分布评估--DIC数字图像相关技术用于生物医学-高置信度DIC测量
  • 拉深工艺模块——回转体拉深件毛坯尺寸的确定(一)
  • 初探Linux内核:解锁Linux操作系统的基本核心的奥秘(二)
  • Prevent this information from being displayed to the user 修复方案
  • 涨薪技术|0到1学会性能测试第91课-性能测试过程执行、分析、诊断、调节
  • ASR、TTS与语音克隆技术简介
  • QML 滑动与翻转效果(Flickable与Flipable)
  • 小狼毫输入法雾凇拼音输入方案辅码由默认的部件拆字/拼音输入方案修改为五笔画方案
  • 书送希望 智启未来 —— 赛力斯超级工厂携手渝北和合家园小学校开展公益赠书活动
  • JavaSwing之--JPasswordField
  • 系统设计——状态机模型设计经验
  • Linux ClearOS yum无法使用解决备忘
  • Qt Dial(旋钮)
  • 智慧赋能充电桩管理:我国新能源充电桩建设现状与突破路径
  • 【Doris基础】Apache Doris业务场景全解析:从实时数仓到OLAP分析的完美选择