127 lines
4.3 KiB
Markdown
127 lines
4.3 KiB
Markdown
# VLAN聚合
|
||
|
||
### 一、什么是VLAN聚合
|
||
|
||
- **VLAN聚合:也称Super VLAN(超级VLAN)**
|
||
|
||
- 指在一个物理网络内,将多个VLAN(称为Sub-VLAN:子VLAN),聚合成一个逻辑的VLAN(称为Super-VLAN:超级VLAN)
|
||
|
||
- 这些Sub-VLAN使用同一个IP子网和网关,从而达到节约IP地址的目的
|
||
|
||
### 二、VLAN聚合的作用
|
||
|
||
- 节约了子网网络号、子网广播地址、子网网关地址
|
||
- 节约空闲的IP地址,防止IP地址浪费
|
||
- 提高IP地址编制的灵活性
|
||
|
||
#### 三、VLAN聚合实验
|
||
|
||
![image-20240828195237124](https://picgo-noriu.oss-cn-beijing.aliyuncs.com/Images/image-20240828195237124.png)
|
||
|
||
- 需求
|
||
|
||
> 公司vlan2/vlan3/vlan4都使用超级vlan10的IP子网网段 -公司内部不同vlan内的主机可以互通(vlan间通信)
|
||
>
|
||
> 每个vlan内的主机都可以和R1互通
|
||
|
||
- 配置步骤
|
||
|
||
- 第一步:配置PC的IP地址,掩码,网关
|
||
- 第二步:创建子VLAN 1)在sw2/sw3/sw4上创建vlan 2 3 4 2)交换机连接PC的接口设置为access模式,并将接口加入指定的vlan 3)交换机互联接口设置为trunk模式,允许vlan 2 3 4 通过
|
||
- 第三步:创建超级VLAN,并开启代理ARP,实现vlan间通信
|
||
1. 在sw1上创建vlan 2 3 4 10
|
||
2. sw1与sw2/sw3/sw4互联接口设置为trunk模式,允许vlan 2 3 4 通过
|
||
3. 在sw1 上配置超级vlan ,并配置vlanif10 虚接口地址
|
||
4. 在sw1 上启用super-vlan 的proxy ARP功能
|
||
- 第四步:配置路由,实现VLAN内的主机与R1通信
|
||
1. sw1与R1互联的接口设置为access模式,加入vlan20 ,并配置vlanif20 虚接口IP地址
|
||
2. 在R1中配置去往192.168.10.0/24的静态路由,下一跳指向192.168.20.10
|
||
- 第五步:测试与验证
|
||
|
||
- 配置命令
|
||
|
||
- 第一步:配置PC的IP地址,掩码,网关
|
||
|
||
- 第二步:创建子VLAN
|
||
|
||
- SW2配置
|
||
|
||
```
|
||
[SW2]vlan batch 2 3 4
|
||
[SW2]port-group group-member g0/0/2 g0/0/3
|
||
[SW2-port-group]port link-type access
|
||
[SW2-port-group]port default vlan 2
|
||
[SW2-port-group]quit
|
||
[SW2]int g0/0/1
|
||
[SW2-GigabitEthernet0/0/1]port link-type trunk
|
||
[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
|
||
```
|
||
|
||
- SW3配置
|
||
|
||
```
|
||
[SW3]vlan batch 2 3 4
|
||
[SW3]port-group group-member g0/0/2 g0/0/3
|
||
[SW3-port-group]port link-type access
|
||
[SW3-port-group]port default vlan 3
|
||
[SW3-port-group]quit
|
||
[SW3]int g0/0/1
|
||
[SW3-GigabitEthernet0/0/1]port link-type trunk
|
||
[SW3-GigabitEthernet0/0/1]port trunk allow-pass vlan all
|
||
```
|
||
|
||
- SW4配置
|
||
|
||
```
|
||
[SW4]vlan batch 2 3 4
|
||
[SW4]port-group group-member g0/0/2 g0/0/3
|
||
[SW4-port-group]port link-type access
|
||
[SW4-port-group]port default vlan 4
|
||
[SW4-port-group]quit
|
||
[SW4]int g0/0/1
|
||
[SW4-GigabitEthernet0/0/1]port link-type trunk
|
||
[SW4-GigabitEthernet0/0/1]port trunk allow-pass vlan all
|
||
```
|
||
|
||
- 第三步:创建超级VLAN,并开启代理ARP,实现vlan间通信(实现PC之间互通)
|
||
|
||
- SW1配置
|
||
|
||
```
|
||
[SW1]vlan batch 2 3 4 10
|
||
[SW1]vlan 10 //进入vlan10
|
||
[SW1-vlan10]aggregate-vlan //配置vlan10为聚合vlan(超级vlan)
|
||
[SW1-vlan10]access-vlan 2 to 4 //在聚合vlan10中添加子vlan2/3/4
|
||
[SW1-vlan10]quit
|
||
[SW1]interface vlanif 10 //进入vlanif 10
|
||
[SW1-Vlanif10]ip address 192.168.10.254 24 //配置vlanif10虚接口的IP地址
|
||
[SW1-Vlanif10]arp-proxy inter-sub-vlan-proxy enable //在vlanif10下开启vlan间-arp代理
|
||
[SW1-Vlanif10]quit
|
||
[SW1]port-group group-member g0/0/2 to g0/0/4
|
||
[SW1-port-group]port link-type trunk
|
||
[SW1-port-group]port trunk allow-pass vlan 2 3 4
|
||
```
|
||
|
||
- 第四步:配置路由,实现VLAN内的主机与R1互通
|
||
|
||
- SW1配置
|
||
|
||
```
|
||
[SW1]vlan batch 20 //创建vlan20
|
||
[SW1]int g0/0/1
|
||
[SW1-GigabitEthernet0/0/1]port link-type access
|
||
[SW1-GigabitEthernet0/0/1]port default vlan 20
|
||
[SW1-GigabitEthernet0/0/1]quit
|
||
[SW1]int vlanif 20
|
||
[SW1-Vlanif20]ip address 192.168.20.10 24
|
||
```
|
||
|
||
- R1路由器配置
|
||
|
||
```
|
||
[R1]int g0/0/0
|
||
[R1-GigabitEthernet0/0/0]ip address 192.168.20.20 24
|
||
[R1]ip route-static 192.168.10.0 24 192.168.20.10 //配置静态路由
|
||
```
|
||
|
||
|