{"id":876,"date":"2011-09-07T21:48:00","date_gmt":"2011-09-07T13:48:00","guid":{"rendered":"http:\/\/note.systw.net\/note\/?p=876"},"modified":"2023-11-07T21:53:25","modified_gmt":"2023-11-07T13:53:25","slug":"mitigating-spoofing-attacks","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/876","title":{"rendered":"Mitigating Spoofing Attacks"},"content":{"rendered":"\n<p>Mitigating Spoofing Attacks<br>dhcp snooping<br>ip source guard<br>DAI<\/p>\n\n\n\n<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;<\/p>\n\n\n\n<p><strong>DHCP snooping<\/strong><\/p>\n\n\n\n<p>When DHCP snooping is enabled,<br>1<br>switch ports are categorized as trusted or untrusted<br><strong>Legitimate DHCP<\/strong>&nbsp;servers can be found on&nbsp;<strong>trusted ports<\/strong><br>all&nbsp;<strong>other hosts<\/strong>&nbsp;sit behind&nbsp;<strong>untrusted ports<\/strong><br>2<br>A switch intercepts all&nbsp;<strong>DHCP requests<\/strong>&nbsp;coming from untrusted ports&nbsp;before flooding them throughout the VLAN .<br>3<br>Any<strong>&nbsp;DHCP replies(dhcp offer packet)<\/strong>&nbsp;coming from an&nbsp;<strong>untrusted port<\/strong>&nbsp;are discarded .\u3000because they must have come from a&nbsp;<strong>rogue DHCP server<\/strong><br>the offending switch port automatically is shut down in the Errdisable state<br>4<br>DHCP snooping database\u958b\u59cb\u904b\u4f5c<\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p>\u555f\u52d5DHCP snooping\u529f\u80fd<br><strong>Switch(config)# ip dhcp snooping<\/strong><\/p>\n\n\n\n<p>\u6307\u5b9aDHCP snooping\u8981\u904b\u4f5c\u7684vlan<br><strong>Switch(config)# ip dhcp snooping vlan &lt; vlan-id &gt;<\/strong><br>\u5404\u53c3\u6578\u8aaa\u660e\u5982\u4e0b<br>[ vlan &lt; vlan-id [vlan-id]&gt; ] \u53ea\u5728\u6307\u5b9avlan\u4e0b\u555f\u52d5dhcp snooping<\/p>\n\n\n\n<p>\u5728dhcp server\u7684\u6240\u5728port\u8a2d\u6210trust port<br><strong>Switch(config-if)# ip dhcp snooping trust<\/strong><br>By default, all switch ports are assumed to be untrusted<\/p>\n\n\n\n<p>[option]<br>to rate-limit DHCP traffic on an untrusted port<br><strong>Switch(config-if)# ip dhcp snooping limit rate &lt; rate &gt;<\/strong><br>rate \u6307\u5b9a\u6bcf\u79d2\u5e7e\u500bdhcp packet<\/p>\n\n\n\n<p>ex:<br>dhcp\u8a2d\u5b9a\u7bc4\u4f8b<br>Switch(config)# ip dhcp snooping vlan 104<br>Switch(config)# interface range fastethernet 0\/35 &#8211; 36<br>Switch(config-if)# ip dhcp snooping limit rate 3<br>Switch(config-if)# interface gigabitethernet 0\/1<br>Switch(config-if)# ip dhcp snooping trust<br>Switch(config)# ip dhcp snooping<\/p>\n\n\n\n<p><br>[option]<br>DHCP option-82<br><strong>Switch(config)# [no] ip dhcp snooping information option<\/strong><br>ps:<br>this feature is enabled by default<br>DHCP option-82, the DHCP Relay Agent Information option, which is described in RFC 3046<br>ps:<br>1. When a DHCP request is intercepted on an untrusted port<br>2. the switch adds its own MAC address and the switch port identifier into the option-82 field of the request.<br>3. The request then is forwarded normally so that it can reach a trusted DHCP server<\/p>\n\n\n\n<p>[option]<br>\u6307\u5b9aDHCP snooping binding database\u5132\u5b58\u65bc\u5916\u90e8\u4f4d\u7f6e<br><strong>Switch(config)# ip dhcp snooping database &lt; locate &gt;<\/strong><br>&lt; locate &gt; \u53ef\u6307\u5b9a\u5132\u5b58\u5728TFTP,FTP,HTTP server<br>ps:\u5916\u90e8\u4f4d\u7f6e\u4e0a\u9700\u5148\u7522\u751f\u4e00\u500b\u7a7a\u767d\u6a94<br>ps:switch\u548cserver\u9700\u505aNTP,\u4ee5\u907f\u514dswitch\u4e0a\u7684snooping database\u7121\u6cd5\u540c\u6b65\u5230server<br>ex:<br>Switch(config)# ip dhcp snooping database tftp:\/\/10.10.10.10\/database<br>Switch(config)# ip dhcp snooping database ftp:\/\/name:password@10.10.10.11\/database<\/p>\n\n\n\n<p>..<\/p>\n\n\n\n<p>display dhcp snooping status<br><strong>Switch# show ip dhcp snooping [binding]<\/strong><br>\u5404\u53c3\u6578\u8aaa\u660e\u5982\u4e0b<br>[binding] display all the known DHCP bindings that have been overheard<br>ps:<br># show ip dhcp snooping\u756b\u9762\u5927\u81f4\u5982\u4e0b<br>Switch DHCP snooping is enabled<br>DHCP snooping is configured on following VLANs:<br>104<br>Insertion of option 82 is enabled<br>Interface Trusted Rate limit (pps)<br>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8212;-<br>FastEthernet0\/35 no 3<br>FastEthernet0\/36 no 3<br>GigabitEthernet0\/1 yes unlimited<\/p>\n\n\n\n<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<\/p>\n\n\n\n<p><strong>ip source guard<\/strong><br>\u53ef\u4ee5\u907f\u514d\u5408\u6cd5\u4f7f\u7528\u7684IP\u88ab\u5176\u4ed6\u4eba\u76dc\u7528<br>IP Source Guard does this(\u6aa2\u8996\u6bd4\u5c0dip,interface,mac) by making use of the &#8220;DHCP snooping database&#8221; and &#8220;static IP source binding entries&#8221;<br>ps:<br>DHCP snooping\u662fvlan-based<br>IP source guard\u662fswitch ports-based<\/p>\n\n\n\n<p>\u6aa2\u6e2c\u689d\u4ef6<br>Packets arriving on a switch port(untrust interface) can be tested for one of the following conditions<br><strong>The source IP must be identical to the IP<\/strong><br>\u30001.learned by DHCP snooping or a static entry.<br>\u30002.A dynamic port ACL is used to filter traffic.<br>ps:The switch automatically creates this ACL, adds the learned source IP to the ACL, and applies the ACL to the interface where the address is learned.<br><strong>The source MAC must be identical to the MAC<\/strong><br>\u30001.learned on the switch port and by DHCP snooping.<br>\u30002.Port security is used to filter traffic<br>\u7570\u5e38\u52d5\u4f5c:<br>If the address is something other than the one learned or statically configured,<br>the switch drops the packet<\/p>\n\n\n\n<p><br>to configure IP source guard<br><strong>Switch(config)# ip dhcp snooping<br>Switch(config-if)# ip verify source [port-security]<\/strong><br>\u53ea\u6aa2\u67e5source IP\u548cport\u7684\u5c0d\u61c9<br>[port-security] \u5728\u591a\u6aa2\u67e5source MAC\u7684\u5c0d\u61c9<\/p>\n\n\n\n<p>statically configured IP source binding (mac-ip-interface binding)<br><strong>Switch(config)# ip source binding &lt; mac &gt; vlan &lt; vlan-id &gt; &lt; ip &gt; interface &lt; interface &gt;<\/strong><br>\u5728\u4e0d\u4f7f\u7528ip dhcp snooping\u60c5\u6cc1\u4e0b,\u53ef\u7528ip source binding\u975c\u614b\u6307\u5b9a<\/p>\n\n\n\n<p><br>To verify the IP source guard status<br><strong>Switch# show ip verify source [interface &lt; interface &gt;]<\/strong><\/p>\n\n\n\n<p>to verify the information contained in the IP source binding database, either learned or statically configured<br><strong>Switch# show ip source binding [ip] [mac] [dhcp-snooping | static] [interface &lt; interface&gt;] [vlan &lt; vlan-id&gt;]<\/strong><\/p>\n\n\n\n<p>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.<\/p>\n\n\n\n<p><strong>DAI(Dynamic ARP Inspection)<\/strong><br>to help mitigate ARP poisoning or ARP spoofing<br>DAI works much like DHCP snooping. All switch ports are classified as trusted or untrusted<br>The switch intercepts and inspects all ARP packets that arrive on an untrusted port(only ingress port)<br>DAI is supported on access ports, trunk ports, EtherChannel ports, private VLAN ports<br>ps:\u9810\u8a2d\u6bcf\u4e00\u500b\u4ecb\u9762\u662funtrust<\/p>\n\n\n\n<p><strong>When an ARP reply is received on an untrusted port,<\/strong><br>1. the switch checks the MAC and IP reported in the reply packet against known and trusted values<br>2. If an ARP reply contains invalid information or values that conflict with entries in the trusted database,&nbsp;it is dropped and a log message is generated<\/p>\n\n\n\n<p><strong>gather trusted ARP information from follows<\/strong><br>1.statically configured entries<br>2.dynamic entries in the DHCP snooping database (enable DHCP snooping)<\/p>\n\n\n\n<p><br><strong>enable DAI on all edge switch<\/strong><br>DAI should be configured on all access switch ports as untrusted and on all switch ports connected to other switches as trusted.<br>\u4e00\u4f46\u5176\u4ed6\u63a5\u5728trust port\u7684switch\u672a\u7528DAI,\u800c\u5728\u5e95\u4e0b\u767c\u52d5\u653b\u64ca,the local switch will not inspect ARP packets arriving on trusted ports;<\/p>\n\n\n\n<p><br>enable DAI<br>1<br><strong>Switch(config)# ip dhcp snooping<br>Switch(config)# ip arp inspection [vlan &lt; vlan-range&gt; ]<\/strong><br>[vlan &lt; vlan-range&gt; ] \u6307\u5b9aDAI\u8981\u5728\u90a3\u500bvlan\u4f5c\u7528<br>ps:\u591a\u500bvlan\u4ee5commas\u5206\u9694<br>2<br>Configure a trusted port<br><strong>Switch(config-if)# ip arp inspection trust<\/strong><br>\u901a\u5e38\u7528\u5728\u9023\u63a5\u5176\u4ed6switch\u7684\u4ecb\u9762<br>ps:<br>it will assume that the neighboring switch also is performing DAI on all of its ports in that VLAN<\/p>\n\n\n\n<p>statically configured entries<br>1<br>\u7121dhcp\u4e0b,\u975c\u614b\u6307\u5b9aip-mac binding list<br><strong>Switch(config)# arp access-list acl-name<br>Switch(config-acl)# permit ip host &lt; sender-ip&gt; mac host &lt; sender-mac&gt; [log]<\/strong><br>[Repeat the previous command as needed]<br>Switch(config-acl)# exit<br>2<br>\u5c07list\u5957\u7528\u5728DAI\u4e0a<br><strong>Switch(config)# ip arp inspection filter &lt; arp-acl-name &gt; vlan &lt; vlan-range&gt; [static]<\/strong><br>\u5404\u53c3\u6578\u8aaa\u660e\u5982\u4e0b<br>[static] \u82e5\u5728access-list\u6c92\u6bd4\u5c0d\u5230,\u76f4\u63a5\u8a8d\u5b9a\u70bainvalid<br>ps:<br>When ARP replies are intercepted, match order as follow<br>1 access list entries.<br>2 DHCP snooping bindings database<\/p>\n\n\n\n<p><br>\u6307\u5b9aDAI\u7684\u6aa2\u67e5\u7684\u9806\u5e8f<br><strong>Switch(config)# ip arp inspection validate &lt; src-mac | dst-mac | ip &gt;<\/strong><br>\u4ee5\u4e0b\u81f3\u5c11\u9700\u8a2d\u5b9a\u4e00\u500b<br>src-mac: \u6aa2\u67e5arp-reply\u7684src-mac<br>dst-mac: \u6aa2\u67e5arp-reply\u7684dst-mac<br>ip : \u6aa2\u67e5arp-request\u7684sender-ip,\u548c\u6240\u6709arp-reply\u7684\u76ee\u6a19ip<\/p>\n\n\n\n<p>\u6307\u5b9a\u6bcf\u79d2\u53ef\u63a5\u53d7\u7684arp packet<br><strong>Switch(config-if)# ip arp inspection limit rate 10<\/strong><br>\u7528\u4f86\u6291\u5236ARP DoS attack(\u9810\u8a2d\u70ba15pps),\u7576\u8d85\u904e\u6642\u6703\u9032\u5165error-disable\u72c0\u614b<\/p>\n\n\n\n<p>ps:<br>\u96e2\u958berror-disable\u72c0\u614b<br><strong>Switch(config)# no errdisable detect cause arp-inspection<\/strong><br>ps:<br>\u8a2d\u5b9aerror-diabled-recovery\u6642\u9593<br><strong>Switch(config-if)# errdisable recovery cause arp-inspection interval &lt; sec &gt;<\/strong><br>\u53ef\u8a2d\u5b9a\u5e7e\u79d2\u5f8c\u81ea\u52d5\u96e2\u958berror-disable\u72c0\u614b(\u9810\u8a2d\u70ba300\u79d2)<\/p>\n\n\n\n<p><br>display DAI status information<br><strong>Switch# show ip arp inspection<\/strong><\/p>\n\n\n\n<p><br>http:\/\/www.ringline.com.tw\/epaper\/forum961101.htm<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mitigating Spoofing Attacksdhc &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[31],"tags":[],"class_list":["post-876","post","type-post","status-publish","format-standard","hentry","category-cisco-security"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/876","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=876"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/876\/revisions"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=876"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=876"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=876"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}