目录
1、当路由器为普通路由器时:
交换机配置:
<SW1>system-view(进入系统模式)
[SW1]vlan batch 10 20(创建多个VLAN)
[SW1]interface Ethernet 0/0/1(进入接口)
[SW1-Ethernet0/0/1]port link-type access(接口accsee类型)
[SW1-Ethernet0/0/1]port default vlan 10(将接口划分到VLAN里)
[SW1-Ethernet0/0/1]quit(退出)
[SW1]interface Ethernet 0/0/22(进入接口)
[SW1-Ethernet0/0/22]port link-type trunk (接口trunk类型)
[SW1-Ethernet0/0/22]port trunk allow-pass vlan 10 20(端口上允许通过的VLAN )
路由器配置
<R1>system-view (进入系统模式)
[R1]interface GigabitEthernet0/0/0(进入接口)
[R1-GigabitEthernet0/0/0]undo shutdown (开启接口)
[R1]interface GigabitEthernet0/0/0.10(进入子接口)
[R1-GigabitEthernet0/0/0.10]vlan-type dot1q 10 default(子接口封装VLAN)
[R1-GigabitEthernet0/0/0.10]ip address 192.168.1.1 255.255.255.0(子接口设置IP地址)
[R1-GigabitEthernet0/0/0.10]quit (退出)
[R1]interface GigabitEthernet0/0/0.20(进入子接口)
[R1-GigabitEthernet0/0/0.20]vlan-type dot1q 20 default(子接口封装VLAN)
[R1-GigabitEthernet0/0/0.20]ip address 192.168.2.1 255.255.255.0(子接口设置IP地址)
[R1-GigabitEthernet0/0/0.20]quit (退出)
2、当路由器为AR路由器时:
交换机配置:
<SW1>system-view(进入系统模式)
[SW1]vlan batch 10 20(创建多个VLAN)
[SW1]interface Ethernet 0/0/1(进入接口)
[SW1-Ethernet0/0/1]port link-type access(接口accsee类型)
[SW1-Ethernet0/0/1]port default vlan 10(将接口划分到VLAN里)
[SW1-Ethernet0/0/1]quit(退出)
[SW1]interface Ethernet 0/0/22(进入接口)
[SW1-Ethernet0/0/22]port link-type trunk (接口trunk类型)
[SW1-Ethernet0/0/22]port trunk allow-pass vlan 10 20(端口上允许通过的VLAN )
路由器配置
<AR1>system-view (进入系统模式)
[AR1]interface GigabitEthernet0/0/0(进入接口)
[AR1-GigabitEthernet0/0/0]undo shutdown (开启接口)
[AR1]interface GigabitEthernet0/0/0.10(进入子接口)
[AR1-GigabitEthernet0/0/0.10]dot1q termination vid 10(子接口封装VLAN)
[AR1-GigabitEthernet0/0/0.10]ip address 192.168.1.1 255.255.255.0(子接口设置IP地址)
[AR1-GigabitEthernet0/0/0.10]arp broadcast enable
[AR1-GigabitEthernet0/0/0.10]quit (退出)
[AR1]interface GigabitEthernet0/0/0.20(进入子接口)
[AR1-GigabitEthernet0/0/0.20]dot1q termination vid 20(子接口封装VLAN)
[AR1-GigabitEthernet0/0/0.20]ip address 192.168.2.1 255.255.255.0(子接口设置IP地址)
[AR1-GigabitEthernet0/0/0.20]arp broadcast enable