首页 > 代码库 > 华为hybrid-vlan
华为hybrid-vlan
华为hybrid-vlan、三层交换、DHCP
拓扑:
需求:
1.路由器终结vlan
2.交换机间以hybrid方式透传vlan
3.PC以DHCP获取IP
思路:
1.PC的网关在路由器上
2.配置hybrid-vlan
3.配置DHCP
步骤:
路由器AR1:
<Huawei>sy
[Huawei]vlan 10
[Huawei-vlan10]vlan 20 划分vlan
[Huawei-vlan20]int g0/0/1
[Huawei-GigabitEthernet0/0/1]un shut 激活接口
[Huawei-GigabitEthernet0/0/1]int g0/0/1.10
[Huawei-GigabitEthernet0/0/1.10]dot1q termination vid 10 配置封装协议类型
[Huawei-GigabitEthernet0/0/1.10]ip add 192.168.10.1 24 配置IP
[Huawei-GigabitEthernet0/0/1.10]un shut
[Huawei-GigabitEthernet0/0/1.10]arp broadcast enable 开启ARP(必须开启)
[Huawei-GigabitEthernet0/0/1.10]int g0/0/1.20
[Huawei-GigabitEthernet0/0/1.20]dot1q termination vid 20
[Huawei-GigabitEthernet0/0/1.20]ip add 192.168.20.1 24
[Huawei-GigabitEthernet0/0/1.20]un shut
[Huawei-GigabitEthernet0/0/1.20]arp broadcast enable
定义DHCP地址池(两种):
1.基于接口的DHCP:
[Huawei]dhcp enable
[Huawei]int g0/0/1.10
[Huawei-GigabitEthernet0/0/1.10]dhcp select interface
[Huawei-GigabitEthernet0/0/1.10]dhcp server dns-list 8.8.8.8
Vlan10的成员PC通过该方式获取IP
2.基于地址池的DHCP:
[Huawei]ip pool v20
[Huawei-ip-pool-v20]network 192.168.20.0 mask 24 定义网段
[Huawei-ip-pool-v20]gateway-list 192.168.20.1 定义网关
[Huawei-ip-pool-v20]dns-list 8.8.8.8 定义DNS
[Huawei-ip-pool-v20]int g0/0/1.20
[Huawei-GigabitEthernet0/0/1.20]dhcp select global 定义接口
Vlan20的成员PC通过该方式获取IP
交换机LSW1:
<Huawei>sy
[Huawei]vlan 10 配置vlan
[Huawei-vlan10]vlan 20
[Huawei-vlan20]int e0/0/1
[Huawei-Ethernet0/0/1]port hybrid pvid vlan 10
将e0/0/1接口以hybrid端口加入到vlan10
[Huawei-Ethernet0/0/1]port hybrid untagged vlan 10
将e0/0/1接口以untagged的方式加入到vlan10
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port hybrid pvid vlan 20
将e0/0/2接口以hybrid端口加入到vlan20
[Huawei-Ethernet0/0/2]port hybrid untagged vlan 20
将e0/0/2接口以untagged的方式加入到vlan20
[Huawei-Ethernet0/0/2]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port hybrid tagged vlan 10 20
让数据帧通过g0/0/2接口时,带着vlan10 20的标签
[Huawei-GigabitEthernet0/0/2]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port hybrid tagged vlan 10 20
让数据帧通过g0/0/1接口时,带着vlan10 20的标签(起trunk口作用)
LSW2:
<Huawei>sy
[Huawei]vlan 10
[Huawei-vlan10]vlan 20
[Huawei-vlan20]int e0/0/1
[Huawei-Ethernet0/0/1]port hybrid pvid vlan 10
[Huawei-Ethernet0/0/1]port hybrid untagged vlan 10
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port hybrid pvid vlan 20
[Huawei-Ethernet0/0/2]port hybrid untagged vlan 20
[Huawei-Ethernet0/0/2]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port hybrid tagged vlan 10 20
配置完成。
验证:
设置PC获取地址方式为DHCP:
DHCP配置成功,验证数据通信:
C1与C3间通信正常。
C1与C4间通信正常。
C2与C4间通信正常。
C2与C3间通信正常。
配置正确,结束。
本文出自 “分享一些个人经验” 博客,请务必保留此出处http://hyang.blog.51cto.com/9415026/1587166
华为hybrid-vlan