目录
实验拓扑
实验要求
根据图划分vlan,并通过DHCP给主机下发IP地址,全网可达
实验步骤
1、交换机创建vlan
bash
[SW1]vlan batch 2 to 3
[SW2]vlan batch 2 to 3
2、交换机上的各个接口划分到对应vlan中
bash
[SW1]int e0/0/3
[SW1-Ethernet0/0/3]port link-type access 先将该接口修改为接入模式
[SW1-Ethernet0/0/3]port default vlan 2 再将其划分到对应vlan中
[SW1-Ethernet0/0/3]int e0/0/4
[SW1-Ethernet0/0/4]port link-type access
[SW1-Ethernet0/0/4]port default vlan 2
[SW1]port-group group-member e0/0/5 to e0/0/6
[SW1-port-group]port link-type access
[SW1-Ethernet0/0/5]port link-type access
[SW1-Ethernet0/0/6]port link-type access
[SW1-port-group]port default vlan 3
[SW1-Ethernet0/0/5]port default vlan 3
[SW1-Ethernet0/0/6]port default vlan 3
[SW2]int e0/0/2
[SW2-Ethernet0/0/2]port link-type access
[SW2-Ethernet0/0/2]port default vlan 2
[SW2-Ethernet0/0/2]int e0/0/3
[SW2-Ethernet0/0/3]port link-type access
[SW2-Ethernet0/0/3]port default vlan 3
3、trunk干道
bash
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]port link-type trunk
[SW1-Ethernet0/0/1]port trunk allow-pass vlan 2 to 3
[SW1-Ethernet0/0/2]port link-type trunk
[SW1-Ethernet0/0/2]port trunk allow-pass vlan 2 to 3
[SW2-Ethernet0/0/3]int e0/0/1
[SW2-Ethernet0/0/1]port link-type trunk
[SW2-Ethernet0/0/1]port trunk allow-pass vlan 2 to 3
4、路由器单臂路由
bash
[route]int g0/0/0.1 创建物理接口对应的子接口
[route-GigabitEthernet0/0/0.1]dot1q termination v 2 定义其管理的vlan标记号
[route-GigabitEthernet0/0/0.1]ip add 192.168.1.1 24 配置该网段网关ip地址
[route-GigabitEthernet0/0/0.1]arp broadcast enable 需要手工开启子接口ARP功能
5、路由器DHCP设置
bash
[route-GigabitEthernet0/0/0]ip add 192.168.2.2 24
[route]dhcp enable
[route]ip pool v2
[route-ip-pool-v2]network 192.168.1.0 mask 24
[route-ip-pool-v2]gateway-list 192.168.1.1
[route-ip-pool-v2]dns-list 114.114.114.114
[route-ip-pool-v2]int g0/0/0.1
[route-GigabitEthernet0/0/0.1]dhcp select global
[route]ip pool v3
[route-ip-pool-v3]network 192.168.2.0 mask 24
[route-ip-pool-v3]gateway-list 192.168.2.2
[route-ip-pool-v3]dns-list 114.114.114.114
[route-ip-pool-v3]int g0/0/0
[route-GigabitEthernet0/0/0]dhcp select global
实验测试
实现了不同vlan之间无法相互通信,同一vlan内可相互通信的效果!!!
华为交换机更换端口连接模式报错处理:
[SW1-Ethernet0/0/5]undo port link-type
Error: Please renew the default configurations.
需要先删除端口其他配置后再重新变更端口类型。
比如配置的时候为:
port link-type trunk
port trunk allow-pass vlan 2 to 3
如果直接更改端口模式就会报错为Error: Please renew the default configurations.
所以如果出现这种错误,在这里就需要从后往前删除,即:
[SW1-Ethernet0/0/5]undo port trunk allow-pass vlan 2 to 3
[SW1-Ethernet0/0/5]undo port link-type