如何让两台 Cisco 交换机相互通信

网络工程 思科 路由 转变 VLAN 第3层
2021-07-09 06:07:58

我有一个带有多个 VLAN 的第 3 层交换机。

我创建了一个连接到第 2 层交换机的中继端口。

我现在可以从第 2 层交换机上的访问端口成功访问第 3 层交换机 VLAN。

但是,我不确定如何使交换机本身直接相互通信,即这样我就可以从一个交换机 telnet 到另一个交换机。

我应该创建一个“网络管理”VLAN 并在每个交换机上分配一个 IP 吗?我试过这个,但是每个交换机甚至不能在这个地址上 ping 自己。也许这是因为我没有将 VLAN 分配给任何接入端口,但是这看起来像是浪费了一个端口,因为我只希望它们通过中继端口进行通话。

解决此问题的标准方法是什么?


全三层交换机:

Current configuration : 5362 bytes
!
version 12.2
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname pac-inet-cs1
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
switch 1 provision ws-c3750g-24t
system mtu routing 1500
authentication mac-move permit
ip subnet-zero
ip routing
ip name-server 8.8.8.8
ip name-server 4.4.4.4
ip dhcp excluded-address 192.168.30.1 192.168.30.10
ip dhcp excluded-address 192.168.32.1 192.168.32.10
ip dhcp excluded-address 192.168.36.1 192.168.36.10
!
ip dhcp pool Vlan30
   network 192.168.30.0 255.255.255.0
   domain-name mailpac.net
   default-router 192.168.30.1
   dns-server 8.8.8.8
!
ip dhcp pool Vlan32
   network 192.168.32.0 255.255.255.0
   domain-name mailpac.net
   default-router 192.168.32.1
   dns-server 8.8.8.8
!
ip dhcp pool Vlan36
   network 192.168.36.0 255.255.255.0
   domain-name mailpac.net
   default-router 192.168.36.1
   dns-server 8.8.8.8
!
!

!
!
spanning-tree mode pvst
spanning-tree etherchannel guard misconfig
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
!
!
interface GigabitEthernet1/0/1
 switchport access vlan 71
 switchport mode access
!
interface GigabitEthernet1/0/2
 switchport access vlan 71
 switchport mode access
!
interface GigabitEthernet1/0/3
 description Trunk to pac-inet-as1
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface GigabitEthernet1/0/4
!
interface GigabitEthernet1/0/5
 switchport access vlan 30
!
interface GigabitEthernet1/0/6
 switchport access vlan 32
!
interface GigabitEthernet1/0/7
 switchport access vlan 36
!
interface GigabitEthernet1/0/8
!
interface GigabitEthernet1/0/9
!
interface GigabitEthernet1/0/10
!
interface GigabitEthernet1/0/11
!
interface GigabitEthernet1/0/12
!
interface GigabitEthernet1/0/13
!
interface GigabitEthernet1/0/14
!
interface GigabitEthernet1/0/15
!
interface GigabitEthernet1/0/16
!
interface GigabitEthernet1/0/17
!
interface GigabitEthernet1/0/18
!
interface GigabitEthernet1/0/19
!
interface GigabitEthernet1/0/20
!
interface GigabitEthernet1/0/21
!
interface GigabitEthernet1/0/22
!
interface GigabitEthernet1/0/23
!
interface GigabitEthernet1/0/24
 no switchport
 ip address 192.168.70.2 255.255.255.0
!
interface Vlan1
 no ip address
 shutdown
!
interface Vlan15
 description Inet Server Public
 ip address 192.168.15.2 255.255.255.0
!
interface Vlan28
 description Management VLAN
 ip address 192.168.28.121 255.255.255.0
!
interface Vlan30
 description Inet Client
 ip address 192.168.30.1 255.255.255.0
!
interface Vlan32
 description Inet Public Client
 ip address 192.168.32.1 255.255.255.0
!
interface Vlan34
 description Inet Direct Access
 ip address 192.168.34.1 255.255.255.0
!
interface Vlan36
 description Wi-Fi Management
 ip address 192.168.36.1 255.255.255.0
!
interface Vlan38
 description Wi-Fi Client
 ip address 192.168.46.1 255.255.248.0
!
interface Vlan71
 description Spectrum Public
 ip address 192.168.71.1 255.255.255.0
!
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.70.1
ip http server
ip http secure-server
!
!
ip sla enable reaction-alerts
!
!
line con 0
line vty 0 4
 password xxxxxx
 login
line vty 5 15
 password xxxxxx
 login

全二层交换机:

version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname pac-inet-as1
!
no aaa new-model
switch 2 provision ws-c3750g-48ts
ip subnet-zero
!
!
!
!
no file verify auto
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
interface GigabitEthernet2/0/1
 switchport access vlan 30
 switchport mode access
!
interface GigabitEthernet2/0/2
!
interface GigabitEthernet2/0/3
!
interface GigabitEthernet2/0/4
!
interface GigabitEthernet2/0/5
!
interface GigabitEthernet2/0/6
!
interface GigabitEthernet2/0/7
!
interface GigabitEthernet2/0/8
!
interface GigabitEthernet2/0/9
!
interface GigabitEthernet2/0/10
!
interface GigabitEthernet2/0/11
!
interface GigabitEthernet2/0/12
!
interface GigabitEthernet2/0/13
!
interface GigabitEthernet2/0/14
!
interface GigabitEthernet2/0/15
!
interface GigabitEthernet2/0/16
!
interface GigabitEthernet2/0/17
!
interface GigabitEthernet2/0/18
!
interface GigabitEthernet2/0/19
!
interface GigabitEthernet2/0/20
!
interface GigabitEthernet2/0/21
!
interface GigabitEthernet2/0/22
!
interface GigabitEthernet2/0/23
!
interface GigabitEthernet2/0/24
!
interface GigabitEthernet2/0/25
!
interface GigabitEthernet2/0/26
!
interface GigabitEthernet2/0/27
!
interface GigabitEthernet2/0/28
!
interface GigabitEthernet2/0/29
!
interface GigabitEthernet2/0/30
!
interface GigabitEthernet2/0/31
!
interface GigabitEthernet2/0/32
!
interface GigabitEthernet2/0/33
!
interface GigabitEthernet2/0/34
!
interface GigabitEthernet2/0/35
!
interface GigabitEthernet2/0/36
!
interface GigabitEthernet2/0/37
!
interface GigabitEthernet2/0/38
!
interface GigabitEthernet2/0/39
!
interface GigabitEthernet2/0/40
!
interface GigabitEthernet2/0/41
!
interface GigabitEthernet2/0/42
!
interface GigabitEthernet2/0/43
!
interface GigabitEthernet2/0/44
!
interface GigabitEthernet2/0/45
!
interface GigabitEthernet2/0/46
!
interface GigabitEthernet2/0/47
 switchport trunk encapsulation dot1q
 switchport mode trunk
!
interface GigabitEthernet2/0/48
!
interface GigabitEthernet2/0/49
!
interface GigabitEthernet2/0/50
!
interface GigabitEthernet2/0/51
!
interface GigabitEthernet2/0/52
!
interface Vlan1
 no ip address
!
interface Vlan28
 ip address 192.168.28.141 255.255.255.0
!
ip classless
ip http server
!
!
control-plane
!
line con 0
 password xxxxxxx
 login
line vty 0 4
 password xxxxxxx
 login
line vty 5 15
 no login
!

Vlan 28 上的三层交换机生成树:

VLAN0028
  Spanning tree enabled protocol ieee
  Root ID    Priority    32796
             Address     0019.2f19.c800
             Cost        4
             Port        3 (GigabitEthernet1/0/3)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32796  (priority 32768 sys-id-ext 28)
             Address     0027.0dc6.5480
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  300 sec

Interface           Role Sts Cost      Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi1/0/3             Root FWD 4         128.3    P2p

二层交换机在 Vlan 28 上没有生成树:

Spanning tree instance(s) for vlan 28 does not exist.
3个回答

首先,在您的第 3 层交换机中,默认路由是指向您没有网络的地址。那是行不通的。

接下来,我没有看到您的第 2 层交换机的默认网关。它就像 VLAN 28 上的任何其他主机一样,它需要一个默认网关才能访问其他网络。那应该是第 3 层交换机 VLAN 28 地址:192.168.28.121

您还应该设置密码,并在所有 VTY 线路上登录,并在 VTY 线路上登录transport input telnet

当您 telnet 到一台交换机时,您应该能够在该交换机上运行 telnet 以到达另一台交换机。

一种方法是创建一个用于管理的 VLAN(您不必拥有单独的 VLAN,但这是一个很好的做法),并为 VLAN 接口分配 IP 地址。确保它们在同一个 IP 子网中。然后,确保两台交换机上的中继端口都允许该 VLAN。您不需要该 VLAN 上的访问端口——只需中继端口即可。

编辑: 您需要在第 2 层交换机上创建 VLAN。在配置提示中,键入:

vlan 28
name Management
end

然后你应该看到女巫上的生成树实例

满足您的要求,即所有接入交换机和核心交换机在设置中相互通信

在核心交换机中创建附加管理 Vlan SVi。作为下面的例子。

Coreswitch(config)#interface Vlan 80

Coreswitch(config)#ip address 10.234.8.1 255.255.255.0

Coreswitch(config)#no shutdown

并在接入交换机中分配此子网 IP 地址,如下所示

Access(switch)#interface Vlan 80

Access(switch)ip address 10 .234.8.2 255.255.255.0

Access(switch)no shutdown

并配置核心和接入交换机之间的中继端口

现在尝试通过管理 Vlan 80 ip 地址访问核心和访问交换机,反之亦然。通过 telnet 或 ssh