ARP收到request请求之后,杏彩平台出租(企 娥:217 1793 408)首先通过路由查询确定目的IP为一个本地地址类型(RTN_LOCAL)后,是否回复arp请求,还取决于两个判断:arp_ignore与arp_filter。可通过sysctl或者proc文件系统查看二者的值,如下所有配置值都为0:
$ sudo sysctl -a | grep -w arp_ignore
net.ipv4.conf.all.arp_ignore = 0
net.ipv4.conf.default.arp_ignore = 0
net.ipv4.conf.eth0.arp_ignore = 0
$
$ sysctl -a | grep -w arp_filter
net.ipv4.conf.all.arp_filter = 0
net.ipv4.conf.default.arp_filter = 0
net.ipv4.conf.eth0.arp_filter = 0
两者都为0,意味着dont_send为0,内核将回复任何目标IP为本机的arp请求。但是,当arp_ignore或者arp_filter任何一个返回true的时候,arp请求都不会被回复。
static int arp_process(struct net net, struct sock sk, struct sk_buff *skb)
{
if (arp->ar_op == htons(ARPOP_REQUEST) && ip_route_input_noref(skb, tip, sip, 0, dev) == 0)
if (addr_type == RTN_LOCAL) {
dont_send = arp_ignore(in_dev, sip, tip);
if (!dont_send && IN_DEV_ARPFILTER(in_dev))
dont_send = arp_filter(sip, tip, dev);
}
}
原文地址:http://blog.51cto.com/13888933/2150498