试验目的:交换机穿建三个vlan分别为 vlan10,vlan20,vlan30 其中vlan10 走A线 vlan20.vlan30 走B线
一试验拓扑:
2950系列配置VLAN间路由步骤:
R1(confi g)# int s1/0
R1(confi g-if)#ip add 172.16.1.1 255.255.255.0
R1(confi g-if)# no shut
R1(confi g)# int s1/1
R1(confi g-if)#ip add 172.16.2.1 255.255.255.0
R1(confi g-if)# no shut
R1(confi g)#int e0/0
R1(confi g-if)#no shut
R1(confi g)#int e0/0.1
R1(confi g-subif)#encapsulation dot1q 10
R1(confi g-subif)#ip addr 192.168.1.1 255.255.255.0
R1(confi g)#intE0/0.2
R1(confi g-subif)#encapsulation dot1q 20
R1(confi g-subif)#ip addr 192.168.2.1 255.255.255.0
R1(confi g)#intE0/0.3
R1(confi g-subif)#encapsulation dot1q 30
R1(confi g-subif)#ip addr 192.168.2.1 255.255.255.0
R1(confi g)# ip nat pool tian 172.16.1.1 172.16.1.1 netmask 255.255.255.0
R1(confi g)# access-list 10 permit 192.168.1.0 0.0.0.255
R1(confi g)# access-list 10 deny any
R1(confi g)# ip nat inside source list 10 pool tian overload
R1(confi g)# int s1/0
R1(confi g-if)#ip nat outside
R1(confi g)# int e0/0.1
R1(confi g-if)#ip nat inside
R1(confi g)# ip nat pool chen 172.16.2.1 172.16.2.1 netmask 255.255.255.0
R1(confi g)# access-list 11 permit 192.168.2.0 0.0.0.255
R1(confi g)# access-list 11 permit 192.168.3.0 0.0.0.255
R1(confi g)# access-list 11 deny any
R1(confi g)# ip nat inside source list 11 pool chen overload
R1(confi g)# int s1/1
R1(confi g-if)#ip nat outside
R1(confi g)# int e0/0.2
R1(confi g-if)#ip nat outside
R1(confi g)# int e0/0.3
R1(confi g-if)#ip nat outside
交换机配置步骤
Sw1(config)#int fa0/0
Sw1(config-if)#switchport mode trunk
Sw1(vlan)#vlan 10 name gongchengbu
Sw1(vlan)#vlan 20 name caiwubu
Sw1(vlan)#vlan 20 name yuangongbu
Sw1(config)#int fa0/1
Sw1(config-if)#switchport access vlan 10
Sw1(config)#int fa0/2
Sw1(config-if)#switchport access vlan 20
Sw1(config)#int fa0/3
Sw1(config-if)#switchport access vlan 30
Sw1(config)# int range f0/0 – 12
Sw1(config-range)# no shut
PC机配置步骤:
PC1:C:>ip 192.168.1.2 192.168.1.1
PC2:C:> ip 192.168.2.2 192.168.2.1
PC3:C:> ip 192.168.3.2 192.168.3.1
实现pc1 只能ping通172.16.1.2 不能ping通172.16.2.2
实现pc2只能ping通 172.16.2.2 不能ping通172.16.1.2
实现pc3只能ping通 172.16.2.2 不能ping通172.16.1.2