静态路由是自动发现还是需要在 Cisco 路由器中运行任何命令?

网络工程 思科 思科-ios
2022-02-19 09:44:50

静态路由是自动发现还是需要运行任何命令?

我有两个路由器,我已经为它们的链接端口配置了 IP 地址。

但是Router3的路由是空的:

Router#show ip route 
Default gateway is not set

Host               Gateway           Last Use    Total Uses  Interface
ICMP redirect cache is empty

他们是直接连接的,为什么没有静态路由?是否需要任何命令来发现它?


编辑-1

这是我的Router3的运行配置:

Router#show running-config 
Building configuration...

Current configuration : 1113 bytes
!
version 15.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
boot system flash cgr1000-universalk9-mz.SPA.154-2.CG 
!
!
!
!
!
!
no ip cef
no ipv6 cef
!
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface GigabitEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface FastEthernet2/3
 switchport mode access
 switchport nonegotiate
!
interface FastEthernet2/4
 switchport mode access
 switchport nonegotiate
!
interface FastEthernet2/5
 switchport mode access
 switchport nonegotiate
!
interface FastEthernet2/6
 switchport mode access
 switchport nonegotiate
!
interface GigabitEthernet2/1
 no switchport
 ip address 12.12.12.1 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet2/2
 switchport mode access
 switchport nonegotiate
!
interface Dot11Radio2/1
 no ip address
 shutdown
!
interface Vlan1
 no ip address
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
!
line con 0
!
line 1/1 1/2
 stopbits 1
!
line 1/3 1/6
 stopbits 1
!
line vty 0 4
 login
!
!
!
!
end

编辑-2

cdp neighbors的Router3:

Router#show cdp neighbors 
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID    Local Intrfce   Holdtme    Capability   Platform    Port ID
Router       Gig 2/1          157                    CGR1000     Gig 2/1
3个回答

将评论转换为答案。

没有最后的网关,因为交换机上没有启用路由。在全局配置中使用ip routing解决了问题,现在可以看到最后的网关。

尽管这被称为“路由器”,但它更像是第 3 层交换机。我认为思科的营销部门并不关心技术一致性。

您在路由表中看不到任何内容的原因是,对于较旧的交换机,您首先必须使用“ip routing”命令打开路由。否则,它将停留在第 2 层模式,并仅使用默认网关来路由第 3 层流量。

对于直接连接的网络,路由条目将在 layer3 设备中自动创建。

对于其他网络,应手动配置静态和动态路由条目以将数据包路由到目的地。