VLAN实验

VLAN实验

VLAN实验_第1张图片
先将sw1中的4台pc平均分到VLAN2和VLAN3中
[sw1]vlan 2
[sw1-vlan2]q
[sw1]vlan 3
[sw1-vlan2]q    创建VLAN2,3


将e0/0/1和0/0/2接口放入VLAN2中

[sw1]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[sw1-port-group]port link-type access 
[sw1-port-group]port default vlan 2
同理
[sw1]port-group group-member Ethernet 0/0/3 to Ethernet 0/0/4
[sw1-port-group]port link-type access 
[sw1-port-group]port default vlan 3
再将sw2中的两台pc分别分入VLAN2VLAN3
[sw2]int e0/0/2
[sw2-Ethernet0/0/2]p l a
[sw2-Ethernet0/0/2]p d v 2
[sw2]int e0/0/3
[sw2-Ethernet0/0/3]p l a
[sw2-Ethernet0/0/3]p d v 3
为了连接两个交换机,交换机中间那条线应为Trunk干道
[sw1]interface Ethernet0/0/6
[sw1-Ethernet0/0/6]port link-type trunk
[sw1-Ethernet0/0/6]port trunk allow-pass vlan 2 to 3
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]p l trunk
[sw2-Ethernet0/0/1]p t a v 2 to 3
为了使v2与v3可以互通就需要路由器
先创造两个路由器子接口分别给v2v3使用
[r1]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.1]ip add 192.168.1.254 24
[r1-GigabitEthernet0/0/0.1]arp broadcast enable 
[r1]int g0/0/0.2
[r1-GigabitEthernet0/0/0.2]dot1q termination vid 3
[r1-GigabitEthernet0/0/0.2]ip add 192.168.2.254 24
[r1-GigabitEthernet0/0/0.2]arp broadcast enable 
最后用dhcp分配一下ip
[r1]dhcp enable 
[r1]ip pool a
[r1-ip-pool-a]network 192.168.1.0 mask 24
[r1-ip-pool-a]gateway-list 192.168.1.254
[r1]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select global
[r1]ip pool b
[r1-ip-pool-b]network 192.168.2.0 mask 24
[r1-ip-pool-b]gateway-list 192.168.2.254
[r1-ip-pool-b]q
[r1]int g0/0/0.2
[r1-GigabitEthernet0/0/0.2]dhcp select global 

sw1与路由器相连的先应为一条Trunk干道

[sw1]int e0/0/5
[sw1-Ethernet0/0/5]p l tr
[sw1-Ethernet0/0/5]p t a v 2 to 3
实验完成
 

 

你可能感兴趣的:(p2p,tv,debian)