无法从交换机 ping 互联网

网络工程 思科 转变 路由器 联网
2022-02-10 13:55:27

路由器互联网接口 Fastethernet0/0 192.168.0.17 (ip nat outside)

内部接口 192.168.1.1 (ip nat inside)

能够从路由器 ping 8.8.8.8

Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.0.17    YES DHCP   up                    up
FastEthernet0/1            192.168.1.1     YES NVRAM  up                    up
NVI0                       unassigned      NO  unset  up                    up

路由器配置:

interface FastEthernet0/0
ip address dhcp
ip nat outside
ip virtual-reassembly
no ip route-cache
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.1.1 255.255.255.0
ip nat inside
ip virtual-reassembly
no ip route-cache
duplex auto
speed auto


ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
ip nat inside source list 1 interface FastEthernet0/0 overload
access-list 1 permit 192.168.1.0 0.0.0.255

从交换机能够 ping 两个路由器接口但不能 8.8.8.8

在交换机上设置默认网关

ip default-gateway 192.168.1.1

两者都是思科

切换配置:

service timestamps debug uptime
service timestamps log uptime
service password-encryption
!
hostname nemanja_SW1_35550
!
enable secret 5 $1$vc35$d7PthbPyFSMsiQlnQTMIU0
enable password 7 1218011A1B05
!
no aaa new-model
clock timezone CST 1
ip subnet-zero
no ip domain-lookup
!
!
!
!
!
!
spanning-tree mode pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
!
!
interface FastEthernet0/1
 switchport mode dynamic desirable
!
interface FastEthernet0/2
 switchport mode dynamic desirable
!
interface FastEthernet0/3
 switchport mode dynamic desirable
interface Vlan1
 ip address 192.168.1.3 255.255.255.0
 no ip route-cache
!
ip default-gateway 192.168.1.1
2个回答

找到解决方案,必须将默认路由更改为

ip route 0.0.0.0 0.0.0.0 192.168.0.1

192.168.0.1 是 ISP 提供商路由器

我认为你需要一个扩展访问列表 ip access-list 100 permit ip 192.168.1.0 0.0.0.25 any 将你的 nat 语句更改为

ip nat inside source list 100 接口 FastEthernet0/0 过载