VLAN综合实验

拓扑结构:

VLAN综合实验_第1张图片

 

要求

1、VLAN2的IP地址按192.168.1.0/24网段分配

2、VLAN3的IP地址按192.168.2.0/24网段分配

3、全网可达,保障更新安全,减少路由条目数量,避免环路

 使用的设备:1台路由器、2台交换机和6台PC

 解决网络拓扑:

1、确定广播域的个数

2、分配网段

3、配置IP地址 (优先配置路由器)

 确定广播域的个数

根据拓扑结构图以及要求可知,本拓扑结构一共拥有2个网段

分配网段

VLAN2:192.168.1.0/24

VLAN3:192.168.2.0/24

VLAN综合实验_第2张图片

配置VLAN

SW1:

system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
[SW1]vlan batch 2 to 3
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]interface e 0/0/1
[SW1-Ethernet0/0/1]port link-type access	
[SW1-Ethernet0/0/1]port default vlan 2
[SW1-Ethernet0/0/1]interface e 0/0/2	
[SW1-Ethernet0/0/2]port link-type access 		
[SW1-Ethernet0/0/2]port default vlan 2
[SW1-Ethernet0/0/2]interface e 0/0/3
[SW1-Ethernet0/0/3]port link-type access 
[SW1-Ethernet0/0/3]port default vlan 3
[SW1-Ethernet0/0/3]interface e 0/0/4
[SW1-Ethernet0/0/4]port link-type access 
[SW1-Ethernet0/0/4]port default vlan 3

SW2:

system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW2
[SW2]vlan batch 2 to 3
[SW2]interface e 0/0/1
[SW2-Ethernet0/0/1]port link-type access 
[SW2-Ethernet0/0/1]port default vlan 2
[SW2-Ethernet0/0/1]interface e 0/0/2
[SW2-Ethernet0/0/2]port link-type access 
[SW2-Ethernet0/0/2]port default vlan 3

配置trunk干道

SW1:

[SW1]interface e 0/0/5
[SW1-Ethernet0/0/5]port link-type trunk 
[SW1-Ethernet0/0/5]port trunk allow-pass vlan 2 to 3

[SW1]interface Ethernet 0/0/6
[SW1-Ethernet0/0/6]port link-type trunk 
[SW1-Ethernet0/0/6]port trunk allow-pass vlan 2 to 3

注:一定记得也要给连接路由器的交换机接口配置trunk干道,否则后边DHCP配置后,主机PC获取不到IP地址

SW2:

[SW2-Ethernet0/0/2]interface e 0/0/3
[SW2-Ethernet0/0/3]port link-type trunk 
[SW2-Ethernet0/0/3]port trunk allow-pass vlan 2 to 3

此时IP地址已经配置成功,但此时网络不能正常通信,按要求操作配置动态路由协议

配置VLAN间路由 --- 单臂路由

AR1:

system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname r1
[r1]interface g 0/0/0.1	
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.1]ip address 192.168.1.254 24
[r1-GigabitEthernet0/0/0.1]arp broadcast enable 
[r1-GigabitEthernet0/0/0.1]q
[r1]interface g 0/0/0.2
[r1-GigabitEthernet0/0/0.2]dot1q termination vid 3
[r1-GigabitEthernet0/0/0.2]ip address 192.168.2.254 24
[r1-GigabitEthernet0/0/0.2]arp broadcast enable 
改用DHCP
[r1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[r1]ip pool v2
Info: It's successful to create an IP address pool.
[r1-ip-pool-v2]network 192.168.1.0 mask 24
[r1-ip-pool-v2]gateway-list 192.168.1.254
[r1-ip-pool-v2]dns-list 114.114.114.114 8.8.8.8
[r1-ip-pool-v2]q
[r1]ip pool v3
[r1-ip-pool-v3]network 192.168.2.0 mask 24
[r1-ip-pool-v3]gateway-list 192.168.2.254
[r1-ip-pool-v3]dns-list 114.114.114.114 8.8.8.8
[r1-ip-pool-v3]q
[r1]interface g 0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select global 
[r1-GigabitEthernet0/0/0.1]q
[r1]interface 	
[r1]interface g0/0/0.2
[r1-GigabitEthernet0/0/0.2]dhcp select global 
[r1-GigabitEthernet0/0/0.2]q
[r1]

全网可达,保障更新安全,减少路由条目数量,避免环路

PC6的IP地址:

VLAN综合实验_第3张图片

PC3的IP地址:

VLAN综合实验_第4张图片 

VLAN综合实验_第5张图片

 PC1可以和不同VLAN的PC3通讯,可以和不同交换机上不同VLAN的PC6通讯,证明此时全网可达,并完成要求

你可能感兴趣的:(网络,智能路由器)