更改 Cisco 路由器上的配置

网络工程 思科 cisco 命令
2021-07-19 08:46:47

有一个 Cisco 路由器是由另一个 IT 人员配置的,具有来自 ISP 的指定地址,现在的问题是 ISP 为我们提供了新的网络掩码和默认网关地址,所以我所做的是更改以下地址

旧的 ISP 地址 -

ip address: 10.131.61.246

net mask: 255.255.255.252

Default : 10.131.61.245

新的 ISP 地址 -

ip address: 10.131.61.246

net mask: 255.255.240.0

Default : 10.131.48.1

路由器上的旧配置


flow monitor MellaFMon

 record netflow ipv4 original-input

 exporter MellaFEX

 cache timeout active 5

!

ip source-route

ip cef

!

!

!

ip dhcp excluded-address 192.168.1.2 192.168.1.50

ip dhcp excluded-address 192.168.1.0 192.168.1.50

ip dhcp excluded-address 192.168.1.1 192.168.1.50

!

ip dhcp pool 101

 network 192.168.1.0 255.255.255.0

 default-router 192.168.1.1

 dns-server 192.168.1.4 8.8.8.8 4.2.2.2

!

ip dhcp pool WiFi

 network 192.168.10.0 255.255.255.0

 default-router 192.168.10.1

 dns-server 8.8.8.8 4.2.2.2

!

ip dhcp pool LAN

 network 192.168.40.0 255.255.255.0

 default-router 192.168.40.1

 dns-server 192.168.1.4 8.8.8.8 4.2.2.2

!

ip dhcp pool CC-Cam

 network 192.168.30.0 255.255.255.0

 default-router 192.168.30.1

 dns-server 8.8.8.8

!

!

!

interface Embedded-Service-Engine0/0

 no ip address

 shutdown

!

interface GigabitEthernet0/0

 no ip address

 ip flow ingress

 ip flow egress

 duplex auto

 speed auto

!

interface GigabitEthernet0/0.10

 description Wifi-Vlan-Int

 encapsulation dot1Q 10

 ip address 192.168.10.1 255.255.255.0

 ip flow monitor MellaFMon input

 ip flow monitor MellaFMon output

 ip nat inside

 ip virtual-reassembly in

!

interface GigabitEthernet0/0.20

 description Server-VLAN-In

 encapsulation dot1Q 1 native

 ip address 192.168.1.1 255.255.255.0

 ip flow monitor MellaFMon input

 ip flow monitor MellaFMon output

 ip nat inside

 ip virtual-reassembly in

!

interface GigabitEthernet0/0.30

 description CC-Camera-Int

 encapsulation dot1Q 30

 ip address 192.168.30.1 255.255.255.0

 ip flow monitor MellaFMon input

 ip flow monitor MellaFMon output

!

interface GigabitEthernet0/0.40

 description LAN-Int

 encapsulation dot1Q 40

 ip address 192.168.40.1 255.255.255.0

 ip flow monitor MellaFMon input

 ip flow monitor MellaFMon output

!

interface GigabitEthernet0/1

 ip address 197.156.90.82 255.255.255.248 secondary

 ip address 10.131.61.246 255.255.255.252

 ip flow monitor MellaFMon input

 ip flow monitor MellaFMon output

 ip flow ingress

 ip flow egress

 ip nat outside

 ip virtual-reassembly in

 duplex auto

 speed auto

!

ip forward-protocol nd

!

no ip http server

ip http authentication local

no ip http secure-server

!

ip nat pool Server 197.156.90.85 197.156.90.85 netmask 255.255.255.248

ip nat pool USER 197.156.90.83 197.156.90.83 netmask 255.255.255.248

ip nat pool server 197.156.90.85 197.156.90.85 netmask 255.255.255.248

ip nat pool CC-Cam 197.156.90.86 197.156.90.86 netmask 255.255.255.248

ip nat inside source list 10 pool USER overload

ip nat inside source static 192.168.1.4 197.156.90.84

ip nat inside source static 192.168.1.3 197.156.90.85

ip route 0.0.0.0 0.0.0.0 10.131.61.245

!

access-list 10 permit 192.168.10.0 0.0.0.255

access-list 10 permit 192.168.1.0 0.0.0.255

access-list 20 deny   192.168.1.1

access-list 20 deny   192.168.1.3

access-list 20 deny   192.168.1.4

access-list 20 permit 192.168.1.0 0.0.0.255

!

!

!

!

新配置完整

ip dhcp excluded-address 192.168.1.2 192.168.1.50
ip dhcp excluded-address 192.168.1.0 192.168.1.50
ip dhcp excluded-address 192.168.1.1 192.168.1.50
!
ip dhcp pool 101
 network 192.168.1.0 255.255.255.0
 default-router 192.168.1.1
 dns-server 192.168.1.4 8.8.8.8 4.2.2.2
!
ip dhcp pool WiFi
 network 192.168.10.0 255.255.255.0
 default-router 192.168.10.1
 dns-server 8.8.8.8 4.2.2.2
!
ip dhcp pool LAN
 network 192.168.40.0 255.255.255.0
 default-router 192.168.40.1
 dns-server 192.168.1.4 8.8.8.8 4.2.2.2
!
ip dhcp pool CC-Cam
 network 192.168.30.0 255.255.255.0
 default-router 192.168.30.1
 dns-server 8.8.8.8
!
!
!
!
!
interface Embedded-Service-Engine0/0
 no ip address
 shutdown
!
interface GigabitEthernet0/0
 no ip address
 ip flow ingress
 ip flow egress
 duplex auto
 speed auto
!
interface GigabitEthernet0/0.10
 description Wifi-Vlan-Int
 encapsulation dot1Q 10
 ip address 192.168.10.1 255.255.255.0
 ip flow monitor MellaFMon input
 ip flow monitor MellaFMon output
 ip nat inside
 ip virtual-reassembly in
!
interface GigabitEthernet0/0.20
 description Server-VLAN-In
 encapsulation dot1Q 1 native
 ip address 192.168.1.1 255.255.255.0
 ip flow monitor MellaFMon input
 ip flow monitor MellaFMon output
 ip nat inside
 ip virtual-reassembly in
!
interface GigabitEthernet0/0.30
 description CC-Camera-Int
 encapsulation dot1Q 30
 ip address 192.168.30.1 255.255.255.0
 ip flow monitor MellaFMon input
 ip flow monitor MellaFMon output
!
interface GigabitEthernet0/0.40
 description LAN-Int
 encapsulation dot1Q 40
 ip address 192.168.40.1 255.255.255.0
 ip flow monitor MellaFMon input
 ip flow monitor MellaFMon output
!
interface GigabitEthernet0/1
 ip address 197.156.90.82 255.255.255.248 secondary
 ip address 10.131.61.246 255.255.240.0
 ip flow monitor MellaFMon input
 ip flow monitor MellaFMon output
 ip flow ingress
 ip flow egress
 ip nat outside
 ip virtual-reassembly in
 duplex auto
 speed auto
!
ip forward-protocol nd
!
no ip http server
ip http authentication local
no ip http secure-server
!
ip nat pool Server 197.156.90.85 197.156.90.85 netmask 255.255.255.248
ip nat pool USER 197.156.90.83 197.156.90.83 netmask 255.255.255.248
ip nat pool server 197.156.90.85 197.156.90.85 netmask 255.255.255.248
ip nat pool CC-Cam 197.156.90.86 197.156.90.86 netmask 255.255.255.248
ip nat inside source list 10 pool USER overload
ip nat inside source static 192.168.1.4 197.156.90.84
ip nat inside source static 192.168.1.3 197.156.90.85
ip route 0.0.0.0 0.0.0.0 10.131.48.1
!
access-list 10 permit 192.168.10.0 0.0.0.255
access-list 10 permit 192.168.1.0 0.0.0.255
access-list 20 deny   192.168.1.1
access-list 20 deny   192.168.1.3
access-list 20 deny   192.168.1.4
access-list 20 permit 192.168.1.0 0.0.0.255
!
!
!
!

有什么我必须改变的配置吗?谢谢!

1个回答

您需要将您的 IP 路由更改为从您的 ISP 指定的默认网关:

IP route 0.0.0.0 0.0.0.0 10.131.48.1

除此之外,您的配置更改是正确的。