Reputation: 69
I'm developing an embedded system that has to communicate with the outside world over 10Base-T ethernet. I have built all functions required to serve web pages, including ARP, IP, TCP, ICMP (ping), HTTP and portions of FTP. Now, I need to build the rest of the code, which will allow me to act as a client. All the above-mentioned protocols have been working well from the server standpoint for several months.
Now, I need to build the client half of these protocols, to request data from other servers. Step 1 is to ARP for the hardware address of the remote server. As I understand it, since the server is on another network, my gateway should respond with its MAC address so that I know to pass all packets destined for that IP to my gateway. Here's the problem:
My device (192.168.1.251, on subnet mask 255.255.255.0) doesn't get an ARP response from my gateway (192.168.1.1) or any machine outside of the network. However, my device (X.251) does get an ARP response from my laptop (192.168.1.100) which is under the same router.
I'm certain that my basic ARP ethernet frame structure is correct, because I reply to ARP requests correctly every time. The difference is in the OPERATION field, which is either a 1 or 2 depending on REQUEST or REPLY.
Here's my device's (192.168.1.251) request to the gateway (192.168.1.1), which gets no response:
FF FF FF FF FF FF <-- destination MAC - broadcast (also tried 0x00)
00 04 A3 7F C1 57 <-- source MAC - my device
08 06 <-- ARP
00 01 <-- ethernet
08 00 <-- IP
06 <-- 6 byte MAC addresses
04 <-- 4 byte IP addresses
00 01 <-- request (2 = reply)
00 04 A3 7F C1 57 <-- sender MAC - mine
C0 A8 01 FB <-- sender IP - mine = 192.168.1.251
00 00 00 00 00 00 <-- target MAC - unknown, reason for request
C0 A8 01 01 <-- target IP - gateway = 192.168.1.1
00 00 00 00 ..... 00 00 00 <-- trailer of 18 sets of 00 for padding
Now, my device's (192.168.1.251) nearly identical request to my laptop (192.168.1.100), which gets a valid response:
FF FF FF FF FF FF <-- destination MAC - broadcast (also tried 0x00)
00 04 A3 7F C1 57 <-- source MAC - my device
08 06 <-- ARP
00 01 <-- ethernet
08 00 <-- IP
06 <-- 6 byte MAC addresses
04 <-- 4 byte IP addresses
00 01 <-- request (2 = reply)
00 04 A3 7F C1 57 <-- sender MAC - mine
C0 A8 01 FB <-- sender IP - mine = 192.168.1.251
00 00 00 00 00 00 <-- target MAC - unknown, reason for request
C0 A8 01 64 <-- target IP - laptop = 192.168.1.100
00 00 00 00 ..... 00 00 00 <-- trailer of 18 sets of 00 for padding
Side notes that may or may not be important:
Upvotes: 3
Views: 14377
Reputation: 41
I would try to troubleshoot this in the following manner:
Using a tool like scapy, craft an ARP request from your laptop requesting the gateway's MAC, and send it to the broadcast MAC. Take a look at whether the request is replied to.
Then, create an ARP request on your laptop using scapy, but set the source MAC to be your device's MAC address, and send a request to the broadcast MAC for the gateway's MAC. This is essentially simulating your device's sending on your laptop. If you can change your laptop's mac temporarily to your device's MAC, you should get the reply on your laptop.
If the above step works correctly, then you will have simulated the exact behaviour of your device on your laptop, and the actual device will work correctly as well.
Upvotes: 0
Reputation: 47945
If I guess right you post your ARP request to your notebook, which is not permitted to answerthat ARP request. Normally every device answers just for itself. Try to enter the target ip 192.168.1.1 for your router. That should work.
By the way you cannot get the MAC Adress of any devices which are outside of your subnet. Every package needs to send to the gateway mac adress with the target ip adress.
Upvotes: 0