vlan间路由--三层交换机实现vlan间通信
接上片
三层交换机实现vlan间通信
LSW1看成是三层交换机
[core_sw]vlan batch 100 200 [core_sw]interface GigabitEthernet 0/0/1 [core_sw-GigabitEthernet0/0/1]port link-type trunk [core_sw-GigabitEthernet0/0/1]port trunk allow-pass vlan 100 200 [core_sw]interface Vlanif 100 //进入vlanif模式,直接配置ip地址。当然该接口工作的前提是:有接口被划入了该接口vlan或者trunk链路允许了该vlan通过 [core_sw-Vlanif100]ip address 192.168.1.254 24 [core_sw]interface Vlanif 200 [core_sw-Vlanif200]ip address 192.168.2.254 24 [core_sw]display port vlan active T=TAG U=UNTAG --------------------------------------------------------------------- Port Link Type PVID VLAN List --------------------------------------------------------------------- GE0/0/1 trunk 1 U: 1 [core_sw]display interface brief T: 100 200 InUti/OutUti: input utility/output utility Interface PHY Protocol InUti OutUti inErrors outErrors GigabitEthernet0/0/1 up up 0% 0% 0 0 GigabitEthernet0/0/2 down down 0% 0% 0 0 MEth0/0/1 down down 0% 0% 0 0 NULL0 up up(s) 0% 0% 0 0 Vlanif1 up down -- -- 0 0 Vlanif100 up up -- -- 0 0 Vlanif200 up up -- -- 0 0 [core_sw]display ip routing-table Route Flags: R - relay, D - download to fib --------------------------------------------------------------------- Routing Tables: Public Destinations : 6 Routes : 6 Destination/Mask Proto Pre Cost Flags NextHop Interface 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.1.0/24 Direct 0 0 D 192.168.1.254 Vlanif100 192.168.1.254/32 Direct 0 0 D 127.0.0.1 Vlanif100 192.168.2.0/24 Direct 0 0 D 192.168.2.254 Vlanif200 192.168.2.254/32 Direct 0 0 D 127.0.0.1 Vlanif200
查看vlanif配置
[core_sw]display interface Vlanif Vlanif1 current state : UP Line protocol current state : DOWN Description: Route Port,The Maximum Transmit Unit is 1500 Internet protocol processing : disabled IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc1d-698d Current system time: 2020-05-29 15:05:44-08:00 Input bandwidth utilization : -- Output bandwidth utilization : -- Vlanif100 current state : UP Line protocol current state : UP Last line protocol up time : 2020-05-29 14:56:00 UTC-08:00 Description: Route Port,The Maximum Transmit Unit is 1500 Internet Address is 192.168.1.254/24 IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc1d-698d Current system time: 2020-05-29 15:05:44-08:00 Input bandwidth utilization : -- Output bandwidth utilization : -- Vlanif200 current state : UP Line protocol current state : UP Last line protocol up time : 2020-05-29 14:56:00 UTC-08:00 Description: Route Port,The Maximum Transmit Unit is 1500 Internet Address is 192.168.2.254/24 IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc1d-698d Current system time: 2020-05-29 15:05:44-08:00 Input bandwidth utilization : -- Output bandwidth utilization : --
二层交换机LSW2配置
[sw1]vlan batch 100 200 [sw1]interface Eth0/0/1 [sw1-Ethernet0/0/1]port link-type trunk//与三层交换机连接,配置trunk模式 [sw1-Ethernet0/0/1]port trunk allow-pass vlan 100 200 //允许vlan 100,200通过 [sw1]interface Eth0/0/2 [sw1-Ethernet0/0/2]port link-type access [sw1-Ethernet0/0/2]port default vlan 100 [sw1]interface Eth0/0/3 [sw1-Ethernet0/0/3]port link-type access [sw1-Ethernet0/0/3]port default vlan 200 [sw1]display port vlan active T=TAG U=UNTAG --------------------------------------------------------------------- Port Link Type PVID VLAN List --------------------------------------------------------------------- Eth0/0/1 trunk 1 U: 1 T: 100 200 Eth0/0/2 access 100 U: 100 Eth0/0/3 access 200 U: 200 Eth0/0/4 hybrid 1 U: 1
Pc1配置,ping网关和pc2
现网应用最多的方案是单臂路由(适合中小型企业网络)和VLANIF(适合于大中型企业网络)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构