vlan 之间的路由不起作用

网络工程 路由 路由器 VLAN 纳特 思科-ios
2021-07-22 21:30:51

我需要将 Cisco 路由器放在 ISP 路由器后面。(ISP 不允许我们只使用他们的调制解调器。)

我打电话给 ISP 技术服务,他们已经与我建立了连接。他们的路由器将用作 Cisco 路由器的网关。我为 vlan20 配置了正确的 IP 地址并将其链接到 Ge0,Ge0 连接到 ISP 路由器。我可以从那个 VLAN ping 互联网。

我还为内部网络创建了vlan10,它将连接到Ge1。从那个 vlan,我无法 ping 互联网。

我试图配置最后的网关,但没有奏效。

以下是设置/配置的概述: 在此处输入图片说明

interface GigabitEthernet0
 switchport access vlan 20
 no ip address

interface GigabitEthernet1
 switchport access vlan 10
 no ip address

interface Vlan10
 ip address 192.9.200.253 255.255.255.0
 ip nat inside
 ip virtual-reassembly in
 ip tcp adjust-mss 1412

interface Vlan20
 ip address 81.246.66.67 255.255.255.

ip route 0.0.0.0 0.0.0.0 81.246.66.66

我认为它可以与到 ISP 路由器的路由一起使用,但它似乎不起作用: 在此处输入图片说明 有人可以为我提供一些帮助吗?

编辑:按要求进行完整配置:仅隐藏了一些密码并更改了公共 IP。

R1#show run
Building configuration...

Current configuration : 11179 bytes
!
! Last configuration change at 19:24:21 GMT Thu Jul 12 2018
! NVRAM config last updated at 19:39:43 GMT Thu Jul 12 2018
! NVRAM config last updated at 19:39:43 GMT Thu Jul 12 2018
version 15.3
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
aqm-register-fnf
!
logging buffered 51200 warnings
enable secret 5 --hash hidden--.
!
no aaa new-model
wan mode ethernet
clock timezone GMT 1 0
!
!
!
ip dhcp excluded-address 10.10.10.1
ip dhcp excluded-address 192.9.200.253
ip dhcp excluded-address 192.9.200.0 192.9.200.130
ip dhcp excluded-address 192.9.200.169 192.9.200.210
ip dhcp excluded-address 192.9.200.250 192.9.200.255
!
ip dhcp pool ccp-pool
 import all
 network 10.10.10.0 255.255.255.128
 default-router 10.10.10.1
 dns-server 8.8.8.8 195.238.2.21
 lease 0 2
!
ip dhcp pool companyname_dhcp_pool
 import all
 network 192.9.200.0 255.255.255.0
 default-router 192.9.200.253
 dns-server 192.9.200.253
 domain-name dw
 lease 0 2
!
!
!
ip domain name companyname.be
ip host kassa1.companyname.be 192.9.200.40
ip host kassa2.companyname.be 192.9.200.41
ip host www.companyname.be. 81.246.66.67
ip host bkhserv.companyname.be. 192.9.200.3
ip host pcroland.companyname.be. 192.9.200.4
ip host pckarel.companyname.be. 192.9.200.6
ip host achtertoog.companyname.be. 192.9.200.9
ip host verkopersbalie2.companyname.be. 192.9.200.11
ip host voortoog1.companyname.be. 192.9.200.12
ip host voortoog2.companyname.be. 192.9.200.13
ip host geertje.companyname.be. 192.9.200.14
ip host verkopersbalie.companyname.be. 192.9.200.15
ip host hobbytoog.companyname.be. 192.9.200.17
ip host houtenvloer.companyname.be. 192.9.200.25
ip host pinnerij.companyname.be. 192.9.200.26
ip host annmarina.companyname.be. 192.9.200.27
ip host pp1.companyname.be. 192.9.200.28
ip host ppuitsnij.companyname.be. 192.9.200.29
ip host pcglas.companyname.be. 192.9.200.32
ip host pczagerij.companyname.be. 192.9.200.36
ip host kassa1.companyname.be. 192.9.200.40
ip host kassa2.companyname.be. 192.9.200.41
ip host kassa3.companyname.be. 192.9.200.42
ip host kassa4.companyname.be. 192.9.200.43
ip host metapacekassa1.companyname.be. 192.9.200.50
ip host metapacekassa2.companyname.be. 192.9.200.51
ip host metapacekassa3.companyname.be. 192.9.200.52
ip host bijdoen.companyname.be. 192.9.200.57
ip host wim.companyname.be. 192.9.200.61
ip host erwin.companyname.be. 192.9.200.62
ip host christiane.companyname.be. 192.9.200.63
ip host anna.companyname.be. 192.9.200.64
ip host afplak.companyname.be. 192.9.200.65
ip host christine.companyname.be. 192.9.200.66
ip host alu.companyname.be. 192.9.200.67
ip host peter.companyname.be. 192.9.200.68
ip host herman.companyname.be. 192.9.200.69
ip host iomegaix2.companyname.be. 192.9.200.85
ip host pcguy.companyname.be. 192.9.200.87
ip host pc-jan.companyname.be. 192.9.200.88
ip host mailserver.companyname.be. 192.9.200.90
ip host pcjan.companyname.be. 192.9.200.91
ip host TerminalServer.companyname.be. 192.9.200.94
ip host scovmwar.companyname.be. 192.9.200.95
ip host scovm2.companyname.be. 192.9.200.96
ip host linksyswap54g.companyname.be. 192.9.200.98
ip host supmicro.companyname.be. 192.9.200.100
ip host hpnet.companyname.be. 192.9.200.96
ip host faxverkoop.companyname.be. 192.9.200.101
ip host faxjan.companyname.be. 192.9.200.102
ip host hpc6180.companyname.be. 192.9.200.103
ip host hpclj4600.companyname.be. 192.9.200.104
ip host hp4000.companyname.be. 192.9.200.106
ip host hp4achttoog.companyname.be. 192.9.200.107
ip host hp4voortoog.companyname.be. 192.9.200.108
ip host hp4chret.companyname.be. 192.9.200.109
ip host hp4karel.companyname.be. 192.9.200.110
ip host hp4verkoop.companyname.be. 192.9.200.111
ip host hp4kassa3.companyname.be. 192.9.200.112
ip host hp4posters.companyname.be. 192.9.200.113
ip host hp4prod1.companyname.be. 192.9.200.114
ip host hp4prod2.companyname.be. 192.9.200.115
ip host hp4repros.companyname.be. 192.9.200.116
ip host hp4kassa1.companyname.be. 192.9.200.117
ip host hp4aankoop.companyname.be. 192.9.200.120
ip host hp4klaarpak.companyname.be. 192.9.200.121
ip host hp4kassa2.companyname.be. 192.9.200.122
ip host hp4infopapier.companyname.be. 192.9.200.124
ip host hp4infoverf.companyname.be. 192.9.200.125
ip host bkhservdw.companyname.be. 192.9.200.170
ip host dell.companyname.be. 192.9.200.170
ip host companynamets.companyname.be. 192.9.200.200
ip host firewall.companyname.be. 192.9.200.253
ip host houtenvloer2.companyname.be. 192.9.200.24
ip host wegzet.companyname.be. 192.9.200.49
ip host linksyswap54g2.companyname.be. 192.9.200.97
ip host telcentrale1.companyname.be. 192.9.200.75
ip host telcentrale2.companyname.be. 192.9.200.76
ip host zebra01.companyname.be. 192.9.200.118
ip host esxtest.companyname.be. 192.9.200.167
ip host xenserver.companyname.be. 192.9.200.174
ip host odooserver-xen.companyname.be. 192.9.200.168
ip name-server 8.8.8.8
ip name-server 195.238.2.21
ip name-server 4.4.4.4
ip name-server 195.238.2.22
ip cef
no ipv6 cef
!
!
!
flow record nbar-appmon
 match ipv4 source address
 match ipv4 destination address
 match application name
 collect interface output
 collect counter bytes
 collect counter packets
 collect timestamp absolute first
 collect timestamp absolute last
!
!
flow monitor application-mon
 cache timeout active 60
 record nbar-appmon
!
!
!
!
!
!
!
!
!
!
object-group network local_lan_subnets
 10.10.10.0 255.255.255.128
 192.9.200.0 255.255.255.0
!
username companyname privilege 15 secret 5 --hash hidden--
!
!
controller VDSL 0
 shutdown
!
zone security LAN
zone security WAN
zone security VPN
zone security DMZ
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface ATM0
 no ip address
 shutdown
 no atm ilmi-keepalive
!
interface Ethernet0
 no ip address
 shutdown
!
interface FastEthernet0
 no ip address
!
interface FastEthernet1
 no ip address
!
interface FastEthernet2
 no ip address
!
interface GigabitEthernet0
 switchport access vlan 20
 no ip address
!
interface GigabitEthernet1
 switchport access vlan 10
 no ip address
!
interface GigabitEthernet2
 no ip address
 duplex auto
 speed auto
!
interface Wlan-GigabitEthernet0
 description Internal switch interface connecting to the embedded AP
 no ip address
!
interface Vlan1
 description $ETH_LAN$
 ip address 10.10.10.1 255.255.255.128
 ip nat inside
 ip virtual-reassembly in
 ip tcp adjust-mss 1412
!
interface Vlan10
 ip address 192.9.200.253 255.255.255.0
 ip nat inside
 ip virtual-reassembly in
 ip tcp adjust-mss 1412
!
interface Vlan20
 ip address 81.246.66.67 255.255.255.248
!
ip forward-protocol nd
ip http server
ip http access-class 23
ip http authentication local
ip http secure-server
ip http timeout-policy idle 60 life 86400 requests 10000
!
!
ip dns server
ip nat inside source list nat-list interface GigabitEthernet2 overload
ip nat inside source static tcp 192.9.200.90 25 81.246.66.67 25 extendable
ip nat inside source static tcp 192.9.200.175 80 81.246.66.67 80 extendable
ip nat inside source static tcp 192.9.200.90 110 81.246.66.67 110 extendable
ip nat inside source static tcp 192.9.200.90 143 81.246.66.67 143 extendable
ip nat inside source static udp 192.9.200.90 143 81.246.66.67 143 extendable
ip nat inside source static tcp 192.9.200.90 25 81.246.66.67 587 extendable
ip nat inside source static tcp 192.9.200.94 6666 81.246.66.67 3389 extendable
ip nat inside source static tcp 192.9.200.90 80 81.246.66.68 80 extendable
ip route 0.0.0.0 0.0.0.0 GigabitEthernet2
ip route 0.0.0.0 0.0.0.0 81.246.66.66
!
dialer-list 1 protocol ip permit
!
access-list 23 permit 10.10.10.0 0.0.0.127
access-list 23 permit 192.9.200.0 0.0.0.255
!
banner exec ^C
% Password expiration warning.
-----------------------------------------------------------------------

Cisco Configuration Professional (Cisco CP) is installed on this device
and it provides the default username "cisco" for  one-time use. If you have
already used the username "cisco" to login to the router and your IOS image
supports the "one-time" user option, then this username has already expired.
You will not be able to login to the router with this username after you exit
this session.

It is strongly suggested that you create a new username with a privilege level
of 15 using the following command.

username <myuser> privilege 15 secret 0 <mypassword>

Replace <myuser> and <mypassword> with the username and password you
want to use.

-----------------------------------------------------------------------
^C
banner login ^C
-----------------------------------------------------------------------
Cisco Configuration Professional (Cisco CP) is installed on this device.
This feature requires the one-time use of the username "cisco" with the
password "cisco". These default credentials have a privilege level of 15.

YOU MUST USE CISCO CP or the CISCO IOS CLI TO CHANGE THESE
PUBLICLY-KNOWN CREDENTIALS

Here are the Cisco IOS commands.

username <myuser>  privilege 15 secret 0 <mypassword>
no username cisco

Replace <myuser> and <mypassword> with the username and password you want
to use.

IF YOU DO NOT CHANGE THE PUBLICLY-KNOWN CREDENTIALS, YOU WILL
NOT BE ABLE TO LOG INTO THE DEVICE AGAIN AFTER YOU HAVE LOGGED OFF.

For more information about Cisco CP please follow the instructions in the
QUICK START GUIDE for your router or go to http://www.cisco.com/go/ciscocp
-----------------------------------------------------------------------
^C
!
line con 0
 password -- PW hidden --
 login
 no modem enable
line aux 0
line 2
 no activation-character
 no exec
 transport preferred none
 transport input all
 stopbits 1
line vty 0 4
 access-class 23 in
 privilege level 15
 password -- PW hidden --
 login local
 transport input ssh
!
scheduler allocate 60000 1000
ntp master
ntp server europe.pool.ntp.org
!
end

更新:它现在可以工作了,错误确实是 NAT 配置错误。 这是我所做的额外配置:

ip nat inside source list nat-list interface Vlan20 overload
ip nat inside source static tcp 192.9.200.90 25 81.246.66.67 25 extendable
ip nat inside source static tcp 192.9.200.175 80 81.246.66.67 80 extendable
ip nat inside source static tcp 192.9.200.90 110 81.246.66.67 110 extendable
ip nat inside source static tcp 192.9.200.90 81.246.66.67 143 extendable
ip nat inside source static udp 192.9.200.90 81.246.66.67 143 extendable
ip nat inside source static tcp 192.9.200.90 25 81.246.66.67 587 extendable
ip nat inside source static tcp 192.9.200.94 6666 81.246.66.67 3389 extendable
ip nat inside source static tcp 192.9.200.90 80 81.246.66.68 80 extendable
ip route 0.0.0.0 0.0.0.0 81.246.66.66
!
ip access-list extended nat-list
 deny   ip 192.9.200.0 0.0.0.255 host 192.9.200.90
 deny   ip 192.9.200.0 0.0.0.255 host 192.9.200.175
 deny   ip 192.9.200.0 0.0.0.255 host 192.9.200.94
 permit tcp any any
 permit udp any any
 permit icmp any any
3个回答

您没有启用 NAT(您ip nat outside在 Vl 20 上没有启用)。

如果没有 NAT,ISP 不知道如何路由回您的 192.9.200.0 网络。如果您 NAT 到 VLan 20 地址,ISP 将能够路由回您。

问题是您尚未定义告诉路由器要转换哪些地址的 ACL。

你有:

ip nat inside source list nat-list interface GigabitEthernet2 overload

但你没有nat-list配置。你需要这样的东西:

access-list nat-list permit 10.10.10.0 0.0.0.127
access-list nat-list permit 192.9.200.0 0.0.0.255

-或者-

使用您为 NAT 定义的 ACL (23):

ip nat inside source list 23 interface GigabitEthernet2 overload

-和-

正如 Ron Trunk 指出的那样,将ip nat outside命令放在 WAN 接口上。

您的要求很简单,但您的配置缺少 NAT 过载规则。用于将私有 ip 地址转换为公共 ip 地址,所有 Internet 出站流量都将使用此 NAT 转换配置

Router(config)# access-list 10 permit ip 192.9.200.0 255.25&.255.0 Any Router(config) # ip nat inside source list 10 interface Ge0 0verlaod

进一步简化,避免创建 vlan 10 和 vlan 20

Router(config) int Ge0 Router(config) # ip address 81.246.66.67 255.255.255 Router(config) # ip nat outside Router(config)# no shutdown

Router(config) # int Ge1 Router(config)# ip address 192.9.200.253 255.255.255.0 Router(config)# ip nat inside Router(config)no shutdown

Router(config) # ip route 0.0.0.0 0.0.0.0 81.246.66.66

**NAT 超载规则,用于内部到外部出站流量的 nat 转换 **。

Router(config)# access-list 10 permit ip 192.9.200.0 255.25&.255.0 Any

Router(config) # ip nat inside source list 10 interface Ge0 0verlaod