IP相关问题11 --- VLAN实验

 1.vlan的创建

[LSW1]vlan batch 2 to 6
[LSW2]vlan batch 2 to 6

2.接口划分vlan 

1.SW1接口划分

[LSW1]int Ethernet0/0/1
[LSW1-Ethernet0/0/1]port link-type access 
[LSW1-Ethernet0/0/1]port default vlan 2
 
[LSW1]interface Ethernet0/0/2
[LSW1-Ethernet0/0/2]port link-type hybrid
[LSW1-Ethernet0/0/2]port hybrid pvid vlan 3
[LSW1-Ethernet0/0/2]port hybrid untagged vlan 3 4 5 6
 
[LSW1]interface Ethernet0/0/3	
[LSW1-Ethernet0/0/3]port link-type access 
[LSW1-Ethernet0/0/3]port default vlan 2
 
[LSW1]interface Ethernet0/0/4
[LSW1-Ethernet0/0/4]port link-type hybrid 	
[LSW1-Ethernet0/0/4]port hybrid pvid vlan 4
[LSW1-Ethernet0/0/4]port hybrid untagged vlan 3 4
 
[LSW1]interface Ethernet0/0/6
[LSW1-Ethernet0/0/6]port link-type hybrid 	
[LSW1-Ethernet0/0/6]port hybrid untagged vlan 3 4 5 6	
[LSW1-Ethernet0/0/6]port hybrid tagged vlan 2

2.SW2接口划分

[LSW2]interface Ethernet0/0/2
[LSW2-Ethernet0/0/2]port link-type hybrid 
[LSW2-Ethernet0/0/2]port hybrid pvid vlan 5	
[LSW2-Ethernet0/0/2]port hybrid untagged vlan 3 5
 
[LSW2]interface Ethernet0/0/3
[LSW2-Ethernet0/0/3]port link-type hybrid 
[LSW2-Ethernet0/0/3]port hybrid pvid vlan 6	
[LSW2-Ethernet0/0/3]port hybrid untagged vlan 3 6

 3.配置trunk干道

[LSW1]interface Ethernet0/0/5	
[LSW1-Ethernet0/0/5]port link-type trunk 
[LSW1-Ethernet0/0/5]port trunk allow-pass vlan all
 
[LSW2]interface Ethernet0/0/1	
[LSW2-Ethernet0/0/1]port link-type trunk 
[LSW2-Ethernet0/0/1]port trunk allow-pass vlan all

4.配置子接口

[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.168.2.1 24
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.1]arp broadcast enable 

5.DHCP

[r1]ip pool 1	
[r1-ip-pool-1]network 192.168.1.0 mask 24	
[r1-ip-pool-1]gateway-list 192.168.1.1
[r1-ip-pool-1]dns-list 114.114.114.114
[r1-ip-pool-1]q
[r1]ip pool 2
[r1-ip-pool-2]network 192.168.2.0 mask 24
[r1-ip-pool-2]gateway-list 192.168.2.1
[r1-ip-pool-2]dns-list 114.114.114.114
[r1-ip-pool-2]q
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]dhcp select global 
[r1-GigabitEthernet0/0/0]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select global

6.检测 

1.PC1可以访问PC2/4/5/6

PC>ping 192.168.2.251
 
Ping 192.168.2.251: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.251: bytes=32 seq=2 ttl=127 time=94 ms
From 192.168.2.251: bytes=32 seq=3 ttl=127 time=46 ms
From 192.168.2.251: bytes=32 seq=4 ttl=127 time=79 ms
From 192.168.2.251: bytes=32 seq=5 ttl=127 time=78 ms
 
PC>ping 192.168.2.253
 
Ping 192.168.2.253: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.253: bytes=32 seq=2 ttl=127 time=78 ms
From 192.168.2.253: bytes=32 seq=3 ttl=127 time=78 ms
From 192.168.2.253: bytes=32 seq=4 ttl=127 time=78 ms
From 192.168.2.253: bytes=32 seq=5 ttl=127 time=78 ms
 
PC>ping 192.168.2.252
 
Ping 192.168.2.252: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.252: bytes=32 seq=2 ttl=127 time=125 ms
From 192.168.2.252: bytes=32 seq=3 ttl=127 time=94 ms
From 192.168.2.252: bytes=32 seq=4 ttl=127 time=94 ms
From 192.168.2.252: bytes=32 seq=5 ttl=127 time=94 ms
 

PC>ping 192.168.2.254
 
Ping 192.168.2.254: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.254: bytes=32 seq=2 ttl=127 time=78 ms
From 192.168.2.254: bytes=32 seq=3 ttl=127 time=94 ms
From 192.168.2.254: bytes=32 seq=4 ttl=127 time=78 ms
From 192.168.2.254: bytes=32 seq=5 ttl=127 time=109 ms
 

 2.PC2可以访问4/5/6

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

PC>ping 192.168.2.252
 
Ping 192.168.2.252: 32 data bytes, Press Ctrl_C to break
From 192.168.2.252: bytes=32 seq=1 ttl=128 time=47 ms
From 192.168.2.252: bytes=32 seq=2 ttl=128 time=47 ms
From 192.168.2.252: bytes=32 seq=3 ttl=128 time=62 ms
From 192.168.2.252: bytes=32 seq=4 ttl=128 time=47 ms
From 192.168.2.252: bytes=32 seq=5 ttl=128 time=78 ms


PC>ping 192.168.2.254
 
Ping 192.168.2.254: 32 data bytes, Press Ctrl_C to break
From 192.168.2.254: bytes=32 seq=1 ttl=128 time=62 ms
From 192.168.2.254: bytes=32 seq=2 ttl=128 time=63 ms
From 192.168.2.254: bytes=32 seq=3 ttl=128 time=62 ms
From 192.168.2.254: bytes=32 seq=4 ttl=128 time=47 ms
From 192.168.2.254: bytes=32 seq=5 ttl=128 time=63 ms
 

 3.PC4不能访问5

PC>ping 192.168.2.252
 
Ping 192.168.2.252: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
Request timeout!
Request timeout!
Request timeout!

 4.PC5不能访问PC6

PC>ping 192.168.2.254
 
Ping 192.168.2.254: 32 data bytes, Press Ctrl_C to break
From 192.168.2.252: Destination host unreachable
From 192.168.2.252: Destination host unreachable
From 192.168.2.252: Destination host unreachable
From 192.168.2.252: Destination host unreachable
From 192.168.2.252: Destination host unreachable

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值