文档适用产品型号:M6100
在《M6100交换机划分VLAN》文档的基础上配置路由,让二层隔离的终端实现三层互通。
拓扑图如下:
VLAN和对应的IP地址信息如下表:
VLAN |
IP |
网关 |
VLAN 10 |
192.168.10.0/24 |
192.168.10.1 |
VLAN 20 |
192.168.20.0/24 |
192.168.20.1 |
VLAN 30 |
192.168.30.0/24 |
192.168.30.1 |
VLAN和端口的划分与《如何给M6100划分VLAN》文档一致,这里就不再详述。
一、通过Web界面配置
- 进入Routing> VLAN > VLAN Routing中
- 在VLAN ID中选2,IP Address填入192.168.10.1,Subnet Mask填入255.255.255.0,给VLAN 10配置IP地址。然后点ADD添加。
- 重复步骤2的过程,给VLAN 3和VLAN 4各配置一个IP
系统会自动给VLAN 2、3和4各创建一个虚接口0/4/1、0/4/2和0/4/3
- 进入Routing > IP > Basic > IP Configuration,将Routing Mode设为 Enable,将交换机的路由模式打开。
- 进入Routing > Routing Table > Basic > Route Configuration中,可看到交换机的路由表。
- 进入Maintenance > Save Config > Save Configuration中,保存设置,以便交换机重启后仍然保留设置。选上Save Configuration的勾,然后点APPLY。
二、通过命令行配置
(M6100-3S) #vlan database
(M6100-3S) (Vlan)#vlan routing 10
(M6100-3S) (Vlan)#vlan routing 20
(M6100-3S) (Vlan)#vlan routing 30 //开启VLAN10、20、30的路由模式,只有开启了VLAN路由模式,才能给VLAN配置IP地址。
(M6100-3S) (Vlan)#exit
(M6100-3S) #configure
(M6100-3S) (Config)#interface vlan 10 //配置VLAN 10的虚接口
(M6100-3S) (Interface-vlan 10)#ip address 192.168.10.1 255.255.255.0 //给VLAN 2配置IP地址,使用ip address命令
(M6100-3S) (Interface-vlan 10)#exit
(M6100-3S) (Config)#interface vlan 20 //配置VLAN 20的虚接口
(M6100-3S) (Interface-vlan 20)#ip address 192.168.20.1 255.255.255.0
(M6100-3S) (Interface-vlan 20)#exit
(M6100-3S) (Config)#interface vlan 30 //配置VLAN 30的虚接口
(M6100-3S) (Interface-vlan 30)#ip address 192.168.30.1 255.255.255.0
(M6100-3S) (Interface-vlan 30)#exit
(M6100-3S) (Config)#ip routing //开启交换机路由模式
(M6100-3S) (Config)#
(M6100-3S) (Config)#exit
(M6100-3S) #save //保存配置
This operation may take a few minutes.
Management interfaces will not be available during this time.
Are you sure you want to save? (y/n) y
Configuration Saved! |
另外,可使用show ip vlan来查看交换机VLAN的IP地址;用show ip routing来查看交换机路由表。
(M6100-3S) #show ip vlan
MAC Address used by Routing VLANs: 6C:B0:CE:F9:F7:43
Logical
VLAN ID Interface IP Address Subnet Mask
------- -------------- --------------- ---------------
10 vlan 10 192.168.10.1 255.255.255.0
20 vlan 20 192.168.20.1 255.255.255.0
30 vlan 30 192.168.30.1 255.255.255.0
(M6100-3S) #show ip route
Route Codes: R - RIP Derived, O - OSPF Derived, C - Connected, S - Static
B - BGP Derived, IA - OSPF Inter Area
E1 - OSPF External Type 1, E2 - OSPF External Type 2
N1 - OSPF NSSA External Type 1, N2 - OSPF NSSA External Type 2
C 192.168.10.0/24 [0/1] directly connected, vlan 10
C 192.168.20.0/24 [0/1] directly connected, vlan 20
C 192.168.30.0/24 [0/1] directly connected, vlan 30 |
序号 |
日期 |
跟进人 |
内容摘要 |
1 |
2015-2-27 |
Jackie |
文档创建 |