取消
显示结果 
搜索替代 
您的意思是: 
cancel
455
查看次数
2
有帮助
6
回复

【求助】思科ISR C1100系列路由器 wan口配置为固定IP问题

sampsonlor
Level 1
Level 1

目前在用cisco C1100系列路由器,具体型号为C1111-4P,具体配置如下

Current configuration : 12558 bytes
!
! Last configuration change at 15:52:46 UTC Sat Jul 12 2025 by admin
! NVRAM config last updated at 15:49:06 UTC Sat Jul 12 2025 by admin
!
version 17.16
service timestamps debug datetime msec
service timestamps log datetime msec
service call-home
platform qfp utilization monitor load 80
no platform punt-keepalive disable-kernel-core
platform hardware throughput crypto 50000
!
hostname C1111-4P
!
boot-start-marker
boot system bootflash:c1100-universalk9.17.16.01a.SPA.bin
! Warning: Booting with bundle mode will be deprecated in the near future. Migration to install mode is required.
boot system bootflash:c1100-universalk9.17.12.01a.SPA.bin
! Warning: Booting with bundle mode will be deprecated in the near future. Migration to install mode is required.
boot-end-marker
!
!
no aaa new-model
clock timezone UTC 8 0
!
ip name-server 114.114.114.114 8.8.8.8
!
!
!
ip nbar http-services
!
!
!
!
!
ip dhcp excluded-address 192.168.1.0
ip dhcp excluded-address 192.168.1.255 255.255.255.255
!
ip dhcp pool Vlan1
 network 192.168.1.0 255.255.255.0
 default-router 192.168.1.254 
 dns-server 202.101.224.69 
!
!
!
login on-success log
!
!
!
!
!
ipv6 unicast-routing
!
!
subscriber templating
! 
! 
! 
! 
!
!
!
!
!
!
!
!
!
!
!
crypto pki trustpoint TP-self-signed-350757299
 enrollment selfsigned
 subject-name cn=IOS-Self-Signed-Certificate-350757299
 revocation-check none
 rsakeypair TP-self-signed-350757299
 hash sha256
!
crypto pki trustpoint SLA-TrustPoint
 enrollment pkcs12
 revocation-check crl
 hash sha256
!
!
crypto pki certificate chain TP-self-signed-350757299
crypto pki certificate chain SLA-TrustPoint
!
crypto pki certificate pool
 cabundle nvram:ios_core.p7b
!
!
!
!
voice service voip
 allow-connections sip to sip
 supplementary-service media-renegotiate
 trace
 sip
  registrar server expires max 120 min 60
!
!
!
!
!
!
voice register global
 mode cme
 source-address 192.168.5.1 port 5060
 max-dn 200
 max-pool 50
 auto-register
 !
!
!
!
!
diagnostic bootup level minimal
!
no license feature hseck9
license udi pid C1111-4P sn FGL2415LMTW
license boot suite FoundationSuiteK9
license boot level uck9
memory free low-watermark processor 65914
et-analytics
!
spanning-tree extend system-id
!
!
username admin privilege 15 password 0 
redundancy
 mode none
!
!
!
!
!
!
!
vlan internal allocation policy ascending
!
lldp run
!
class-map match-all WEBUI-MULTIMEDIA_CONFERENCING-DSCP
 match dscp af41 
class-map match-all WEBUI-BROADCAST_VIDEO-NBAR
 match protocol attribute traffic-class broadcast-video
 match protocol attribute business-relevance business-relevant
class-map match-all WEBUI-VOICE-NBAR
 match protocol attribute traffic-class voip-telephony
 match protocol attribute business-relevance business-relevant
class-map match-all WEBUI-BULK_DATA-NBAR
 match protocol attribute traffic-class bulk-data
 match protocol attribute business-relevance business-relevant
class-map match-all WEBUI-SIGNALING-NBAR
 match protocol attribute traffic-class signaling
 match protocol attribute business-relevance business-relevant
class-map match-all WEBUI-NETWORK_CONTROL-DSCP
 match dscp cs6 
class-map match-all WEBUI-SCAVENGER-NBAR
 match protocol attribute business-relevance business-irrelevant
class-map match-all WEBUI-SCAVENGER-DSCP
 match dscp cs1 
class-map match-all WEBUI-NETWORK_CONTROL-NBAR
 match protocol attribute traffic-class network-control
 match protocol attribute business-relevance business-relevant
class-map match-all WEBUI-SIGNALING-DSCP
 match dscp cs3 
class-map match-all WEBUI-BULK_DATA-DSCP
 match dscp af11 
class-map match-all WEBUI-BROADCAST_VIDEO-DSCP
 match dscp cs5 
class-map match-all WEBUI-MULTIMEDIA_CONFERENCING-NBAR
 match protocol attribute traffic-class multimedia-conferencing
 match protocol attribute business-relevance business-relevant
class-map match-all WEBUI-VOICE-DSCP
 match dscp ef 
class-map match-all WEBUI-NETWORK_MANAGEMENT-NBAR
 match protocol attribute traffic-class ops-admin-mgmt
 match protocol attribute business-relevance business-relevant
class-map match-all WEBUI-MULTIMEDIA_STREAMING-DSCP
 match dscp af31 
class-map match-all WEBUI-REALTIME_INTERACTIVE-NBAR
 match protocol attribute traffic-class real-time-interactive
 match protocol attribute business-relevance business-relevant
class-map match-all WEBUI-TRANSACTIONAL_DATA-DSCP
 match dscp af21 
class-map match-all WEBUI-REALTIME_INTERACTIVE-DSCP
 match dscp cs4 
class-map match-all WEBUI-TRANSACTIONAL_DATA-NBAR
 match protocol attribute traffic-class transactional-data
 match protocol attribute business-relevance business-relevant
class-map match-all WEBUI-NETWORK_MANAGEMENT-DSCP
 match dscp cs2 
class-map match-all WEBUI-MULTIMEDIA_STREAMING-NBAR
 match protocol attribute traffic-class multimedia-streaming
 match protocol attribute business-relevance business-relevant
!
policy-map WEBUI-MARKING-IN
 class WEBUI-VOICE-NBAR
  set dscp ef
 class WEBUI-BROADCAST_VIDEO-NBAR
  set dscp cs5
 class WEBUI-REALTIME_INTERACTIVE-NBAR
  set dscp cs4
 class WEBUI-MULTIMEDIA_CONFERENCING-NBAR
  set dscp af41
 class WEBUI-MULTIMEDIA_STREAMING-NBAR
  set dscp af31
 class WEBUI-SIGNALING-NBAR
  set dscp cs3
 class WEBUI-NETWORK_CONTROL-NBAR
  set dscp cs6
 class WEBUI-NETWORK_MANAGEMENT-NBAR
  set dscp cs2
 class WEBUI-TRANSACTIONAL_DATA-NBAR
  set dscp af21
 class WEBUI-BULK_DATA-NBAR
  set dscp af11
 class WEBUI-SCAVENGER-NBAR
  set dscp cs1
 class class-default
  set dscp default
policy-map WEBUI-QUEUING-OUT
 class WEBUI-VOICE-DSCP
  priority percent 10
 class WEBUI-BROADCAST_VIDEO-DSCP
  priority percent 10
 class WEBUI-REALTIME_INTERACTIVE-DSCP
  priority percent 13
 class WEBUI-NETWORK_CONTROL-DSCP
  bandwidth percent 2 
 class WEBUI-SIGNALING-DSCP
  bandwidth percent 2 
 class WEBUI-NETWORK_MANAGEMENT-DSCP
  bandwidth percent 3 
 class WEBUI-MULTIMEDIA_CONFERENCING-DSCP
  bandwidth percent 10 
  fair-queue
  random-detect dscp-based
 class WEBUI-MULTIMEDIA_STREAMING-DSCP
  bandwidth percent 10 
  fair-queue
  random-detect dscp-based
 class WEBUI-TRANSACTIONAL_DATA-DSCP
  bandwidth percent 10 
  fair-queue
  random-detect dscp-based
 class WEBUI-BULK_DATA-DSCP
  bandwidth percent 4 
  fair-queue
  random-detect dscp-based
 class WEBUI-SCAVENGER-DSCP
  bandwidth percent 1 
 class class-default
  bandwidth percent 25 
  fair-queue
  random-detect dscp-based
!
!
! 
!
!
!
!
!
!
!
!
!
!
!
!
!
! 
! 
!
!
interface Loopback0
 ip address 192.168.254.1 255.255.255.0
!
interface GigabitEthernet0/0/0
 no ip address
 negotiation auto
 service-policy output WEBUI-QUEUING-OUT
!
interface GigabitEthernet0/0/1
 ip address 192.168.128.81 255.255.255.0
 ip nat outside
 media-type rj45
 negotiation auto
 spanning-tree bpdufilter enable
 spanning-tree bpduguard enable
 service-policy output WEBUI-QUEUING-OUT
!
interface GigabitEthernet0/1/0
 spanning-tree bpdufilter enable
 spanning-tree bpduguard enable
!
interface GigabitEthernet0/1/1
!
interface GigabitEthernet0/1/2
 switchport
!
interface GigabitEthernet0/1/3
 switchport
 switchport mode access
!
interface Vlan1
 ip address 192.168.1.254 255.255.255.0
 ip nbar protocol-discovery
 ip nat inside
 service-policy input WEBUI-MARKING-IN
!
iox
ip forward-protocol nd
ip forward-protocol udp
ip http server
ip http authentication local
ip http secure-server
ip http secure-trustpoint TP-self-signed-350757299
ip http timeout-policy idle 600 life 600 requests 25 
!
ip nat inside source list 101 interface GigabitEthernet0/0/1 overload
ip nat inside source list CISCO-CWA-URL-REDIRECT-ACL interface GigabitEthernet0/0/1 overload
ip nat inside source route-map track-primary-if interface GigabitEthernet0/0/1 overload
ip route 0.0.0.0 0.0.0.0 192.168.128.254
ip ssh bulk-mode 131072
!
ip access-list extended 101
 10 permit ip any any
 20 permit udp any eq domain any
route-map track-primary-if permit 1 
 match ip address 197
 set interface GigabitEthernet0/0/1
!
snmp-server manager
!
!
!
control-plane
!
!
!
!
!
telephony-service
 max-dn 200
 ip source-address 192.168.5.1 port 2000
 max-conferences 8 gain -6
 transfer-system full-consult
!
!
!
!
line con 0
 transport input none
 stopbits 1
line vty 0
 login
 length 0
 transport input ssh
line vty 1 4
 login
 transport input ssh
line vty 5 14
 login
 transport input ssh
!
ntp server ip ciscome.pool.ntp.org prefer source GigabitEthernet0/0/1
call-home
 ! If contact email address in call-home is configured as sch-smart-licensing@cisco.com
 ! the email address configured in Cisco Smart License Portal will be used as contact email address to send SCH notifications.
 contact-email-addr sch-smart-licensing@cisco.com
 profile "CiscoTAC-1"
  active
  destination transport-method http
!
!
!
!
!
!
end

上面的配置中,将interface GigabitEthernet0/0/1配置为192.168.128.81 255.255.255.0

网关配置为 192.168.128.254

但是在这个配置下,系统显示GigabitEthernet0/0/1为lan口,如图:

sampsonlor_0-1752307354114.png

如果在webUI将GigabitEthernet0/0/1修改为wan口,系统会自动添加一条静态路由

ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1,导致网络不通。如下图:

sampsonlor_1-1752307606744.png

如果删除该条静态路由,则GigabitEthernet0/0/1在系统中又会显示为lan口。

想请教下各位,

1. 在给定ip和网关的情况下,我的配置是否正确?

2. webUI是不是通过ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1这条配置来判断某接口是lan还是wan?

3. 还是说需要将GigabitEthernet0/0/1设置为wan口,保留ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1的配置?

4. 在保留ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1配置的情况下,又需要增加哪些配置才能走通网络呢?

5. GigabitEthernet0/0/1设置为lan或wan,会有哪些影响?是否会对后续配置隧道和DMVPN造成影响?

谢谢各位

 

1 个已接受解答

已接受的解答

Rockyw
Spotlight
Spotlight

1. 在给定ip和网关的情况下,我的配置是否正确?

答:基本正确但有缺陷​​:
NAT配置合理(ip nat inside source list 101 interface GigabitEthernet0/0/1 overload)。
​​静态路由需修正​​:当前配置 ip route 0.0.0.0 0.0.0.0 192.168.128.254 未绑定出接口,应改为:

ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1 192.168.128.254

或明确指定下一跳IP(如现有配置),但需确保ARP解析正常。

2. webUI是不是通过ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1这条配置来判断某接口是lan还是wan?

答:是的​​。WebUI根据以下逻辑自动识别接口角色:若接口是默认路由的出接口 → 识别为 ​​WAN口​​(连接外网)。若接口连接内网设备且无默认路由 → 识别为 ​​LAN口​​(如VLAN1)。

3. 还是说需要将GigabitEthernet0/0/1设置为wan口,保留ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1的配置?

答:必须设置为WAN口​​。因该接口承担外网通信(NAT Outside、网关指向公网),作为WAN口是正确设计。保留修正后的默认路由​​(包含出接口+网关IP)。

4. 在保留ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1配置的情况下,又需要增加哪些配置才能走通网络呢?

答:修正默认路由并验证基础配置:

! 删除原错误路由
no ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1
! 添加正确路由(二选一)
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1 192.168.128.254 # 指定出接口+网关

ip route 0.0.0.0 0.0.0.0 192.168.128.254 # 仅网关(依赖ARP解析)

关键验证步骤​​:

ping 192.168.128.254 # 确认网关可达
show ip route # 检查默认路由是否生效
show ip nat translations # 验证NAT会话状态

5. GigabitEthernet0/0/1设置为lan或wan,会有哪些影响?是否会对后续配置隧道和DMVPN造成影响?

答:接口类型​为WAN口​,DMVPN依赖公网IP接口建立隧道(mGRE/NHRP需公网可达性)。接口类型为LAN口​​,若错误配置为LAN口,隧道无法建立(NHRP注册失败,路由协议无法交互)。

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rockyw | If it solves your problem, please mark as answer. Thanks !

在原帖中查看解决方案

6 条回复6

Rockyw
Spotlight
Spotlight

GigabitEthernet0/0/1 被配置为:
IP地址:192.168.128.81/24
NAT Outside(外网接口)
网关:192.168.128.254
静态路由:ip route 0.0.0.0 0.0.0.0 192.168.128.254
​​问题​​:静态路由未指定出接口(如 ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1 192.168.128.254),导致路由表可能无法正确关联接口。

当您将接口改为WAN口时,系统自动添加 ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1,​​这是正确的默认路由​​。此时网络不通是因缺少下一跳网关地址(仅指定出接口未指定网关IP),需结合网关IP配置。

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rockyw | If it solves your problem, please mark as answer. Thanks !

Rockyw
Spotlight
Spotlight

1. 在给定ip和网关的情况下,我的配置是否正确?

答:基本正确但有缺陷​​:
NAT配置合理(ip nat inside source list 101 interface GigabitEthernet0/0/1 overload)。
​​静态路由需修正​​:当前配置 ip route 0.0.0.0 0.0.0.0 192.168.128.254 未绑定出接口,应改为:

ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1 192.168.128.254

或明确指定下一跳IP(如现有配置),但需确保ARP解析正常。

2. webUI是不是通过ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1这条配置来判断某接口是lan还是wan?

答:是的​​。WebUI根据以下逻辑自动识别接口角色:若接口是默认路由的出接口 → 识别为 ​​WAN口​​(连接外网)。若接口连接内网设备且无默认路由 → 识别为 ​​LAN口​​(如VLAN1)。

3. 还是说需要将GigabitEthernet0/0/1设置为wan口,保留ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1的配置?

答:必须设置为WAN口​​。因该接口承担外网通信(NAT Outside、网关指向公网),作为WAN口是正确设计。保留修正后的默认路由​​(包含出接口+网关IP)。

4. 在保留ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1配置的情况下,又需要增加哪些配置才能走通网络呢?

答:修正默认路由并验证基础配置:

! 删除原错误路由
no ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1
! 添加正确路由(二选一)
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1 192.168.128.254 # 指定出接口+网关

ip route 0.0.0.0 0.0.0.0 192.168.128.254 # 仅网关(依赖ARP解析)

关键验证步骤​​:

ping 192.168.128.254 # 确认网关可达
show ip route # 检查默认路由是否生效
show ip nat translations # 验证NAT会话状态

5. GigabitEthernet0/0/1设置为lan或wan,会有哪些影响?是否会对后续配置隧道和DMVPN造成影响?

答:接口类型​为WAN口​,DMVPN依赖公网IP接口建立隧道(mGRE/NHRP需公网可达性)。接口类型为LAN口​​,若错误配置为LAN口,隧道无法建立(NHRP注册失败,路由协议无法交互)。

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rockyw | If it solves your problem, please mark as answer. Thanks !

谢谢回复,添加静态路由ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1 192.168.128.254后,网络联通正常。

在接口配置中GigabitEthernet0/0/1也显示为wan口,但webUI仍然提示primary wan未配置,请问是还缺了什么配置吗?

sampsonlor_0-1752334611624.png

 

WebUI对WAN口的“Primary”状态检测通常依赖以下条件:

·​​默认路由指向WAN口​​:您已通过ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1 192.168.128.254满足该条件。
·​​NAT配置关联WAN口​​:您的配置ip nat outside已正确应用在接口上。
​​·接口协议状态为UP​​:需确保物理层(Layer 1)和协议层(Layer 2)状态正常(show interfaces GigabitEthernet0/0/1确认无down状态)。
​​·DHCP或静态IP配置完整性​​:若WebUI要求DHCP客户端激活,需补充相关配置。

解决方案​

(1) 启用DHCP客户端功能(即使使用静态IP)​

部分WebUI要求WAN口启用DHCP客户端服务(即使实际使用静态IP),需在接口添加:

interface GigabitEthernet0/0/1
ip address 192.168.128.81 255.255.255.0
ip dhcp client route track 1 # 启用DHCP路由跟踪(模拟WAN服务状态)

(2) 显式声明WAN角色​

通过CLI强制标记接口为Primary WAN:

interface GigabitEthernet0/0/1
description PRIMARY-WAN # 明确描述接口角色

(3) 检查NAT与路由协同

确认NAT配置关联了正确的ACL和接口:

ip nat inside source list 101 interface GigabitEthernet0/0/1 overload

若ACL 101未涵盖所有内网流量(如缺少子网),需扩展ACL范围。

​​(4) 更新WebUI缓存​

重启Web服务刷新状态检测:

reload webui # 或重启路由器(谨慎操作)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rockyw | If it solves your problem, please mark as answer. Thanks !

谢谢回复,按照您给的配置进行了尝试,添加了相应配置

sampsonlor_2-1752590416503.png

 

NAT的配置101已经包含Gi 0/0/1

sampsonlor_1-1752590157092.png

 

刷新后WebUI仍然显示Primary WAN未配置

sampsonlor
Level 1
Level 1

反复试验了一下,现在webUI似乎只认为存在配置ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1时,才显示wen口已配置。

如果将配置改为 ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0/1 192.168.128.254,接口配置中显示为wan,但是外面任然显示wan口未配置

这是不是ios webUI的bug?

快捷链接