-1

i have an embedded system with an Ethernet interface that needs to accept external packets with IP of 127.x.x.xx. is there a way to force Linux to accept external packets with this loop back address and to treat the packets as "normal" IP packets? also, is there a way to force Linux to send out ping packets when the interface has an IP of 127.x.x.x?

thank you in advance.

  • It is not clear what you mean with "accept" (accept on IP layer or accept for TCP/UDP connections). It might also be helpful to show the actual use case where you have this problem. – Steffen Ullrich Jan 5 '15 at 6:20
  • 1
    Your are probably barking up the wrong tree. Please clarify your use case. – Xavier Lucas Jan 5 '15 at 14:25
  • hi, sorry for not being clear. when external packet is an arp packe with source ip of 127.x.x.x, kernel drops the packet, not forwarding it up to tcp/ip stack. i traced arp.c inside kernel source and do see that kernel doesn't push the packet up the stack. i understand that this isn't a valid setup but it's an embeded system and my system is required to process all packets. wondering if there's a rule that can force kernel not to drop arp packets with ip of 127.x.x.x thank you.. – mark Jan 5 '15 at 21:04
  • 1
    @mark From RFC 1812 : * Internal host loopback address. Addresses of this form MUST NOT appear outside a host.* – Xavier Lucas Jan 5 '15 at 22:36
1

Linux has a weak host model and the network stack doesn't really care which interface an TCP/IP packet arrives on. If it is for a configured IP-address it will be accepted.

That does not take into account ARP, firewall rules and routing.

  • hi Hbrujin, i noticed that the kernel doesn't route arp packet with 127.x.x.x. kerel will discard packet. is there a rule that will make kernel route arp packet with ip of 127.x.x.x? thank you. – mark Jan 5 '15 at 21:00
1

From RFC 1812 :

(e) { 127, }

     Internal host loopback address.  Addresses of this form MUST
     NOT appear outside a host.

The kernel uses net.ipv4.conf.<interface>.route_localnet to make 127.0.0.0/8 routable or not (actually consider source/destination IP addresses of this kind as martian packets or not).

I completely disencourage you to to play with this, you MUST rethink your setup.

  • hi xavier, unforutnately, the packets that are coming into my interface is out of my control and i can not change the ip....these packets come from another embeded system...even though this is discoraged, if you have a solution, please let me know. thank you in advance. – mark Jan 6 '15 at 4:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.