2 个网关的 VLAN 配置

2 个网关的 VLAN 配置

我有一台 Cisco SG200-50 50 端口交换机,我想对其进行配置,以便有一个大的 LAN(交换机上的所有计算机都可以互相看到),但一半的计算机只能看到第一个网关,而一半的计算机只能看到另一个网关(即,插入左侧的计算机获得网关 1,插入右侧的计算机获得网关 2)。

这是当前配置(针对 3 个网关),在我胡乱操作之后。

interface vlan 1
 no ip address dhcp 
!
interface vlan 2
 name Backplane 
!
interface vlan 10
 name Servers 
!
interface vlan 101
 name "Modem/Router A" 
!
interface vlan 102
 name "Modem/Router B" 
!
interface vlan 103
 name "Modem/Router C" 
!
interface vlan 201
 name "Network A" 
!
interface vlan 202
 name "Network B" 
!
interface vlan 203
 name "Network C" 
!
interface vlan 1000
 name backplatest 
!
interface vlan 1001
 name routera 
!
interface vlan 1002
 name routerb 
!
interface gigabitethernet1
 switchport mode general 
 switchport general allowed vlan add 101,201 untagged 
 switchport general pvid 101 
!
interface gigabitethernet2
 switchport mode general 
 switchport general allowed vlan add 102,202 untagged 
 switchport general pvid 102 
!
interface gigabitethernet3
 switchport mode general 
 switchport general allowed vlan add 103,203 untagged 
 switchport general pvid 103 
!
interface gigabitethernet4
 switchport mode general 
!
interface gigabitethernet5
 switchport mode general 
!
interface gigabitethernet6
 switchport mode general 
!
interface gigabitethernet7
 switchport mode general 
 switchport general allowed vlan add 2,10,101,201 untagged 
 switchport general pvid 201 
!
interface gigabitethernet8
 switchport mode general 
 switchport general allowed vlan add 2,10,101,201 untagged 
 switchport general pvid 201 
!
interface gigabitethernet9
 switchport mode general 
 switchport general allowed vlan add 2,10,101,201 untagged 
 switchport general pvid 201 
!
interface gigabitethernet10
 switchport mode general 
 switchport general allowed vlan add 2,10,101,201 untagged 
 switchport general pvid 201 
!
interface gigabitethernet11
 switchport mode general 
 switchport general allowed vlan add 2,10,101,201 untagged 
 switchport general pvid 201 
!
interface gigabitethernet12
 switchport mode general 
 switchport general allowed vlan add 2,10,101,201 untagged 
 switchport general pvid 201 
!
interface gigabitethernet13
 switchport mode general 
 switchport general allowed vlan add 2,10,102,202 untagged 
 switchport general pvid 202 
!
interface gigabitethernet14
 switchport mode general 
 switchport general allowed vlan add 2,10,102,202 untagged 
 switchport general pvid 202 
!
interface gigabitethernet15
 switchport mode general 
 switchport general allowed vlan add 2,10,102,202 untagged 
 switchport general pvid 202 
!
interface gigabitethernet16
 switchport mode general 
 switchport general allowed vlan add 2,10,102,202 untagged 
 switchport general pvid 202 
!
interface gigabitethernet17
 switchport mode general 
 switchport general allowed vlan add 2,10,102,202 untagged 
 switchport general pvid 202 
!
interface gigabitethernet18
 switchport mode general 
 switchport general allowed vlan add 2,10,102,202 untagged 
 switchport general pvid 202 
!
interface gigabitethernet19
 switchport mode general 
 switchport general allowed vlan add 2,10,103,203 untagged 
 switchport general pvid 203 
!
interface gigabitethernet20
 switchport mode general 
 switchport general allowed vlan add 2,10,103,203 untagged 
 switchport general pvid 203 
!
interface gigabitethernet21
 switchport mode general 
 switchport general allowed vlan add 2,10,103,203 untagged 
 switchport general pvid 203 
!
interface gigabitethernet22
 switchport mode general 
 switchport general allowed vlan add 2,10,103,203 untagged 
 switchport general pvid 203 
!
interface gigabitethernet23
 switchport mode general 
 switchport general allowed vlan add 2,10,103,203 untagged 
 switchport general pvid 203 
!
interface gigabitethernet24
 switchport mode general 
 switchport general allowed vlan add 2,10,103,203 untagged 
 switchport general pvid 203 
!
interface gigabitethernet25
 switchport mode general 
 switchport general allowed vlan add 10,201-203 untagged 
 switchport general pvid 10 
!
interface gigabitethernet26
 switchport mode general 
 switchport general allowed vlan add 10,201-203 untagged 
 switchport general pvid 10 
!
interface gigabitethernet27
 switchport mode general 
 switchport general allowed vlan add 10,201-203 untagged 
 switchport general pvid 10 
!
interface gigabitethernet28
 switchport mode general 
 switchport general allowed vlan add 10,201-203 untagged 
 switchport general pvid 10 
!
interface gigabitethernet29
 switchport mode general 
 switchport general allowed vlan add 10,201-203 untagged 
 switchport general pvid 10 
!
interface gigabitethernet30
 switchport mode general 
 switchport general allowed vlan add 10,201-203 untagged 
 switchport general pvid 10 
!
interface gigabitethernet31
 switchport mode access 
 switchport access vlan 1000 
!
interface gigabitethernet32
 switchport mode access 
 switchport access vlan 1000 
!
interface gigabitethernet33
 switchport mode access 
 switchport access vlan 1000 
!
interface gigabitethernet34
 switchport mode access 
 switchport access vlan 1000 
 switchport general pvid 1000 
!

答案1

更新:我想我明白你在问什么,希望这个答案会更有用一些。

本质上,您需要做的是使交换机前半部分的 VLAN 可供交换机后半部分访问。

应该有办法将此 VLAN 添加到您想要同时访问这两个网络的端口。由于您只想使用一个网络,我们将配置“网络A“以访问整个交换机。

从命令行(您可以通过 SSH 连接到交换机吗?)它看起来像这样:

conf t
int gigabitethernet1-gigabitethernet24
switchport access vlan 101
switchport access vlan 201
exit

这会将交换机的前半部分分配给网络 A (vlan 201),并告知其使用路由器 A (vlan 101)。您可以对交换机的后半部分执行类似操作。

int gigabitethernet25-gigabitethernet50
switchport access vlan 102
switchport access vlan 201
exit

这会将交换机的另一半分配给网络 A(vlan 201),并告诉它使用路由器 B(vlan 102)。

这应该可以满足要求,或者至少可以让你朝着正确的方向前进,但我强烈建议你在对交换机进行任何更改之前,请务必测试此配置!

这组相同的步骤可以通过 Web GUI 完成,因此想法仍然相同,但过程略有不同。希望对您有所帮助。

相关内容