交换机中关于Vlan之间的具体通信?

三层交换机中关于VLan之间的具体通信过程,
包括在同一台交换机不同VLAN间的通信,不同交换机不同VLAN的通信。说具体点各位!!!
如;在有两台三层交换机 第一台上配了5个VALN 从VALN 2 到 6 第二台交换机配有5个VLAN 分别是vlan 10 20 30 40 50 现在问vlan 2 和vlan 20能不能通信?应该怎么配置?

同一台交换机不同VLAN之间的通信,可以看看单臂路由技术。

首先交换机配置

Switch(config)#vlan 2

Switch(config-vlan)#vlan 3

Switch(config-vlan)#exit  //创建2个VLAN 

Switch(config)#int f0/2

Switch(config-if)#switchport access vlan 2

Switch(config-if)#exit

Switch(config)#int f0/3

Switch(config-if)#switchport access vlan 3

Switch(config-if)#exit    // 把各端口划分到相应VLAN

Switch(config)#int f0/1

Switch(config-if)#switchport mode trunk 

Switch(config-if)#exit

然后路由器配置

Router>en

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#int f0/0

Router(config-if)#no shut

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

Router>en

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#int ?         //不知道就打?号

  Ethernet         IEEE 802.3

  FastEthernet     FastEthernet IEEE 802.3

  GigabitEthernet  GigabitEthernet IEEE 802.3z

  Loopback         Loopback interface

  Serial           Serial

  Vlan             Catalyst Vlans

  range            interface range command

Router(config)#int f0/?

  <0-24>  FastEthernet interface number

Router(config)#int f0/0.1 //进入子接口!

%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to upRouter(config-subif)#en

Router(config-subif)#encapsulation?

encapsulation  

Router(config-subif)#encapsulation ?

  dot1Q  IEEE 802.1Q Virtual LAN

Router(config-subif)#encapsulation d

Router(config-subif)#encapsulation dot1Q ?   //采用封装协议

  <1-1005>  IEEE 802.1Q VLAN ID

Router(config-subif)#encapsulation dot1Q 2   //这个2是VLAN 号!

Router(config-subif)#ip add 192.168.1.1 255.255.255.0  //IP地址就是VLAN的网关!

Router(config-subif)#exit

Router(config)#int f0/0.2

%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to upRouter(config-subif)#en

Router(config-subif)#encapsulation d

Router(config-subif)#encapsulation dot1Q 3

Router(config-subif)#ip add 192.168.2.1 255.255.255.0

Router(config-subif)#exit

Router(config)#exit

%SYS-5-CONFIG_I: Configured from console by console

   

Router#show ip route                //查看路由表!

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

       * - candidate default, U - per-user static route, o - ODR

       P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, FastEthernet0/0.1

C    192.168.2.0/24 is directly connected, FastEthernet0/0.2

温馨提示:内容为网友见解,仅供参考
第1个回答  2010-05-26
能通信,我用vlan2和vlan20举例
VLAN 2
ip address 10.0.0.1 255.255.255.0
vlan 20
ip address 10.0.1.1 255.255.255.0
interface f0/2
port access vlan 2
interface f0/3
port access vlan 20
两台主机接在f0/2和f0/3端口设置地址分别为 10.0.0.2/24 10.0.1.2/24
他们是能通信的,如果要限制两个vlan不能通信,就配置访问控制列表
第2个回答  2010-06-03
请注意了,你的两台交换机上配置的5个VLAN没有任何一个同时存在于两个交换机的,所以即使在VLAN下面都配置了IP地址,也是不能相互通信的。你现在的情况下,在这10个VLAN下面配置了IP地址后,第一台交换机的5个VLAN之间可以通信,第二台的5个VLAN之间也能通信,但是两台交换机之间却不能。如果要两台交换机之间相互通信,请在两台上各增加新的VLAN,譬如说VLAN100,并且在VLAN100下各自配同网段的IP地址,譬如192.168.100.1和192.168.100.2;这样所有VLAN之间能够完成通信连接。
第3个回答  2010-05-31
不嫌麻烦的话,启用ospf 动态路由协议,让两台三层交换机互相学习对方的路由表
第4个回答  2010-05-26
可以通信,在VLAN虚接口下配置IP地址,当相应客户端机器的网关
相似回答