ASA LAB-ASA NAT配置大全

ASA LAB-ASA NAT配置大全_第1张图片

两种NAT配置方式 :

1- Auto(object)NAT

2- Twice NAT

NAT分类 :

Static nat

Dynamic nat

Static PAT

Dynamic PAT

Nat exmption

今天抽空做了下八大类NAT的实验,这个文档比较常用,愿大家共同进步

实验:

先看下 ASA的基本配置和环境

clip_p_w_picpath002

ciscoasa# sh run

: Saved

:

ASA Version 8.4(2)

!

hostname ciscoasa

enable password 8Ry2YjIyt7RRXU24 encrypted

passwd 2KFQnbNIdI.2KYOU encrypted

names

!

interface GigabitEthernet0

shutdown

no nameif

no security-level

no ip address

!

interface GigabitEthernet1

description DMZ

nameif DMZ

security-level 50

ip address 192.168.1.2 255.255.255.0

!

interface GigabitEthernet2

nameif inside

security-level 100

ip address 10.1.20.1 255.255.255.0

!

interface GigabitEthernet3

nameif outside

security-level 0

ip address 10.1.30.1 255.255.255.0

!

ftp mode passive

pager lines 24

mtu DMZ 1500

mtu inside 1500

mtu outside 1500

no failover

icmp unreachable rate-limit 1 burst-size 1

no asdm history enable

arp timeout 14400

!

router eigrp 90

no auto-summary

network 0.0.0.0 0.0.0.0

redistribute static

!

route outside 0.0.0.0 0.0.0.0 10.1.30.3 1

timeout xlate 3:00:00

timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02

timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00

timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00

timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute

timeout tcp-proxy-reassembly 0:01:00

timeout floating-conn 0:00:00

dynamic-access-policy-record DfltAccessPolicy

user-identity default-domain LOCAL

no snmp-server location

no snmp-server contact

snmp-server enable traps snmp authentication linkup linkdown coldstart warmstart

telnet timeout 5

ssh timeout 5

console timeout 0

threat-detection basic-threat

threat-detection statistics access-list

no threat-detection statistics tcp-intercept

!

class-map inspection_default

match default-inspection-traffic

!

!

policy-map type inspect dns preset_dns_map

parameters

message-length maximum client auto

message-length maximum 512

policy-map global_policy

class inspection_default

inspect dns preset_dns_map

inspect ftp

inspect h323 h225

inspect h323 ras

inspect ip-options

inspect netbios

inspect rsh

inspect rtsp

inspect skinny

inspect esmtp

inspect sqlnet

inspect sunrpc

inspect tftp

inspect sip

inspect xdmcp

inspect icmp

!

service-policy global_policy global

prompt hostname context

no call-home reporting anonymous

call-home

profile CiscoTAC-1

no active

destination address http https://tools.cisco.com/its/service/oddce/services/DDCEService

destination address email [email protected]

destination transport-method http

subscribe-to-alert-group diagnostic

subscribe-to-alert-group environment

subscribe-to-alert-group inventory periodic monthly

subscribe-to-alert-group configuration periodic monthly

subscribe-to-alert-group telemetry periodic daily

crashinfo save disable

Cryptochecksum:239eb7333d302b09c0f2ec5ef970ebde

: end

实验拓扑:

ASA LAB-ASA NAT配置大全_第2张图片

1-Static NAT

需求 把 10.1.30.4 (公网地址)同 inside 的 2.2.2.2映射起来

ciscoasa# sh run access-list

access-list allowping extended permit icmp any any

access-list allowping extended permit 23 any any

ciscoasa# sh run access-group

access-group allowping in interface outside

object network staticnat

host 2.2.2.2

nat (inside,outside) static 10.1.30.4

2-Network static NAT

需求 R1的loopback 1.1.1.1 1.1.1.2 1.1.1.3 同 10.1.30.5-6(公网地址)映射起来

object network dmz-nat

nat (DMZ,outside) static outside-nat

object network outside-nat

range 10.1.30.5 10.1.30.6

object network dmz-nat

range 1.1.1.1 1.1.1.3

3-Static PAT

利用ASA的接口地址 端口给内部host的某一端口使用

比如我们把 10.1.30.1 23 端口跟 2.2.2.2 23端口映射起来

object network inside-nat

host 2.2.2.2

object network inside-nat

nat (inside,outside) static interface service tcp telnet telnet

clip_p_w_picpath006

4-Static NAT DNS Rewriter

目的是内网不需要通过外网再进inside找host

首先ASA 上要激活 DNS inspect

ASA LAB-ASA NAT配置大全_第3张图片

object network inside-nat

nat (inside,outside) static interface dns

5-Dynamic NAT

把多个内网地址映射出多个公网地址 (不常用)

object network INSIDE-SUBNET

subnet 172.20.10.0 255.255.255.0

nat (inside,outside) dynamic OUT-SUBNET

object network OUT-SUBNET

range 10.1.30.5 10.1.30.6

time xlate 0:30:00

6-Dyanmic PAT

动态PAT,把多个内网地址映射到一个公网地址的多个port (常用)

object network INSIDE-SUBNET

subnet 172.20.10.0 255.255.255.0

nat (inside,outside) dynamic interface

7-Static/Dyanmic Identiy NAT

转换本地地址到相同的地址(用的比较少)

ciscoasa(config)# object network test

ciscoasa(config-network-object)# host 222.222.222.222

ciscoasa(config-network-object)# nat (inside,outside) static test

clip_p_w_picpath010

8-Twice NAT

类似以前的policy NAT,能根据流量的源和目的实验不同的转换.

比如说当inside网络访问×××拨号172.16.1.0/24使用indentity nat技术自己转换到自己

Object nework inside-network

Subnet 10.1.1.0 255.255.255.0

Object network remote-***

Subnet 172.16.1.0 255.255.255.0

Nat (inside,outside) source static inside-network inside-network destination static remote-*** remote-***

Twice nat 只要搞清楚了转换前S/D和转换后S/D ,那么就不难写了.

参考链接:

https://www.packet6.com/configuring-nat-for-a-public-server-using-same-outside-interface/