利用CoPP(Control Plane Policing)阻擋Telnet遠端管理

「山不轉路轉,路不轉心轉」,這句話最適用於CCIE Lab考試上,準備CCIE Lab考試最令人頭痛的莫過於了解同一個問題所有的解法(所謂「只知其一,不知其二」是準備CCIE Lab最忌諱的事情)。

如果今天要求你不能利用Access-Class來防堵遠端Telnet管理時,你會想到那些方法? 最直覺的就是直接在所有interface上設定inbound ACL,不過這樣的方式比較麻煩,所以我今天來介紹如何利用CoPP(Control Plane Policing)來防止這類的連線管理。

所謂的CoPP(Control Plane Policing),主要是針對Cisco設備的Control Plane來進行網路連線封包的資料分析及避免Denial of Service所產生的一種保護機制。CoPP特色允許使用者設定QoS filter用來管理Control Plane封包的資料流用以保護Cisco IOS routers及switch的control plane,避免偵察行為及DoS攻擊。利用這種方式,不論在router或是switch有攻擊或是大量資料d的負載,control plane仍可以協助助維護封包轉送及協定狀態。

假設網路架構如下:
R1-R2-R3
我們要在R2上設定CoPP,只允許R1,R3的Loopback IP進行telnet遠端管理,禁止其他來源IP telnet至R2:

R2(config)#access-list 100 deny tcp host 1.1.1.1 any eq telnet
R2(config)#access-list 100 deny tcp host 3.3.3.3 any eq telnet
R2(config)#access-list 100 permit ip any any eq telnet

R2(config)#class-map TELNET
R2(config-cmap)#match access-group 100

R2(config)#policy-map CoPP
R2(config-pmap)#class TELNET
R2(config-pmap-c)#drop

R2(config)#control-plane
R2(config-cp)#service-policy input CoPP

Comments

Anonymous said…
我不明白这个policy-map的所定义的动作,
R2(config)#policy-map CoPP
R2(config-pmap)#class TELNET
R2(config-pmap-c)#drop
如果说允许r1和r3的loop0进行管理,那么对于match acl 100的class的动作为何是drop?
CCIE11440 said…
感谢您的反馈,我已经修正原有configuration
Anonymous said…
我觉得配置是不是应该是这样:
Router(config)# policy-map CoPP
Router(config-pmap)# class TELNET
Router(config-pmap-c)# police 64000 conform transmit exceed drop
Router(config-pmap-c)# exit


Router(config)# control-plane
Router(config-cp)# service-policy input CoPP
Router(config-cp)# exit

等待你的回复,呵呵,,
CCIE11440 said…
Hello, 因为这个case我当初忘了原有的题意,所以我第一次的回覆内容就如同您所述,利用police的方式限制telnet所使用的频宽。

後来我回头注意看了一下,原来我的题意是要禁止其他非特定来源IP进行telnet,所以,我又回覆了第二次。

现在的内容应该是没错的了,而您的回覆也没错,只要ACL的内容是permit特定对象限制所使用频宽的话。
Anonymous said…
另外,老兄,我想听听你对rate-limit "BC""BE"计算方法的想法,cisco给出的推荐算法是在MB的数量级使用的,如果需要我们控制的是在小于MB的数量级的时候,如何计算bc和be?
你是否有其他的联系方式?比如,msn 或者 gtalk?这样我们沟通起来比较方便。呵呵
CCIE11440 said…
不太了解你的意思,CIR, BC都是以Bytes为单位,并非MB

For example:

In this example, a customer is connected to an ISP by a T3 link. The ISP wants to rate-limit the customer's transmissions to 20 Mbps of the 45 Mbps. In addition, the customer is allowed to transmit bursts of 24000 bytes. All exceeding packets dropped. The following commands are configured on the ISP's HSSI interface connected to the customer:

interface Hssi0/0/0
description 45Mbps to R1
rate-limit input 20000000 24000 24000 conform-action transmit exceed-action drop
ip address 200.200.14.250 255.255.255.252
rate-limit output 20000000 24000 24000 conform-action transmit exceed-action drop
CCIE11440 said…
如果想了解计算方法,请参考这一篇文章:
CIR=Bc/Tc
http://ccie11440.blogspot.com/2008/08/cirbctc.html

Popular posts from this blog

L2TPv3 Enables Layer 2 Services for IP Networks

TCP/IP 明確擁塞通知 (ECN)

Q-in-Q(Dot1Q Tunnel) Sample Configuration