I have a setup where there are few (let say 5) network devices connected in a LANThe MAC addresses of these devices are all known to me. The IP addresses of these devices can change. Is it possible to send packet to other devices addressing to their MAC address ? Is there any such API ?
Related
I am developing an Ethernet connected embedded system. The embedded system's network stack is limited, I do not want to use TCP/IP.
The IP address of the embedded system can be configured by the user and there is scope for that IP address to be forgotten by the user. I'm looking for a simple method for discovering that IP address. The embedded system does not have a display.
I can guarantee that the embedded system and PC performing the discovery are on the same local network. There may be a ethernet switch between the two devices, but no router. However, it is possible that the embedded system will have been configured with an IP address from a completely different subnet.
My plan is to send a UDP broadcast to the network. The embedded system receives this and will respond with its serial number and currently configured IP address. I have successfully got the UDP broadcast to the embedded system, but I am struggling with the source IP address for the response sent by the embedded system.
Even if the destination IP address, destination MAC address and source MAC address are correct (non-broadcast), if the source IP address is from a different subnet, the UDP packet isn't received by the PC (It isn't shown in Wireshark on Windows 10). An illustration of what I'm trying to do is below:
Is it possible to use something else for the source address (possibly the network address)?
I'm wondering if there are any other approaches to this problem?
I'm looking for a solution that does not require any special user permissions on the PC and ideally can be programmed in C#.
Picture
I can't send pdu from pc to wireless laptop
It actually can send the PDU because u only have a network so the network between your PCs and your laptops is actually the same network. Check your IP address on your PC (it should be on the same network / subnet). If your PCs and laptops are already on the same subnet, check the port of the connected cable on the wireless router. It should be placed on ethernet / gigaethernet. But u can't connect it into internet port.
The wireless router that u are using is actually only Access Point. Because of that, it only can have a single network either on LAN or wireless.
Hope it helps!
I have a bacnet application which broadcasts a message to all devices connected. When i use the address 10.9.x.255, it works and the device is able to get the response but when i use the global broadcast 255.255.255.255, the packet is not reaching the device it has to reach.
What may be the reason for this? I can use the address 10.9.x.255 but i would like to know the reason behind it.
On a different computer it works with global broadcast address but does not work on a specific computer. both computers running on windows 10.
Thanks in Advance
Could it be, that the device you want to reach is not located in your local network?
Just to clarify the difference:
255.255.255.255 broadcasts to any IP-Address in your local network (called limited broadcast)
10.9.X.255 is a directed broadcast, which is send to the network 10.9.X.0 with the network mask 255.255.255.0 and broadcasted there to all participants connected to the respective local network.
Edit: While you seem to be able to send a directed broadcast, many routers disabled directed broadcasts due to the risk of DoS-Attacks (see RFC 2644 Specification).
When you send a packet on Windows to 255.255.255.255, it only transmits out of one network interface. This is a bug/design flaw in the Windows IPv4 network stack.
If it's working for you on one of your computers, it's likely that you just got lucky that the one interface Windows is sending your packet from is the one you're using.
References:
https://social.technet.microsoft.com/Forums/windows/en-US/72e7387a-9f2c-4bf4-a004-c89ddde1c8aa/how-to-fix-the-global-broadcast-address-255255255255-behavior-on-windows?forum=w7itpronetworking
https://github.com/dechamps/WinIPBroadcast
I have a PC (Windows 10) connected to my router through an ethernet cable. I also have a few devices connected to the same router. What I would like to do is make them "see" each other. I want to transfer files from my phone to my pc and back using ES File Explorer. I want to Broadcast movies to my smart TV using apps like Wondershare.
My PC is visible for other devices but I can't seem to find it using my TV or phone. Therefore... i guess all these devices are not connected to the same "mini-network". I don't know how to call it.
What should I do?
If you are in the same subnet as the router and there are no firewall rules blocking it, you should be able to see the devices on your computer. If you go to your phone settings, search for the IP and try to ping it with the command line of your choice. If it does not work, compare the subnet mask and ip address of your devices, make sure they are in the same subnet.
On windows the command is: ipconfig on linux: ifconfig or the new form: ip addr
I am trying to use an esp8266 to find what ip addresses are registered on the same subnet and their mac addresses for a home automation project. Does a ping response contain the MAC address of the device or is it possible to ask for it over a local network.
On a *nix system, you can run arping <some-ip> to get the MAC address of a machine on the same network (only those machines which can get your packet without being routed through a network, of course).
As rodolk suggested, you can run pcap and look at the ethernet frames as well. Ethernet frames contain the source MAC, and destination MAC and ethernet type.
Something like this:
uint8_t ether_dhost[ETHER_ADDR_LEN]; /* destination MAC address */
uint8_t ether_shost[ETHER_ADDR_LEN]; /* source MAC address */
uint16_t ether_type; /* packet type ID */
You could sniff packets and parse the ethernet headers, or you could run an arping, I think that should serve your purpose.
Ping does not reveal the MAC address. It simply tells you if a server is online or not.
You can use "nbtstat -a ip" command on windows to do that.
If you are trying to obtain the MAC address (layer 2) given an IP address (layer 3) you can use RARP. Otherwise, if you use ping, at layer 3 you won't have access to the MAC address of the ping response. However you can use pcap to sniff the network, read the ping reply with the apporpriate pcap filter, and obtain the MAC address from the arriving Ethernet frame. You can also use packet sockets to get layer 2 frames. pcap should be useful.