1. 程式人生 > >ASA nat轉換詳解與擴展ACL詳解

ASA nat轉換詳解與擴展ACL詳解

前面是 nat 地址轉換後面是擴展acl

技術分享圖片

AR1區 telnet AR2 經過ASA1 轉換流量
配置如下:
ASA配置:
ASA Version 8.4(2)
!
hostname ciscoasa
enable password 8Ry2YjIyt7RRXU24 encrypted
passwd 2KFQnbNIdI.2KYOU encrypted
names
!
interface GigabitEthernet0
nameif inside
security-level 100
ip address 192.168.10.254 255.255.255.0
!
interface GigabitEthernet1
nameif outside
security-level 0

ip address 100.1.1.254 255.255.255.0
!
interface GigabitEthernet2
nameif dmz
security-level 50
ip address 192.168.30.254 255.255.255.0
!
interface GigabitEthernet3
shutdown
no nameif
no security-level
no ip address
!
interface GigabitEthernet4
shutdown
no nameif
no security-level
no ip address
!
interface GigabitEthernet5
shutdown
no nameif
no security-level
no ip address
!
ftp mode passive
object network natt
subnet 192.168.10.0 255.255.255.0

AR1配置:
R1#show running-config
Building configuration...

Current configuration : 1211 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption

!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
no ip icmp rate-limit unreachable
ip tcp synwait-time 5
!
!
ip cef
no ip domain lookup
!
interface Loopback0
ip address 10.10.1.1 255.255.255.0
!
interface Ethernet0/0
ip address 192.168.10.1 255.255.255.0
half-duplex
!
interface Ethernet0/1
no ip address
shutdown
half-duplex
!
interface Ethernet0/2
no ip address
shutdown
half-duplex
!
interface Ethernet0/3
no ip address
shutdown
half-duplex
!
interface Ethernet1/0
no ip address
shutdown
half-duplex
!
interface Ethernet1/1
no ip address
shutdown
half-duplex
!
interface Ethernet1/2
no ip address
shutdown
half-duplex
!
interface Ethernet1/3
no ip address
shutdown
half-duplex
!
no ip http server
no ip http secure-server
ip route 0.0.0.0 0.0.0.0 192.168.10.254

AR2配置:
R2#show running-config
Building configuration...

Current configuration : 1184 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
enable password 123
!
no aaa new-model
memory-size iomem 5
no ip icmp rate-limit unreachable
ip tcp synwait-time 5
!
ip cef
no ip domain lookup
!
interface Ethernet0/0
no ip address
shutdown
half-duplex
!
interface Ethernet0/1
ip address 100.1.1.1 255.255.255.0
half-duplex
!
interface Ethernet0/2
no ip address
shutdown
half-duplex
!
interface Ethernet0/3
no ip address
shutdown
half-duplex
!
interface Ethernet1/0
no ip address
shutdown
half-duplex
!
interface Ethernet1/1
no ip address
shutdown
half-duplex
!
interface Ethernet1/2
no ip address
shutdown
half-duplex
!
interface Ethernet1/3
no ip address
shutdown
half-duplex
!
no ip http server
no ip http secure-server
ip route 0.0.0.0 0.0.0.0 192.168.20.254

AR3配置:
R3#show running-config
Building configuration...

Current configuration : 939 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
enable password 123
!
no aaa new-model
memory-size iomem 5
no ip icmp rate-limit unreachable
ip tcp synwait-time 5
!
!
ip cef
no ip domain lookup
!
interface Ethernet0/0
no ip address
shutdown
half-duplex
!
interface Ethernet0/1
no ip address
shutdown
half-duplex
!
interface Ethernet0/2
ip address 192.168.30.1 255.255.255.0
half-duplex
!
interface Ethernet0/3
no ip address
shutdown
half-duplex
!
no ip http server
no ip http secure-server
ip route 0.0.0.0 0.0.0.0 192.168.30.254

擴展ACL詳解:

註:要拒絕不同流量的時候在目標IP後加 eq 後加 相對應的端口號

Cisco 擴展ACL寫法: 這個主機是源 端口號可以不寫 這個主機是目標端口號要寫
創建擴展acl(123) 拒絕tcp協議 主機 192.168.10.1 主機 192.168.30.1 ep 23

ciscoasa(config)# access-list 123 deny tcp host 192.168.10.1 host 192.168.30.1 eq 23
註:eq是對等的意思 後面加端口號 23

那麽這條擴展ACL只阻止源192.168.10.1 到192.168.30.1 tcp協議中的23 telnet 流量

   查看ASA版本

ciscoasa# show version

情況1:
在R1主動 遠程 telnet 訪問 R3 時 在ASA上的入向接口Inside 上有禁止R1 遠程telnet訪問R3的擴展ACL 所以所發送的數據沒有進去ASA 導致 R1 不能遠程telnet R3

情況2:
在R1主動 遠程 telnet 訪問 R3 時 在ASA上的出向接口DMZ 上有禁止R1 遠程telnet訪問R3的擴展ACL 所以所發送的數據沒有在ASA出去 同時在ASA上的conn表上也沒有形成條目 因為此數據被丟棄了 導致 R1 不能遠程telnet R3

情況3:
在R1主動 遠程 telnet 訪問 R3 時 在ASA上的出向接口DMZ上沒有禁止R1 遠程telnet訪問R3的擴展ACL 所以所發送的數據在ASA出去 同時在ASA上的conn表上形成條目 此數據轉發出去了 然而在回包的時候有不讓R3給R1回包的入向擴展ACL 數據到了DMZ接口 查看了 conn 表就無視了不讓R3給R1回包的擴展ACL 因為ASA默認為自己發出的流量就是安全的 並且數據包出去的時候在conn表上形成對應條目就是為了數據包能夠回來
所以數據流量可以回包

情況4:
在R1主動 遠程 telnet 訪問 R3 時 在ASA上的出向接口DMZ上沒有禁止R1 遠程telnet訪問R3的擴展ACL 所以所發送的數據在ASA出去 同時在ASA上的conn表上形成條目 此數據轉發出去了 然而在回包的時候有不讓R3給R1回包的出向擴展ACL 數據到了DMZ接口 查看了 conn 表就無視了不讓R3給R1回包的擴展ACL 因為ASA默認為自己發出的流量就是安全的 並且數據包出去的時候在conn表上形成對應條目就是為了數據包能夠回來
所以數據流量可以回包

ASA nat轉換詳解與擴展ACL詳解