vlan实验

一,实验需求

按要求划分vlan,全网可达,电脑ip实验DHCP获取

二,实验目的

掌握vlan的配置

掌握DHCP的配置

三,实验步骤

1,新建拓扑,布置器件,连线开机

2,数广播域,划分网段

3,配置vlan

第一步---创建VLAN

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw1
[sw1]
Oct 18 2023 18:41:48-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1]vlan 2
[sw1-vlan2]q
[sw1]v
Oct 18 2023 18:41:58-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095
[sw1]vlan 3
[sw1-vlan3]
Oct 18 2023 18:42:08-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw1-vlan3]q

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw2
[sw2]vlan 2
[sw2-vlan2]q
[sw2]
Oct 18 2023 18:44:41-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw2]vlan 3
[sw2-vlan3]q
[sw2]
Oct 18 2023 18:44:51-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw2]q
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys sw3
[sw3]
Oct 18 2023 18:45:01-08:00 sw3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.
[sw3]vlan 2
[sw3-vlan2]q
[sw3]vlan 3
[sw3-vlan3]
Oct 18 2023 18:45:41-08:00 sw3 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095.q

第二步---将接口划入vlan

(1)在SW1内,将0/0/1接口设置成Trunk链路;将0/0/2和0/0/3设置成Access链路
[sw1]int GigabitEthernet 0/0/1
[sw1-GigabitEthernet0/0/1]port link-type trunk
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[sw1]port-group group-member GigabitEthernet 0/0/2 GigabitEthernet 0/0/3
[sw1-port-group]port link-type access 
[sw1-GigabitEthernet0/0/2]port link-type access 
[sw1-GigabitEthernet0/0/3]port link-type access 
[sw1-port-group]q
[sw1]int GigabitEthernet 0/0/2
[sw1-GigabitEthernet0/0/2]port default vlan 2
[sw1-GigabitEthernet0/0/2]q
[sw1]interface GigabitEthernet 0/0/3
[sw1-GigabitEthernet0/0/3]port default vlan 3

 (2)在SW2内,将0/0/1接口和0/0/2接口设置成Trunk链路;将0/0/3和0/0/4设置成Access链路
<sw2>sys
Enter system view, return user view with Ctrl+Z.
[sw2]port-group group-member GigabitEthernet 0/0/3 GigabitEthernet 0/0/4
[sw2-port-group]port link-type access
[sw2-GigabitEthernet0/0/3]port link-type access
[sw2-GigabitEthernet0/0/4]port link-type access
[sw2-port-group]q
[sw2]int g 0/0/3
[sw2-GigabitEthernet0/0/3]port d	
[sw2-GigabitEthernet0/0/3]port discard	
[sw2-GigabitEthernet0/0/3]port default vlan 2
[sw2-GigabitEthernet0/0/3]q
[sw2]int g 0/0/4
[sw2-GigabitEthernet0/0/4]port default vlan 3
[sw2]int g 0/0/1
[sw2-GigabitEthernet0/0/1]port link-type trunk 
Oct 18 2023 19:07:22-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 12, the 
change loop count is 0, and the maximum number of records is 4095.	
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan all 
[sw2]int g 0/0/2
[sw2-GigabitEthernet0/0/2]po	
[sw2-GigabitEthernet0/0/2]port l	
[sw2-GigabitEthernet0/0/2]port link-t	
[sw2-GigabitEthernet0/0/2]port link-type t
[sw2-GigabitEthernet0/0/2]port link-type trunk 
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan all 
[sw2-GigabitEthernet0/0/2]q

 (3)在SW3内,将0/0/1接口设置成Trunk链路;将0/0/2和0/0/3设置成Access链路
[sw3]int g 0/0/1
[sw3-GigabitEthernet0/0/1]port link-type trunk 
[sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[sw3]port-group group-member GigabitEthernet 0/0/2 GigabitEthernet 0/0/3
[sw3-port-group]port link-type access
[sw3-GigabitEthernet0/0/2]port link-type access
[sw3-GigabitEthernet0/0/3]port link-type access
[sw3]int g 0/0/2
[sw3-GigabitEthernet0/0/2]port default vlan 2
[sw3-GigabitEthernet0/0/2]q
[sw3]int g 0/0/3
[sw3-GigabitEthernet0/0/3]port default vlan 3

第三步 --- VLAN间路由

(1)在R1路由器上创建虚拟接口;并配置合理的IP地址。
[r1]int GigabitEthernet 0/0/0.1
[r1-GigabitEthernet0/0/0.1]ip address 192.168.1.1 24
[r1-GigabitEthernet0/0/0.1]int GigabitEthernet 0/0/0.2
[r1-GigabitEthernet0/0/0.2]ip address 192.168.2.1 24
[r1-GigabitEthernet0/0/0.2]int GigabitEthernet 0/0/1.1
[r1-GigabitEthernet0/0/1.1]ip address 192.168.3.1 24
[r1-GigabitEthernet0/0/1.1]int GigabitEthernet 0/0/1.2
[r1-GigabitEthernet0/0/1.2]ip address 192.168.4.1 24
[r1-GigabitEthernet0/0/1.2]q
(2)创建四个对应的IP池,在接口上开启802.1Q帧的识别传输服务,打开arp广播功能,最后进行DHCP地址下发;
[r1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.

[r1]ip pool aa
Info: It's successful to create an IP address pool.
[r1-ip-pool-aa]network 192.168.1.0 mask 24
[r1-ip-pool-aa]gateway-list 192.168.1.1
[r1-ip-pool-aa]dns-list 114.114.114.114 8.8.8.8
[r1-ip-pool-aaa]q
[r1]ip pool bbb
Info: It's successful to create an IP address pool.
[r1-ip-pool-bbb]network 192.168.2.0 mask 24
[r1-ip-pool-bbb]gateway-list 192.168.2.1
[r1-ip-pool-bbb]dns-list 114.114.114.114 8.8.8.8
[r1-ip-pool-bbb]q
[r1]ip pool ccc
Info: It's successful to create an IP address pool.
[r1-ip-pool-ccc]network 192.168.3.0 mask 24
[r1-ip-pool-ccc]gateway-list 192.168.3.1
[r1-ip-pool-ccc]dns-list 114.114.114.114 8.8.8.8
[r1-ip-pool-ccc]q
[r1]ip pool ddd
Info: It's successful to create an IP address pool.
[r1-ip-pool-ddd]network 192.168.4.0 mask 24
[r1-ip-pool-ddd]gateway-list 192.168.4.1
[r1-ip-pool-ddd]dns-list 114.114.114.114 8.8.8.8
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
Oct 18 2023 19:23:25-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0.1 has entered the UP state. 
[r1-GigabitEthernet0/0/0.1]arp broadcast enable 
[r1-GigabitEthernet0/0/0.1]dhcp select global 
[r1]int GigabitEthernet 0/0/0.2
[r1-GigabitEthernet0/0/0.2]dot1q termination vid 3
Oct 18 2023 19:28:21-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0.2 has entered the UP state. 
[r1-GigabitEthernet0/0/0.2]arp broadcast enable 
[r1-GigabitEthernet0/0/0.2]dhcp select global 
[r1-GigabitEthernet0/0/0.2]q
[r1]int GigabitEthernet 0/0/1.1
[r1-GigabitEthernet0/0/1.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/1.1]
Oct 18 2023 19:29:21-08:00 r1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/1.1 has entered the UP state. 
[r1-GigabitEthernet0/0/1.1]arp broadcast enable
[r1-GigabitEthernet0/0/1.1]dhcp select global
[r1-GigabitEthernet0/0/1.1]q
[r1-GigabitEthernet0/0/1.2]dot1q termination vid 3
[r1-GigabitEthernet0/0/1.2]
Oct 18 2023 19:30:28-08:00 r1 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
on the interface GigabitEthernet0/0/1.2 has entered the UP state. 
[r1-GigabitEthernet0/0/1.2]arp broadcast enable
[r1-GigabitEthernet0/0/1.2]dhcp select global
[r1-GigabitEthernet0/0/1.2]q

PC段配置如下

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值