【习题试验】2层交换VLAN间路由



用一台路由器和一台交换机来完成试验
R1 R2模拟PC端   SW1为2层交换机  R3为路由器

PC2配置
pc1(config)#no ip routing                     关闭路由模式
pc1(config)#int e0/0
pc1(config-if)#ip add 10.0.0.10 255.255.255.0
pc1(config-if)#no sh
pc1(config-if)#full-duplex
pc1(config-if)#exit
pc1(config)#ip default-gateway 10.0.0.1            默认网关

PC2 配置
pc1(config)#no ip routeing
pc1(config)#int e0/0
pc1(config-if)#ip add 20.0.0.20 255.255.255.0
pc1(config-if)#no sh
pc1(config-if)#full-duplex
pc1(config-if)#exit
pc1(config)#ip default-gateway 20.0.0.1   
  
SW配置
sw1#vlan da
sw1(vlan)#vlan 10 name 10               第一个vlan
sw1(vlan)#vlan 20 name 20               第二个vlan
sw1(vlan)#exit
sw1#config t
sw1(config)#int f0/1
sw1(config-if)#duplex full
sw1(config-if)#no sh
sw1(config-if)#sw mo acc
sw1(config-if)#sw acc vlan 10
sw1(config-if)#exit
sw1(config)#int f0/2
sw1(config-if)#duplex full
sw1(config-if)#no sh
sw1(config-if)#sw mo acc
sw1(config-if)#sw acc vlan 20
sw1(config-if)#exit
sw1(config)#int f0/3
sw1(config-if)#sw mo tr
sw1(config-if)#sw tr en dota1q
sw1(config-if)#no sh
 
R3 配置
           
r3(config)#int e0/0.10                  子接口封装dot1q
r3(config-subif)#encapsulation dot1Q 10                   与vlan名匹配   
r3(config-subif)#ip add 10.0.0.1 255.255.255.0
r3(config-subif)#exit
r3(config)#int e0/0.20
r3(config-subif)#encapsulation dot1Q 20                
r3(config-subif)#ip add 20.0.0.1 255.255.255.0
r3(config-subif)#exit

你可能感兴趣的:(职场,路由,休闲,交换,2层)