实验拓扑:
实验步骤:
[SW1]vlan batch 10 20 创建vlan
[SW1]interface GigabitEthernet 0/0/1 进入接口
[SW1-GigabitEthernet0/0/1]port link-type access 修改链路
[SW1-GigabitEthernet0/0/1]port default vlan 10 加入vlan
[SW1]interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 20
[SW1]interface Vlanif 10 进入vlan
[SW1-Vlanif10]ip address 192.168.10.254 24 配置网关地址
[SW1-Vlanif10]undo shutdown 开启
[SW1]interface Vlanif 20
[SW1-Vlanif20]ip address 192.168.20.254 24
[SW1-Vlanif20]undo shutdown
[AR1]interface GigabitEthernet 0/0/0.1 进入子接口
[AR1-GigabitEthernet0/0/0.1]ip address 192.168.10.254 24 配置网关地址
[AR1-GigabitEthernet0/0/0.1]dot1q termination vid 10 配置能识别的vlan标签
[AR1-GigabitEthernet0/0/0.1]arp broadcast enable 开启子接口的arp 广播功能
[AR1]interface GigabitEthernet 0/0/0.2
[AR1-GigabitEthernet0/0/0.2]ip address 192.168.20.254 24
[AR1-GigabitEthernet0/0/0.2]dot1q termination vid 20
[AR1-GigabitEthernet0/0/0.2]arp broadcast enable
[SW1]interface GigabitEthernet 0/0/5 进入接口
[SW1-GigabitEthernet0/0/5]port link-type trunk 修改链路
[SW1-GigabitEthernet0/0/5]port trunk allow-pass vlan 10 20 加入vlan
<AR1>display ip routing-tale 查看路由表
思路;
1、PC机的配置
2、创建vlan 进入接口修改链路 加入valn 进入vlanif 配置网关地址
3、进入子接口 配置子接口地址 配置vlan标签协议 开启子接口的arp
4、需改trunk链路