VLAN综合实验

1.pc1和pc3所在接口为access;属于vlan 2:
pc2/pc4/pc5/pc6处于同一网段;其中pc2可以访问pc4/pc5/pc6;
pc4可以访问pc6;pc5不能访问pc6;
2.pc1/pc3与pc2/pc4/pc5/pc6不在同一网段;
3.所有pc通过dhcp获取IP地址,且pc1/pc3可以正常访问pc2/pc4/pc5/pc6;

实验拓扑图如下:

实验步骤:

1.将每台pc设置为dhcp获取IP地址

依次进行

2.按要求在SW1,SW2,SW3配置VLAN和各个接口对应类型的配置

SW1:

[Huawei]sysname SW1

[SW1]vlan batch 2 to 6 

[SW1]interfac g0/0/1

[SW1-GigabitEthernet0/0/1]port link-type access 

[SW1-GigabitEthernet0/0/1]port default vlan 2

[SW1]int g0/0/2

[SW1-GigabitEthernet0/0/2]port hybrid pvid vlan 3

[SW1-GigabitEthernet0/0/2] port hybrid untagged vlan 3 to 6

[SW1-GigabitEthernet0/0/3]port link-type trunk

[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
[SW1-GigabitEthernet0/0/3]q

[SW1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 to 6

[SW1-GigabitEthernet0/0/4]port hybrid tagged vlan 2

[SW1]dis port vlan active 
T=TAG U=UNTAG
-------------------------------------------------------------------------------
Port                Link Type    PVID    VLAN List
-------------------------------------------------------------------------------
GE0/0/1             access       2       U: 2
GE0/0/2             hybrid       3       U: 1 3 to 6
GE0/0/3             trunk        1       U: 1
                                         T: 2 to 6
GE0/0/4             hybrid       1       U: 1 3 to 6
                                         T: 2
GE0/0/5             hybrid       1       U: 1
GE0/0/6             hybrid       1       U: 1
GE0/0/7             hybrid       1       U: 1
GE0/0/8             hybrid       1       U: 1
GE0/0/9             hybrid       1       U: 1
GE0/0/10            hybrid       1       U: 1
GE0/0/11            hybrid       1       U: 1
GE0/0/12            hybrid       1       U: 1
GE0/0/13            hybrid       1       U: 1
GE0/0/14            hybrid       1       U: 1
GE0/0/15            hybrid       1       U: 1
GE0/0/16            hybrid       1       U: 1
GE0/0/17            hybrid       1       U: 1
GE0/0/18            hybrid       1       U: 1
GE0/0/19            hybrid       1       U: 1
GE0/0/20            hybrid       1       U: 1
GE0/0/21            hybrid       1       U: 1
GE0/0/22            hybrid       1       U: 1
GE0/0/23            hybrid       1       U: 1
GE0/0/24            hybrid       1       U: 1

SW2:

[Huawei]sysname SW2

[SW2]vlan batch 2 to 6 

interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 2

interface GigabitEthernet0/0/2
 port hybrid pvid vlan 4
 port hybrid untagged vlan 3 to 6

interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 to 6

interface GigabitEthernet0/0/4
 port link-type trunk
 port trunk allow-pass vlan 2 to 6

[SW2]dis port vlan active 
T=TAG U=UNTAG
-------------------------------------------------------------------------------
Port                Link Type    PVID    VLAN List
-------------------------------------------------------------------------------
GE0/0/1             access       2       U: 2
GE0/0/2             hybrid       4       U: 1 3 to 6
GE0/0/3             trunk        1       U: 1
                                         T: 2 to 6
GE0/0/4             trunk        1       U: 1
                                         T: 2 to 6
GE0/0/5             hybrid       1       U: 1
GE0/0/6             hybrid       1       U: 1
GE0/0/7             hybrid       1       U: 1
GE0/0/8             hybrid       1       U: 1
GE0/0/9             hybrid       1       U: 1
GE0/0/10            hybrid       1       U: 1
GE0/0/11            hybrid       1       U: 1
GE0/0/12            hybrid       1       U: 1
GE0/0/13            hybrid       1       U: 1
GE0/0/14            hybrid       1       U: 1
GE0/0/15            hybrid       1       U: 1
GE0/0/16            hybrid       1       U: 1
GE0/0/17            hybrid       1       U: 1
GE0/0/18            hybrid       1       U: 1
GE0/0/19            hybrid       1       U: 1
GE0/0/20            hybrid       1       U: 1
GE0/0/21            hybrid       1       U: 1
GE0/0/22            hybrid       1       U: 1
  ---- More ----

SW3:

sysname SW3

vlan batch 2 to 6

interface GigabitEthernet0/0/1
 port hybrid pvid vlan 5
 port hybrid untagged vlan 3 to 5

interface GigabitEthernet0/0/2
 port hybrid pvid vlan 6
 port hybrid untagged vlan 3 to 4 6

interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 to 6

[SW3]dis port vlan active 
T=TAG U=UNTAG
-------------------------------------------------------------------------------
Port                Link Type    PVID    VLAN List
-------------------------------------------------------------------------------
GE0/0/1             hybrid       5       U: 1 3 to 5
GE0/0/2             hybrid       6       U: 1 3 to 4 6
GE0/0/3             trunk        1       U: 1
                                         T: 2 to 6
GE0/0/4             hybrid       1       U: 1
GE0/0/5             hybrid       1       U: 1
GE0/0/6             hybrid       1       U: 1
GE0/0/7             hybrid       1       U: 1
GE0/0/8             hybrid       1       U: 1
GE0/0/9             hybrid       1       U: 1
GE0/0/10            hybrid       1       U: 1
GE0/0/11            hybrid       1       U: 1
GE0/0/12            hybrid       1       U: 1
GE0/0/13            hybrid       1       U: 1
GE0/0/14            hybrid       1       U: 1
GE0/0/15            hybrid       1       U: 1
GE0/0/16            hybrid       1       U: 1
GE0/0/17            hybrid       1       U: 1
GE0/0/18            hybrid       1       U: 1
GE0/0/19            hybrid       1       U: 1
GE0/0/20            hybrid       1       U: 1
GE0/0/21            hybrid       1       U: 1
GE0/0/22            hybrid       1       U: 1
GE0/0/23            hybrid       1       U: 1

2.在路由器上面建立地址池配置DHCP服务

R1

[Huawei]sysname r1

[r1]INT g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 24

[r1-GigabitEthernet0/0/0]int  g0/0/0.1
[r1-GigabitEthernet0/0/0.1]ip add 192.18.2.1 24

[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2

[r1-GigabitEthernet0/0/0.1]arp broadcast enable 
[r1-GigabitEthernet0/0/0.1]q
[r1]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              192.168.1.1/24       up         up        
GigabitEthernet0/0/0.1            192.18.2.1/24        up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)  

[r1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[r1]ip pool yb

[r1-ip-pool-yb]network 192.168.2.0 mask 24

[r1-ip-pool-yb]gateway-list 192.168.2.1

[r1-ip-pool-yb]dns-list 8.8.8.8

[r1-GigabitEthernet0/0/0.1]dhcp select global 
[r1-GigabitEthernet0/0/0.1]q
[r1]ip pool zyp

[r1-ip-pool-zyp]network 192.168.1.0 mask 24

[r1-ip-pool-zyp]gateway-list 192.168.1.1

[r1-ip-pool-zyp]dns-list 8.8.8.8

[r1]int g0/0/0

[r1-GigabitEthernet0/0/0]dhcp select global 

3.最后在pc端命令行测试

P2pingp4/p5/p6


PC>ping 192.168.1.253

Ping 192.168.1.253: 32 data bytes, Press Ctrl_C to break
From 192.168.1.253: bytes=32 seq=1 ttl=128 time=47 ms
From 192.168.1.253: bytes=32 seq=2 ttl=128 time=31 ms
From 192.168.1.253: bytes=32 seq=3 ttl=128 time=47 ms
From 192.168.1.253: bytes=32 seq=4 ttl=128 time=47 ms
From 192.168.1.253: bytes=32 seq=5 ttl=128 time=62 ms

--- 192.168.1.253 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 31/46/62 ms

PC>ping 192.168.1.252

Ping 192.168.1.252: 32 data bytes, Press Ctrl_C to break
From 192.168.1.252: bytes=32 seq=1 ttl=128 time=94 ms
From 192.168.1.252: bytes=32 seq=2 ttl=128 time=78 ms
From 192.168.1.252: bytes=32 seq=3 ttl=128 time=62 ms
From 192.168.1.252: bytes=32 seq=4 ttl=128 time=79 ms
From 192.168.1.252: bytes=32 seq=5 ttl=128 time=78 ms

--- 192.168.1.252 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 62/78/94 ms

PC>ping 192.168.1.251

Ping 192.168.1.251: 32 data bytes, Press Ctrl_C to break
From 192.168.1.251: bytes=32 seq=1 ttl=128 time=63 ms
From 192.168.1.251: bytes=32 seq=2 ttl=128 time=109 ms
From 192.168.1.251: bytes=32 seq=3 ttl=128 time=78 ms
From 192.168.1.251: bytes=32 seq=4 ttl=128 time=78 ms
From 192.168.1.251: bytes=32 seq=5 ttl=128 time=94 ms

--- 192.168.1.251 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 63/84/109 ms
 

p4pingp5/p6

PC>ping 192.168.1.251

Ping 192.168.1.251: 32 data bytes, Press Ctrl_C to break
From 192.168.1.251: bytes=32 seq=1 ttl=128 time=63 ms
From 192.168.1.251: bytes=32 seq=2 ttl=128 time=31 ms
From 192.168.1.251: bytes=32 seq=3 ttl=128 time=62 ms
From 192.168.1.251: bytes=32 seq=4 ttl=128 time=78 ms
From 192.168.1.251: bytes=32 seq=5 ttl=128 time=63 ms

--- 192.168.1.251 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 31/59/78 ms

PC>ping 192.168.1.252

Ping 192.168.1.252: 32 data bytes, Press Ctrl_C to break
From 192.168.1.252: bytes=32 seq=1 ttl=128 time=63 ms
From 192.168.1.252: bytes=32 seq=2 ttl=128 time=94 ms
From 192.168.1.252: bytes=32 seq=3 ttl=128 time=78 ms
From 192.168.1.252: bytes=32 seq=4 ttl=128 time=93 ms
From 192.168.1.252: bytes=32 seq=5 ttl=128 time=79 ms

--- 192.168.1.252 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 63/81/94 ms

p5不能pingp6


PC>ping 192.168.1.251

Ping 192.168.1.251: 32 data bytes, Press Ctrl_C to break
From 192.168.1.252: Destination host unreachable
From 192.168.1.252: Destination host unreachable
From 192.168.1.252: Destination host unreachable
From 192.168.1.252: Destination host unreachable
From 192.168.1.252: Destination host unreachable

--- 192.168.1.251 ping statistics ---
  5 packet(s) transmitted
  0 packet(s) received
  100.00% packet loss

p1/p3pingp4/p5/p6

测试全部成功,实验完成!!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值