0

I am running CentOS with a 2.6.38 kernel. The Linux box has an IP of 10.0.0.10 assigned to eth0, which is the only network adapter on the box. I have created a program that fake an additional IP 10.0.0.20 for this box. My program will respond to ARP request for 10.0.0.20 with the MAC of eth0, so to other hosts in the LAN, 10.0.0.20 has the same MAC as 10.0.0.10, and all traffic destined for 10.0.0.20 will be routed to my Linux box and delivered to my program. My program will handle these IP packets and replies if needed.

So far my program is working good: it can receive IP packets with a destination address of 10.0.0.20, and other hosts can receive IP packets with a source address of 10.0.0.20 from my Linux box.

However, I noticed that sometime my Linux OS will send out some ICMP destination unreachable (host unreachable) messages to other hosts. These ICMP destination unreachable messages have a source address of 10.0.0.10, the real IP of my Linux box. I examined the ICMP messages, and it seems that my Linux OS tries to notify other hosts that 10.0.0.20 is unreachable. I think this makes sense because my program is faking 10.0.0.20 at user space, and the OS has no idea where 10.0.0.20 is.

Can someone suggest how to eliminate these destination-unreachable messages? They are undesirable in my application.

  • Would it be an option to assign 10.0.0.20 as second IP address to your eth0? – bidifx Jul 23 '15 at 7:17
  • You can try to use iptables to prevent those ICMP messages from getting out. I'm not certain if this works but it's worth the try. :) – bidifx Jul 23 '15 at 7:22
  • Yeah, can't you just add that as an additional IP? ip addr add 10.0.0.20/24 dev eth0 – slm Jul 23 '15 at 7:22
  • As to the iptables suggestion, they show how to block it via a FW: security.stackexchange.com/questions/3290/…. – slm Jul 23 '15 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.