PC1;
PC2;
R1:
[Huawei]int g0/0/0 [Huawei-GigabitEthernet0/0/0]ip address 192.168.10.254 24[Huawei]int g0/0/1 [Huawei-GigabitEthernet0/0/1]ip address 12.1.1.1 24[Huawei]rip 1[Huawei-rip-1]undo summary[Huawei-rip-1]version 2[Huawei-rip-1]network 192.168.10.0[Huawei-rip-1]network 12.0.0.0[Huawei-rip-1]silent-interface g0/0/0//配置静默接口
R2:
[Huawei]int g0/0/0 [Huawei-GigabitEthernet0/0/0]ip address 12.1.1.2 24[Huawei]int g0/0/1 [Huawei-GigabitEthernet0/0/1]ip address 23.1.1.2 24[Huawei]rip 1[Huawei-rip-1]undo summary[Huawei-rip-1]version 2[Huawei-rip-1]import-route ospf 1//rip里引入ospf[Huawei-rip-1]network 12.0.0.0[Huawei]ospf 1 [Huawei-ospf-1]import-route rip 1//ospf里引入rip[Huawei-ospf-1]area 0[Huawei-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
R3:
[Huawei]int g0/0/1 [Huawei-GigabitEthernet0/0/1]ip address 192.168.20.254 24[Huawei]int g0/0/0[Huawei-GigabitEthernet0/0/0]ip address 23.1.1.3 24[Huawei]ospf 1 [Huawei-ospf-1]area 0[Huawei-ospf-1]network 23.1.1.3 0.0.0.0[Huawei-ospf-1]network 192.168.20.254 0.0.0.0[Huawei-ospf-1]silent-interface g0/0/1
R1上dis ip rou查看路由表,发现通过rip学到了ospf区域内网段的路由
单臂路由是指在路由器的一个接口上通过配置子接口(或“逻辑接口”,并不存在真正物理接口)的方式,实现原来相互隔离的不同VLAN(虚拟局域网)之间的互联互通
单臂路由实现不同vlan间通信,要运用单臂路由器的子接口作为pc的网关,切记子接口建立后要开启arp的广播功能
pc1:
pc2:
LSW1:
[Huawei]vlan batch 10 20[Huawei]int e0/0/1[Huawei-Ethernet0/0/1]port link-type access[Huawei-Ethernet0/0/1]port default vlan 10[Huawei]int e0/0/2[Huawei-Ethernet0/0/2]port link-type access[Huawei-Ethernet0/0/2]port default vlan 20[Huawei]int e0/0/3[Huawei-Ethernet0/0/3]port link-type trunk[Huawei-Ethernet0/0/3]port trunk allow-pass vlan 10 20
AR1:
[Huawei]int g0/0/0.1[Huawei-GigabitEthernet0/0/0.1]dot1q termination vid 10//vlan几就设几,比如我是vlan10,这vid就是10[Huawei-GigabitEthernet0/0/0.1]ip address 192.168.10.254 255.255.255.0 [Huawei-GigabitEthernet0/0/0.1]arp broadcast enable[Huawei]int g0/0/0.2[Huawei-GigabitEthernet0/0/0.2]dot1q termination vid 20[Huawei-GigabitEthernet0/0/0.2]ip address 192.168.20.254 255.255.255.0 [Huawei-GigabitEthernet0/0/0.2]arp broadcast enable
pc1 ping 通了pc2,实验成功
三层交换机的虚拟接口svi作为pc的网关,也可实现不同vlan的通信,这也是生产中经常用到的技术,VLANIF接口是基于网络层的接口,可以配置IP地址。借助VLANIF接口,三层交换机就能实现路由转发功能,我经常把三层交换机理解为路由器
LSW2:
[Huawei]vlan batch 10 20[Huawei]int g0/0/2[Huawei-GigabitEthernet0/0/2]port link-type access[Huawei-GigabitEthernet0/0/2]port default vlan 10[Huawei]int g0/0/3[Huawei-GigabitEthernet0/0/3]port link-type access[Huawei-GigabitEthernet0/0/3]port default vlan 20[Huawei]int vlan 10[Huawei-Vlanif10]ip address 192.168.10.254 24[Huawei]int vlan 20[Huawei-Vlanif20]ip address 192.168.20.254 24
pc3能ping通pc4
上个博客有,大家点击链接参考:基于ensp的小型局域网网络搭建及需求分析(二)的4.1vlan划分和实现不同vlan间的通信部分:
有什么不明白的欢迎随时私信或评论区d我