VLAN 间路由的几种方法
![](http://images0.cnblogs.com/blog2015/744061/201504/282233003968175.jpg)
第一步,PC设置IP地址和网关
192.168.2.2/24 网关是192.168.2.1
192.168.3.2/24 网关是192.168.3.1
第二步,交换机创建VLAN,划分VLAN,
[sw]vlan batch 2 3[sw]int e0/0/1
[sw-Ethernet0/0/1]port lin ac
[sw-Ethernet0/0/1]port def vlan 2
[sw-Ethernet0/0/1]int e0/0/2
[sw-Ethernet0/0/2]port lin ac
[sw-Ethernet0/0/2]port def vlan 2[sw-Ethernet0/0/2]int e0/0/3
[sw-Ethernet0/0/3]port lin ac
[sw-Ethernet0/0/3]port def vlan 3
[sw-Ethernet0/0/3]int e0/0/4
[sw-Ethernet0/0/4]port lin ac
[sw-Ethernet0/0/4]port def vlan 3
第三步,路由器配置接口地址
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.2.1 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.3.1 24
![](http://images0.cnblogs.com/blog2015/744061/201504/282233485215639.jpg)
第一步,PC设置IP地址和网关
192.168.2.2/24 网关是192.168.2.1
192.168.3.2/24 网关是192.168.3.1
第二步,交换机创建VLAN,划分VLAN,
[sw]vlan batch 2 3[sw-Ethernet0/0/1]int e0/0/2[sw-Ethernet0/0/2]port lin ac
[sw-Ethernet0/0/2]port def vlan 2[sw-Ethernet0/0/2]int e0/0/3[sw-Ethernet0/0/3]port lin ac
[sw-Ethernet0/0/3]port def vlan 3第三步,交换机连接路由器的端口设置为trunk模式
[sw]int e0/0/1
[sw-Ethernet0/0/1]port lin tr
[sw-Ethernet0/0/1]port tr al vlan all
第四步,路由器配置子接口
[Huawei]int g0/0/0.20 这个编号是随意的
[Huawei-GigabitEthernet0/0/0.20]dot1q termination vid 2 封装的VLAN,你为VLAN服务,就封装VLAN
[Huawei-GigabitEthernet0/0/0.20]ip add 192.168.2.1 24 这个地址就是网关地址
[Huawei-GigabitEthernet0/0/0.20]arp broadcast enable 允许ARP广播
[Huawei-GigabitEthernet0/0/0.20]int g0/0/0.30
[Huawei-GigabitEthernet0/0/0.30]d t v 3
[Huawei-GigabitEthernet0/0/0.30]ip add 192.168.3.1 24
[Huawei-GigabitEthernet0/0/0.30]arp b e
![](http://images0.cnblogs.com/blog2015/744061/201504/282239351611238.jpg)
[Huawei]sys sw
[sw]vlan b 2 3
[sw]int g0/0/1
[sw-GigabitEthernet0/0/1]port lin ac
[sw-GigabitEthernet0/0/1]port def vlan 2
[sw-GigabitEthernet0/0/1]int g0/0/2
[sw-GigabitEthernet0/0/2]port lin ac
[sw-GigabitEthernet0/0/2]port def vlan 3第三步,在交换机上创建SVI接口(交换虚拟接口)有几个VLAN就创建几个,这个接口就是VLAN的网关地址
[sw-GigabitEthernet0/0/2]int vlan 2
[sw-Vlanif2]ip add 192.168.2.1 24
[sw-Vlanif2]int vlan 3
[sw-Vlanif3]ip add 192.168.3.1 24
posted on 2015-04-28 22:40 hotshotgg 阅读(1277) 评论(0) 编辑 收藏 举报