Cisco IOS TCP intercept intercept modeの設定

スポンサーリンク

TCP interceptはTCPを覗き見し、syn floodを回避する手段のひとつです。watch modeとintercept modeが存在しますが、代理応答する事で内部を保護するintercept modeについて紹介します。

コマンド一覧

このシナリオで重要なコマンド一覧は以下の通りです。

Router(config)# ip tcp intercept list <ext_acl>
Router(config)# ip tcp intercept mode [ intercept | watch ]

Router(config)# ip tcp intercept max-incomplete low <num>
Router(config)# ip tcp intercept max-incomplete high <num>
Router(config)# ip tcp intercept one-minute low <num>
Router(config)# ip tcp intercept one-minute high <num>
Router(config)# ip tcp intercept drop-mode [ oldest | random ]

 [watch mode 限定]
Router(config)# ip tcp intercept watch-timeout <sec>

 [intercept mode 限定]
Router(config)# ip tcp intercept finrst-timeout <sec>
Router(config)# ip tcp intercept connection-timeout <sec>

構成図

以下の構成で動作確認を行います。

         e0/0    e0/1      e0/0    e0/1
 +--------+.1    .2+--------+.2  dhcp+--------+
 |   R1   +--------+   R2   +--------+   R3  | 
 +--------+        +--------+        +--------+
        192.168.12.0/24   192.168.23.0/24
   Inside           Firewall           Outside

 R1 Loopback0     R2 Loopback0     R3 Loopback0
 10.1.1.1/32      10.2.2.2/32      10.3.3.3/32
 [R1]
router rip
 version 2
 network 10.0.0.0
 network 192.168.12.0
 no auto-summary

 [R2]
router rip
 version 2
 network 10.0.0.0
 network 192.168.12.0
 network 192.168.23.0
 no auto-summary

 [R3]
router rip
 version 2
 network 10.0.0.0
 network 192.168.23.0
 no auto-summary

設定全文は下記ファイルです。詳細設定は下記を参照ください。

R1
!
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
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 10.1.1.1 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.12.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
!
!
router rip
 version 2
 network 10.0.0.0
 network 192.168.12.0
 no auto-summary
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R2
!
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
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 10.2.2.2 255.255.255.255
!
interface Ethernet0/0
 ip address 192.168.23.2 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip address 192.168.12.2 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router rip
 version 2
 network 10.0.0.0
 network 192.168.12.0
 network 192.168.23.0
 no auto-summary
!
ip http server
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
R3
!
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 cisco
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 10.3.3.3 255.255.255.255
!
interface Ethernet0/0
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/1
 ip address 192.168.23.3 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router rip
 version 2
 network 10.0.0.0
 network 192.168.23.0
 no auto-summary
!
ip http server
ip http path flash:
ip forward-protocol nd
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end

仕様説明

基本設定

watch modeと同じ設定については、説明を省略します。

connection-timeout

以下のコマンドでidle状態のコネクションを管理する時間を設定する事ができます。デフォルトでは24時間コネクションを管理します。

Router(config)# ip tcp intercept connection-timeout <sec>

finwait-time

finまたはrstによってコネクションが閉じられてからのコネクション管理時間を定義する事ができます。

Router(config)# finrst-timeout <sec>

connection-timeout

設定投入1

R2にtcp interceptの設定を投入します。

 [R2]
ip access-list extended ACL_TCP_INTERCEPT
 10 permit tcp any host 10.3.3.3 eq www
!
ip tcp intercept list ACL_TCP_INTERCEPT

R2にsynが付与さていないTCPを拒否する事で、idle connectionを再現させます。

 [R2]
ip access-list extended ACL_DENY_ANY
 10 permit tcp any any syn
 99 deny ip any any
!
interface Ethernet0/0
 ip access-group ACL_PERMIT_SYN out

デフォルトの動作確認

R1からR3へのhttp通信を発生させます。

R1#copy http://cisco:cisco@10.3.3.3/running-config null:
%Error opening http://cisco:cisco@10.3.3.3/running-config (I/O error)
R1#

デフォルトでは24時間通信を管理しようとしている事が分かります。

 [R2]
R2#debug ip tcp intercept
TCP intercept debugging is on
R2#
R2#
*Mar  1 00:29:53.995: INTERCEPT: new connection (192.168.12.1:47838 SYN -> 10.3.3.3:80)
*Mar  1 00:29:54.003: INTERCEPT(*): (192.168.12.1:47838 <- ACK+SYN 10.3.3.3:80)
*Mar  1 00:29:54.083: INTERCEPT: 1st half of connection is established (192.168.12.1:47838 ACK -> 10.3.3.3:80)
*Mar  1 00:29:54.087: INTERCEPT(*): (192.168.12.1:47838 SYN -> 10.3.3.3:80)
*Mar  1 00:29:54.135: INTERCEPT: 2nd half of connection established  (192.168.12.1:47838 <- ACK+SYN 10.3.3.3:80)
*Mar  1 00:29:54.139: INTERCEPT(*): (192.168.12.1:47838 ACK -> 10.3.3.3:80)
*Mar  1 00:29:54.143: INTERCEPT(*): (192.168.12.1:47838 <- WINDOW 10.3.3.3:80)
R2#
R2#
R2#show tcp intercept connections
Incomplete:
Client                Server                State    Create   Timeout  Mode

Established:
Client                Server                State    Create   Timeout  Mode
192.168.12.1:47838    10.3.3.3:80           ESTAB    00:00:11 23:59:59 I
192.168.12.1:15907    10.3.3.3:80           ESTAB    00:09:43 23:57:04 I
R2#

設定投入2

connection-timeoutを60秒に変更します。

 [R2]
ip tcp intercept connection-timeout 60

動作確認

R1からR3へのhttp通信を発生させます。

R1#copy http://cisco:cisco@10.3.3.3/running-config null:
%Error opening http://cisco:cisco@10.3.3.3/running-config (I/O error)
R1#

connectionを管理する時間が60秒未満になっている事を確認します。

 [R2]
R2#show tcp intercept connections
Incomplete:
Client                Server                State    Create   Timeout  Mode

Established:
Client                Server                State    Create   Timeout  Mode
192.168.12.1:18300    10.3.3.3:80           ESTAB    00:00:32 00:00:53 I
192.168.12.1:47838    10.3.3.3:80           ESTAB    00:07:09 00:00:38 I
192.168.12.1:15907    10.3.3.3:80           ESTAB    00:16:41 23:50:06 I
R2#

finrst-timeout

設定投入

finを観測してからコネクションを管理し続ける時間を20秒に変更します。また、先程のidle-connectionを再現させるためのACLを削除します。

 [R2]
ip tcp intercept finrst-timeout 20
!
interface Ethernet0/1
 no ip access-group ACL_PERMIT_SYN out

動作確認

R1からR3へのhttp通信を発生させます。

 [R1]
R1#copy http://cisco:cisco@10.3.3.3/running-config null:
Loading http://***********@10.3.3.3/running-config !
940 bytes copied in 0.716 secs (1313 bytes/sec)
R1#

デバッグメッセージから、finrst-timeoutで設定した20秒間コネクションを管理しようとしている事が確認できます。

 [R2]
R2#
*Mar  1 00:46:03.135: INTERCEPT: new connection (192.168.12.1:31479 SYN -> 10.3.3.3:80)
*Mar  1 00:46:03.143: INTERCEPT(*): (192.168.12.1:31479 <- ACK+SYN 10.3.3.3:80)
*Mar  1 00:46:03.203: INTERCEPT: 1st half of connection is established (192.168.12.1:31479 ACK -> 10.3.3.3:80)
*Mar  1 00:46:03.207: INTERCEPT(*): (192.168.12.1:31479 SYN -> 10.3.3.3:80)
*Mar  1 00:46:03.259: INTERCEPT: 2nd half of connection established  (192.168.12.1:31479 <- ACK+SYN 10.3.3.3:80)
*Mar  1 00:46:03.263: INTERCEPT(*): (192.168.12.1:31479 ACK -> 10.3.3.3:80)
*Mar  1 00:46:03.267: INTERCEPT(*): (192.168.12.1:31479 <- WINDOW 10.3.3.3:80)
*Mar  1 00:46:23.735: INTERCEPT: ESTAB timing out (192.168.12.1:31479 <-> 10.3.3.3:80)
R2#
タイトルとURLをコピーしました