Can we send packet from one interface to another that are on the same machine?
I am trying to make loopback driver for linux 2.4.20. For this I made two network interfaces that are logical and not bound to any hardware. They both have to run on the same machine.
And what I am doing in each driver is : when a packet comes on one interface change the destination address to that of the other network interface IP address. I am giving more details on this:
applications : udp_client udp_server
two interfaces : mydev0 mydev1
IP addr : 22.214.171.124 126.96.36.199
A packet from udp_client is send with "destination address": 188.8.131.52
This packet automatically goes to mydev0 so "Source address": 184.108.40.206
Now when this packet is recvd at mydev0 it change the "Dest Address":220.127.116.11
"Source Addr" :18.104.22.168
This way the packet reaches from udp_cli to udp_srv.
Packet from udp_srv to udp_cli is also changed and send as defined above.Up till now everything is clear....
Problem: When I change the source IP address to one of the IP addresses assigned to network interfaces the packet is dropped and does not reach to the other end.
But when I assign packet any arbitrary IP_address other than that of any of the machine's interfaces this does work.
I am not getting why the packet is dropped when the source IP address of the packet is changed to that of one of the network interface IP adresses.
And also what is martian source or martian destination?