您的位置:首页 > 其它

配置Trunk实现相同Vlan通信

2011-03-13 05:28 751 查看
PC 0,1 < VLAN 20 Gateway:10.1.1.1 255.0.0.0

PC 2,3 < VLAN 30 Gateway:20.1.1.1 255.0.0.0

PC0:10.1.1.2 255.0.0.0 PC1:10.1.1.3 255.0.0.0

PC2:20.1.1.2 255.0.0.0 PC3:20.1.1.3 255.0.0.0

不同VLAN的PC机通过路由器实现相互访问





1、配置路由器:

在路由器直连交换机的端口封装TRUNK协议,激活它,创建子接口F0/0.20,F0/0.30,封装TRUNK协议,并配置对应同个VLAN 的网关ip,因为有些路由器的接口默认是半双工状态,跟交换机端口不能自动协商,所以我的路由器端口下直接转为全双工状态(使用命令 (config-if)#duplux full )

Router(config)#no ip domain-lookup

Router(config)#line con 0

Router(config)#line console 0

Router(config-line)#logging synchronous

Router(config-line)#exec-timeout 0 0

R1(config-subif)#encap dot1Q 20

R1(config-subif)#ip add 10.1.1.1 255.0.0.0

R1(config-subif)#no sh

R1(config-subif)#encapsulation dot1Q 30

R1(config-subif)#ip add 20.1.1.1 255.0.0.0

R1(config-subif)#exit

R1(config)#int f0/0

R1(config-if)#full-duplex

R1(config-if)#no sh

2、配置交换机:

划分vlan,由于IOS原因,不支持在全局下划分vlan,进入vlan database下新建vlan 20 name ccna ,vlan 30 ccnp ,把端口改为access口,并划分到相应的vlan里边,激活端口!

S1(config)#no ip domain-lookup

S1(config)#line con 0

S1(config-line)#logg syn

S1(config-line)#exec-t 0 0

S1(config)#int range f0/0 -1

S1(config-if-range)#sw mo ac

S1(config-if-range)#sw ac vl 20

S1(config-if-range)#no sh

S1(config-if-range)#int range f0/2 -3

S1(config-if-range)#sw mo ac

S1(config-if-range)#sw ac vl 30

S1(config-if-range)#no sh

3、配置PC的ip,并设置网关!

VPCS 1 >ip 10.1.1.2 10.1.1.1 255.0.0.0
PC1 : 10.1.1.2 255.255.255.0 gateway 10.1.1.1

VPCS 1 >2
VPCS 2 >ip 10.1.1.3 10.1.1.1 255.0.0.0
PC2 : 10.1.1.3 255.255.255.0 gateway 10.1.1.1

VPCS 2 >3
VPCS 3 >ip 20.1.1.2 20.1.1.1 255.0.0.0
PC3 : 20.1.1.2 255.255.255.0 gateway 20.1.1.1

VPCS 3 >4
VPCS 4 >ip 20.1.1.3 20.1.1.1 255.0.0.0
PC4 : 20.1.1.3 255.255.255.0 gateway 20.1.1.1

4、拼测试!

VPCS 4 >ping 10.1.1.1

10.1.1.1 icmp_seq=1 time=66.000 ms

10.1.1.1 icmp_seq=2 time=10.000 ms

10.1.1.1 icmp_seq=3 time=4.000 ms

10.1.1.1 icmp_seq=4 time=6.000 ms

10.1.1.1 icmp_seq=5 time=6.000 ms

VPCS 4 >ping 10.1.1.2

10.1.1.2 icmp_seq=1 timeout

10.1.1.2 icmp_seq=2 time=10.000 ms

10.1.1.2 icmp_seq=3 time=25.000 ms

10.1.1.2 icmp_seq=4 time=6.000 ms

10.1.1.2 icmp_seq=5 time=31.000 ms

VPCS 4 >ping 10.1.1.3

10.1.1.3 icmp_seq=1 timeout

10.1.1.3 icmp_seq=2 time=43.000 ms

10.1.1.3 icmp_seq=3 time=38.000 ms

10.1.1.3 icmp_seq=4 time=41.000 ms

10.1.1.3 icmp_seq=5 time=6.000 ms

5:OK 测试通了,实验成功~!

实现了不同VLAN之间的通讯~!!

本文出自 “Djbing” 博客,请务必保留此出处http://djbing.blog.51cto.com/2367250/514206
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: