SVI VLAN间路由

网络工程 思科 路由 转变 VLAN
2021-07-23 22:51:40

我有 2 台 3560G 交换机,我正在尝试在其上 ping 另一个 vlan,但无法获取数据包。

这是我的配置

开关 #1

Switch#sh run
Building configuration...

Current configuration : 1946 bytes
!
version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname Switch
!
!
no aaa new-model
system mtu routing 1500
ip subnet-zero
ip routing
!
!
!
!
no file verify auto
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
interface Port-channel1
 no switchport
 ip address 10.10.10.10 255.255.255.0
 standby 1 ip
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface GigabitEthernet0/3
!
interface GigabitEthernet0/4
!
interface GigabitEthernet0/5
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30,40
 switchport mode trunk
!
interface GigabitEthernet0/6
!
interface GigabitEthernet0/7
!
interface GigabitEthernet0/8
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30,40
 switchport mode trunk
!
interface GigabitEthernet0/9
!
interface GigabitEthernet0/10
!
interface GigabitEthernet0/11
!
interface GigabitEthernet0/12
!
interface GigabitEthernet0/13
!
interface GigabitEthernet0/14
!
interface GigabitEthernet0/15
!
interface GigabitEthernet0/16
!
interface GigabitEthernet0/17
!
interface GigabitEthernet0/18
!
interface GigabitEthernet0/19
!
interface GigabitEthernet0/20
!
interface GigabitEthernet0/21
!
interface GigabitEthernet0/22
!
interface GigabitEthernet0/23
!
interface GigabitEthernet0/24
!
interface GigabitEthernet0/25
!
interface GigabitEthernet0/26
!
interface GigabitEthernet0/27
!
interface GigabitEthernet0/28
!
interface Vlan1
 no ip address

!
interface Vlan10
 ip address 196.10.10.10 255.255.255.0
 standby 1 ip
!
interface Vlan20
 ip address 196.10.20.10 255.255.255.0
 standby 1 ip
!
interface Vlan30
 ip address 196.10.30.10 255.255.255.0
 standby 1 ip
!
interface Vlan40
 ip address 196.10.40.10 255.255.255.0
 standby 1 ip
!
ip classless
ip http server
!
!
!
control-plane
!
!
line con 0
line vty 5 15
!
end

开关2

new#sh run
Building configuration...

Current configuration : 2826 bytes
!
version 12.2
no service pad
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname new
!
enable secret 5 $1$xoou$YnuOXQYgUhhL3ouroeqlw1
enable password pokemon
!
no aaa new-model
system mtu routing 1500
ip subnet-zero
ip routing
!
!
!
!
!
 --More--
03:37:39: %SYS-5-CONFIG_I: Configured from console !        e
no file verify auto
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
interface Port-channel1
 no switchport
 ip address 10.10.1.10 255.255.255.0
 standby 1 ip
!
interface FastEthernet0/1
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface FastEthernet0/25
!
interface FastEthernet0/26
!
interface FastEthernet0/27
!
interface FastEthernet0/28
!
interface FastEthernet0/29
!
interface FastEthernet0/30
!
interface FastEthernet0/31
!
interface FastEthernet0/32
!
interface FastEthernet0/33
!
interface FastEthernet0/34
!
interface FastEthernet0/35
!
interface FastEthernet0/36
!
interface FastEthernet0/37
!
interface FastEthernet0/38
!
interface FastEthernet0/39
!
interface FastEthernet0/40
!
interface FastEthernet0/41
!
interface FastEthernet0/42
!
interface FastEthernet0/43
!
interface FastEthernet0/44
!
interface FastEthernet0/45
!
interface FastEthernet0/46
!
interface FastEthernet0/47
!
interface FastEthernet0/48
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30,40
 switchport mode trunk
!
interface GigabitEthernet0/3
!
interface GigabitEthernet0/4
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30,40
 switchport mode trunk
!
interface Vlan1
 no ip address
!
interface Vlan10
 ip address 200.200.1.2 255.255.255.0
 standby ip 172.30.40.10
 standby 1 ip
!
interface Vlan20
 ip address 200.200.2.2 255.255.255.0
 standby ip 172.30.50.10
 standby 1 ip
!
interface Vlan30
 ip address 200.200.3.2 255.255.255.0
 standby ip 172.30.70.10
 standby 1 ip
!
interface Vlan40
 ip address 200.200.4.2 255.255.255.0
 standby ip 172.30.80.10
 standby 1 ip
!
ip classless
ip http server
ip http secure-server
!
!
!
control-plane
!
!
line con 0
 exec-timeout 0 0
line vty 0 4
 password pokemon
 login
line vty 5 15
 password pokemon
 login
!
end

编辑: 例如

Switch#ping 200.200.1.2 source 196.10.10.10

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.200.1.2, timeout is 2 seconds:
Packet sent with a source address of 196.10.10.10
.....
Success rate is 0 percent (0/5)
2个回答

您似乎有多个问题:

  • 您在每台交换机上都定义了端口通道,但没有作为端口通道成员的接口。
  • 您没有任何连接两台交换机的路由链路。
  • 您没有任何静态路由或路由协议来与其他交换机共享每个交换机上的路由。
  • 您正在尝试使用 HSRP,但除非您在两台交换机上使用相同的网络,否则这不起作用。
  • 您似乎在交换机之间中继 VLAN,但每台交换机都有自己的 VLAN,它们使用的网络与另一台交换机上的 VLAN 不同。
  • 您尚未将任何交换机接口分配给默认 VLAN 1 以外的 VLAN

您的问题不清楚您要做什么,但我为您列出了几个选项。

您可以尝试这样的操作,为您在两台交换机上定义的单独网络设置两个单独的路由器(两台交换机上完全独立的 VLAN,即使它们使用相同的 VLAN 编号):

开关 1:

interface Port-channel1
 description Channel to Switch 2 Po1
 no switchport
 ip address 10.10.10.1 255.255.255.0
!
interface GigabitEthernet0/5
 description Link to Switch 2 G0/2
 no switchport
 channel-group 1 mode on
!
interface GigabitEthernet0/8
 description Link to Switch 2 G0/4
 no switchport
 channel-group 1 mode on
!
interface Vlan10
 ip address 196.10.10.10 255.255.255.0
!
interface Vlan20
 ip address 196.10.20.10 255.255.255.0
!
interface Vlan30
 ip address 196.10.30.10 255.255.255.0
!
interface Vlan40
 ip address 196.10.40.10 255.255.255.0
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!

开关2:

interface Port-channel1
 description Channel to Switch 1 Po1
 no switchport
 ip address 10.10.10.2 255.255.255.0
!
interface GigabitEthernet0/2
 description Link to Switch 1 G0/5
 no switchport
 channel-group 1 mode on
!
interface GigabitEthernet0/4
 description Link to Switch 1 G0/8
 no switchport
 channel-group 1 mode on
!
interface Vlan10
 ip address 200.200.1.2 255.255.255.0
!
interface Vlan20
 ip address 200.200.2.2 255.255.255.0
!
interface Vlan30
 ip address 200.200.3.2 255.255.255.0
!
interface Vlan40
 ip address 200.200.4.2 255.255.255.0
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!

您可以尝试这样的操作,在两台交换机(两台交换机上的 VLAN)上为同一网络设置两个单独的路由器:

开关 1:

interface Port-channel1
 description Channel to Switch 2 Po1
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30,40
 switchport mode trunk
!
interface GigabitEthernet0/5
 description Link to Switch 2 G0/2
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30,40
 switchport mode trunk    
!
interface GigabitEthernet0/8
 description Link to Switch 2 G0/4
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30,40
 switchport mode trunk
!
interface Vlan10
 ip address 196.10.10.10 255.255.255.0
 standby 1 ip 196.10.10.1
 standby 1 priority 110
 standby 1 preempt
!
interface Vlan20
 ip address 196.10.20.10 255.255.255.0
 standby 1 ip 196.10.20.1
 standby 1 priority 110
 standby 1 preempt
!
interface Vlan30
 ip address 196.10.30.10 255.255.255.0
 standby 1 ip 196.10.30.1
 standby 1 priority 110
 standby 1 preempt
!
interface Vlan40
 ip address 196.10.40.10 255.255.255.0
 standby 1 ip 196.10.40.1
 standby 1 priority 110
 standby 1 preempt
!

开关2:

interface Port-channel1
 description Channel to Switch 1 Po1
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30,40
 switchport mode trunk
!
interface GigabitEthernet0/2
 description Link to Switch 1 G0/5
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30,40
 switchport mode trunk
!
interface GigabitEthernet0/4
 description Link to Switch 1 G0/8
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 10,20,30,40
 switchport mode trunk
!
interface Vlan10
 ip address 196.10.10.11 255.255.255.0
 standby 1 ip 196.10.10.1
 standby 1 priority 100
 standby 1 preempt
!
interface Vlan20
 ip address 196.10.20.11 255.255.255.0
 standby 1 ip 196.10.20.1
 standby 1 priority 100
 standby 1 preempt
!
interface Vlan30
 ip address 196.10.30.11 255.255.255.0
 standby 1 ip 196.10.30.1
 standby 1 priority 100
 standby 1 preempt
!
interface Vlan40
 ip address 196.10.40.11 255.255.255.0
 standby 1 ip 196.10.40.1
 standby 1 priority 100
 standby 1 preempt
!

编辑:

您正在尝试从一台交换机上的一个网络 ping 到另一台交换机上的另一个网络。问题是您尝试 ping 的交换机不知道如何访问另一台交换机上的网络。您需要放置静态路由,或者需要在交换机之间运行路由协议。不知何故,两台交换机都需要了解另一台交换机上的网络,否则流量将被丢弃。

根据您的编辑,我给您的第一个示例应该可以工作。我真的认为您混淆了第 2 层和第 3 层。通过在交换机之间使用中继,两台交换机上的 VLAN 相同,您可以通过第 2 层从一个 VLAN 到达另一台交换机。您缺少的是要在交换机之间进行路由,您需要一个路由链接,以及一些让一台交换机知道将流量发送到另一台交换机的方法,以便将流量发送到另一台交换机上的网络。这是第 3 层问题,而不是第 2 层问题。

理想情况下,每个 VLAN 只有一个 IP 子网。因此,撤消重叠的 VLAN 或重新 IP 地址重叠的子网。无论哪种方式都会起作用。