H3C的vlan间路由

模型:

交换机的配置:

[SW1]vlan 10

[SW1-vlan10]vlan 20  创建vlan 10和vlan 20

[SW1-GigabitEthernet1/0/2]port link-type access

[SW1-GigabitEthernet1/0/2]port access vlan 10  端口配置到vlan 10

[SW1]int gi 1/0/3
[SW1-GigabitEthernet1/0/3]port link-type access

[SW1-GigabitEthernet1/0/3]port access vlan 20  端口配置到vlan 20

接入路由的端口配置:trunk

[SW1]int gi 1/0/1

[SW1-GigabitEthernet1/0/1]port link-type trunk

[SW1-GigabitEthernet1/0/1]port trunk permit vlan 10 20  端口模式为trunk,配置到vlan 10和vlan 20

 

路由器的配置:

与交换机相接的端口需要配置子端口

[R1]int gi 0/0
[R1-GigabitEthernet0/0]undo shutdown  确认端口开启

[R1]int gi 0/0.10  进入子端口

[R1-GigabitEthernet0/0.10]ip add 192.168.10.1 24  配置端口ip

[R1-GigabitEthernet0/0.10]vlan-type dot1q vid 10  配置该子端口为vlan 10服务
[R1-GigabitEthernet0/0.10]dis this
#
interface GigabitEthernet0/0.10
ip address 192.168.10.1 255.255.255.0
vlan-type dot1q vid 10
#

[R1]int gi 0/0.20
[R1-GigabitEthernet0/0.20]ip add 192.168.20.1 24
[R1-GigabitEthernet0/0.20]vlan-type dot1q vid 20
[R1-GigabitEthernet0/0.20]dis this
#
interface GigabitEthernet0/0.20
ip address 192.168.20.1 255.255.255.0
vlan-type dot1q vid 20
#

以上

配置完以后pc1和pc2可以跨vlan通信

pc1配置

ip 192.168.10.2/24

路由 ip routing-table 0.0.0.0 0 192.168.10.1

pc2配置

ip 192.168.20.2/24

路由 ip routing-table 0.0.0.0 0 192.168.20.1

 

实际上三层交换机有路由功能:可以在交换机上直接配置

int vlan 10   创建虚拟接口并未接口配置ip

  ip add 192.168.10.1 24

int vlan 20 

  ip add 192.168.20.1 24

posted on 2018-12-17 14:06  fishlineasy  阅读(4287)  评论(0编辑  收藏  举报

导航