最简单的防止欺骗的方法就是对所有的互联网通信使用一个进入过滤器。进入过滤器会丢弃源地址为以上所列地址的任何数据包。换句话说,就是创建一个ACL(access control list),使之丢弃所有进入的网络的源地址为上述列表中IP地址的数据包。
下面是一个配置的例子:
Router# conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)# ip access-list ext ingress-antispoof
Router(config-ext-nacl)# deny ip 10.0.0.0 0.255.255.255 any
Router(config-ext-nacl)# deny ip 172.16.0.0 0.15.255.255 any
Router(config-ext-nacl)# deny ip 192.168.0.0 0.0.255.255 any
Router(config-ext-nacl)# deny ip 127.0.0.0 0.255.255.255 any
Router(config-ext-nacl)# deny ip 224.0.0.0 31.255.255.255 any
Router(config-ext-nacl)# deny ip 169.254.0.0 0.0.255.255 any
Router(config-ext-nacl)# permit ip any any
Router(config-ext-nacl)# exit
Router(config)#int s0/0
Router(config-if)#ip access-group ingress-antispoof in
互联网服务供应商(ISP)必须在其网络中使用这样的过滤,这一点是在RFC 2267中定义的。注意此ACL操作中包含“permit ip any any”。在现实世界中,你可能会在路由器中有一个正式的防火墙,用以保护内部LAN。