通信人家园

标题: 用路由器实现VLAN间的互通  [查看完整版帖子] [打印本页]

时间:  2026-7-27 11:20
作者: zhangzhe369     标题: 用路由器实现VLAN间的互通

交换机的配置:
SW2950#configure t
SW2950(config)#vlan 2
SW2950(config)#vlan 3
SW2950(config)#int fastEthernet 0/1
SW2950(config-if)#switchport mode trunk
SW2950(config-if)#no shutdown
SW2950(config)#int fastEthernet 0/2
SW2950(config-if)#switchport mode access
SW2950(config-if)#switchport access vlan 2
SW2950(config-if)#int fas0/3
SW2950(config-if)#switchport mode access
SW2950(config-if)#switchport access vlan 3
SW2950(config-if)#end
SW2950#sho vlan
VLAN Name                             Status    Ports
------------------------------------ --------- -------------------------------
1    default                          active    Fa0/1, Fa0/5, Fa0/6, Fa0/7
                                               Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                               Fa0/12, Fa0/13, Fa0/14, Fa0/15
                                               Fa0/16, Fa0/17, Fa0/18, Fa0/19
                                               Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                               Fa0/24
2    VLAN0002                         active    Fa0/2
3    VLAN0003                         active    Fa0/3
         
SW2950#
SW2950#show interfaces fastEthernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: up
Administrative Trunking Encapsulation: isl
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
Administrative private-vlanhost-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk nativeVLAN: none
Administrative private-vlan trunkencapsulation: isl
Administrative private-vlan trunk normalVLANs: none
Administrative private-vlan trunk privateVLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
Protected: false
Appliance trust: none
SW2950#
路由器的配置:
interface fastethernet 0/0
no ip address
no shutdown
interface ethernet 0/0.2
ip address 10.1.1.1 255.255.255.0  //VLAN2
的网关
encapsulation
isl 2
interface ethernet 0/0.3
ip address 10.2.2.1 255.255.255.0  //vlan3
的网关
encapsulation
isl 3
交换机的配置:
SW2950#configure t
SW2950(config)#vlan 2
SW2950(config)#vlan 3
SW2950(config)#int fastEthernet 0/1
SW2950(config-if)#switchport mode trunk
SW2950(config-if)#no shutdown
SW2950(config)#int fastEthernet 0/2
SW2950(config-if)#switchport mode access
SW2950(config-if)#switchport access vlan 2
SW2950(config-if)#int fas0/3
SW2950(config-if)#switchport mode access
SW2950(config-if)#switchport access vlan 3
SW2950(config-if)#end
SW2950#sho vlan
VLAN Name                             Status    Ports
---- ----------------------------------------- -------------------------------
1   default                         active    Fa0/1, Fa0/5, Fa0/6,Fa0/7
                                               Fa0/8, Fa0/9,Fa0/10, Fa0/11
                                               Fa0/12, Fa0/13, Fa0/14, Fa0/15
                                               Fa0/16, Fa0/17, Fa0/18, Fa0/19
                                               Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                               Fa0/24
2    VLAN0002                         active    Fa0/2
3    VLAN0003                         active    Fa0/3
         
SW2950#
SW2950#show interfaces fastEthernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: up
Administrative Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
Administrative private-vlanhost-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk nativeVLAN: none
Administrative private-vlan trunkencapsulation: dot1q
Administrative private-vlan trunk normalVLANs: none
Administrative private-vlan trunk privateVLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
Protected: false
Appliance trust: none
SW2950#
路由器的配置:
interface fastethernet 0/0
no ip address
no shutdown
interface ethernet 0/0.2
ip address 10.1.1.1 255.255.255.0  //VLAN2
的网关
encapsulation
dot1q  2
interface ethernet 0/0.3
ip address 10.2.2.1 255.255.255.0  //vlan3
的网关
encapsulation
dot1q 3


时间:  2026-7-27 11:25
作者: 管局保安员

感谢技术分享
时间:  2026-7-27 15:38
作者: xhy133

感谢技术分享
时间:  2026-7-29 07:57
作者: 777888999

感谢分享技术资料




通信人家园 (https://www.txrjy.com/) Powered by C114