How can a host register its hostname? - networking

When I connect a device to my router, or if I use a tool like Advanced IP Scanner to look for devices on my network, the found devices are typically listed with and IP and a hostname. My computer running Windows 7 shows up with the name that can be found by typing hostname into cmd.
Some devices, like an embedded device I'm working on, are listed as "unknown" or the IP is simply repeated in the Name column. I can manually edit the etc/hosts file to assign a name for the specific IP of my device and it will show up in the IP Scan results.
My question is, how are these names found by the router/Advanced IP Scanner? What exactly do I need to implement on my device so that it automatically registers a hostname? I already have NetBIOS working, but this does not seem to be related to the hostname.
My embedded device is running the lwIP embedded TCP/IP stack.

I think you are looking for something like Avahi/Zeroconf but from an ESP-like device(probably).
See this answer:
Does lwIP support Zeroconf?

Related

How can I programatically set the IP address of a hardware device that doesn't already have an IP set

We have developed a hardware device that doesn't have a screen. It uses TCP/IP to communicate with the network. Currently this is configured by DHCP.
However, we'd like a way to configure it's IP statically by some app I'll have to develop. I notice for some devices like printers there are custom apps that they use to set such information. But how do they talk to the device when the device hasn't been assigned an IP already?
Are they using RAW sockets and a custom protocol? or is there a simpler method. For example, I recall many years ago using a Linux device that somehow received it's initial IP by running an arping. But I don't understand how that sets the IP for other hosts on the network. Nevertheless it seemed to work. Could I mimick that?
e.g. arp -s 191.168.2.2 00-40-9d-22-23-60
So I've got an idea how it works, but I'd like to know what is the common method of setting IP to an embedded device that has no physical screen to configure this.
To be clear, this device does not use Linux.
The standard-conformant way of doing this goes (for IPv4, but IPv6 is similar) along the lines of:
Try to obtain an IP address via DHCP, skip step (2) if that worked. This should be the default.
If no DHCP server responded, use a unique link-local address (These are addresses from the block 169.254.0.0/16 reserved for this purpose. Some parts of the chosen address should be based on something unique to the device, like the MAC address, to make sure the device always chooses the same LL address. Or, to make it fully RFC-compliant: choose a truly random address from this range and probe it - Re-use it when possible) The chosen LL address should be checked against any other use in this network before usage with an arp request on that address (That's probably what you have read). If someone responds to that request, choose a different IP and retry.
Now that you have a temporary IP address, you can use one of the various IP-Multicast-based service discovery protocols to advertise your device to the network.

How to determine source of mysterious server name on my network

Over the last few days I have noticed a mysterious (unknown to me) server hostname that shows up on both Ubuntu's Nautilus Network section as well as Windows File Manager network group. The hostname does not show in the list of clients on my router. If I double click the hostname icon to try to connect to it I get a connection refused error. The hostname's appearance is random.
I have non-factory admin and wireless passwords set on my router as well as MAC filtering. Router firewall is on and no unneeded service ports are opened (NFS, etc.).
How can I determine the source of this unknown hostname and how can I close down my network in case this is really someone that has managed to break into my network? Also, if I have explicitly listed the MAC addresses of all my devices how could a non-listed device be able to connect?
Thank you for any comments you can provide.
Resolved; see previous comment on NetBios over TCP/IP.

How do I create/manage the stuff on private IP address of a device connected to LAN?

Okay. I really didn't know how to explain the question in title. What I actually want to do is this:
Suppose a device is connected to WiFi, i.e. it's on LAN. It would have a private IP address like 192.168.xx.xx like that. What I want is my (android app/or technically general way) program to have access to that IP and display some info on it, like a webpage or maybe live screen of the device itself?
For ex: http://192.168.0.105:5901/thisScreen would stream live screen of a mobile device. This URL can opened by any device connected to LAN. How do I achieve that streaming access on that particular IP address assigned to the device? (Assume I've control to everything).
How do I even begin for this? Networking? How do I implement it? Any references? I tried to Google my problem but didn't find any help.
Since you ask in general, what you want is to serve sth on a lan ip ex: on 192.168.1.50:80 and that is available to everyone on the same lan to be precise in 192.168.1.0/24 right?
Well if you haven't done any configuration such as subnets smaller than /24 that is what happening by default.
To confirm that run a web server an nginx for example on a local machine and visit the ip of this machine from another device on the same lan, you will see the default page of nginx.
So the only thing you have to configure is a service to run on a local machine and serves sth.

How to connect two devices through Wifi without using mDNS?

I have an embedded webserver running on a device. Now I want a smartphone app to connect to the webserver. They are on the same wifi network but they don't know each others IP addresses.
I understand that this problem is often solved by implementing the mDNS protocol on the server. But are there any alternatives? Can the server maybe ask for specific IP address or similar?
If it has to be entirely automated, such that the embedded webserver is discoverable, perhaps scan the entire netblock looking for the correct response "http://[IP_address]/yes-im-the-one" from your embedded webserver?
Although beware, some network monitors may then consider the IP of your smartphone/device that does that scan "dangerous" and cut it off from the network - this is probably only a "big enterprise" problem.
...after you "find" your server, perhaps the application should cache/remember this, so it doesn't have to scan next time.
Other things you could do: give your embedded webserver a static IP on the LAN, either by setting this on the device itself, or via a DHCP reservation from whatever is the local DHCP server on the LAN.
What allot of emended devices do is come delivered with a static LAN IP already set on it, then it's up to the sysadmin to change their computer's IP temporarily to be in the same range, then they can visit the webserver or telnet into the default IP, and change it to what they want (to match their network's IP range)

way to detect list of changes in ip address in client machine

Ours is a small network consisting of 15 users. We have LAN messenger installed in every machine. Someone is misusing it by using anonymous IP address in their system. We traced the anonymous IP as 192.168.0.155. Now we want to check each system if they have manually changed their IP to the above address. Does Windows stores IP address change event anywhere? All are static IP within a LAN.
With some luck, I've got an easy solution for you to retrieve some information about the target. You could try to use the nbtstat-command.
Just open a command prompt and type in the following:
nbtstat -A 192.168.0.155
This will output a bunch of information about the target host, including the machinename and MAC address.
Here is an example, how the output could look like:
(source: onlinecomputertips.com)
Good luck

Resources