Is it possible to determine what jack on a switch a computer is connected to? - networking

Is it possible to determine programmatically what jack on a network switch a computer is connected to?

It's either possible or not possible, depending on the switch.
If it's a managed switch, you could query its management interface to determine the MAC addresses behind each port. Then you could match that up with the hardware address on the computer you're interested in.
Some switches have discovery protocols (such as CDP or LLDP) which will broadcast the port's identity to whichever devices are attached. You could sniff the network for these packets to determine the port your computer is connected to.

You can try disonnecting them one by one and each time testing if the network connection goes down.

To identify switch port connected to your pc ; you need to manually access the switch and remove ur rj-45 cable so you can visualize any port having state of disconnection.. dm gui can be used if switch is managable
cdp and lldp wont work for pc as it doesnt support it

Related

How to send data between two ESP32's over same LAN?

I want to send data(I think I can achieve it sending http requests) between two ESP's that are connected to the same LAN. I don't want to use one as an access point! I have one esp that is acting as a homekit device, and I want to send data(for example, sensor readings) to it from another esp. I've seen many tutorials where one device is acting as an access point, but that's not what I need. I also don't really need to access the esp data directly from my laptop, so I believe I don't need the html page. I would appreciate any help, code, or any existing tutorials, because I didn't find a single one.
Configuring one ESP as an AP is only done for convenience. You can configure both of them in STA (station) mode and they will connect to, e.g. your phone hotspot or your wifi router.
Connected to the same hotspot, they are on the same network, and they will be able to communicate with each other (unless the hotspot is configured to not allow this ... ). The tricky part will most likely be for the "client" to determine the IP address of the "server" in order to create the connection.
If you have admin access to the hotspot, you can cheat and hard code the IP addresses (assuming that the hotspot will assign the same IP address to the device the next time it sees it.)
It's also not difficult to use mdns (aka bonjour), which allows a network device to assign itself a local hostname. So you can name one ESP ("myserver") which allows the ESP running the client code to connect to "http://myserver.local"

Need to reveal IP addresses of devices connected to a switch via EdgeMax Router 4

I am wondering what is the best way to reveal all IP addresses to devices that are plugged into a switch, that is then plugged into an EdgeMax Router 4 by Ubiquiti. I attempted to use the nmap command on linux to reveal all devices behind 192.168.1.1/24, which is the address that the switch is plugged into, but only some devices came back. I was searching for the IP address of an OpenBMC device connected via the switch, but I couldn't find it.
The switch is a basic TP-Link gigabit 8 port switch (SG-1008D) and to my knowledge and research, it doesn't appear to have a web console or interface to reveal IPs there. And when I log into my EdgeMax Router 4, I only see devices at the router level.
I am not the most versed in networking knowledge, but I did a few things first to research. If anyone has any further suggestions on what else I could try, please let me know.
Only layer 3 switches have the ability to display the IP address of the devices directly connected to them. Your SG-1008D is just an unmanaged switch and it will not be able to display the MAC or the IP address of the devices connected to it. You will be able to identify the MAC and IP address of the devices connected to the switch by running network tools such as Angry IP Scanner or by looking into the connected devices list of the router. But that will not show you the ports where the devices are connected to in the switch.

Can the MAC address of a mobile device be easily determined?

This is somewhat of a general question, is it realistic to assume that a router can resolve any mobile device's MAC address without being already connected via wifi or bluetooth?
If the device is broadcasting, or if it's connected to another access point, then capturing the wifi data would allow you to capture the device's MAC address. Routers aren't generally set up to listen in that way, and I don't think it would be simple to configure that kind of behavior.
In general, if a device isn't connected to a wireless router/access point, you aren't going to be able to capture its MAC.

Detect all networked devices' types in a home network

I would like to write a software running in a networked device, i.e. PC. It can automatically detect the other network devices' types. For example, it can detect there is a PS3, a Wii, an IPad running in the same network. Any ideas? Thanks,
You have two problems: first, detecting that a device is connected to your network and at 192.168.1.x. Second, somehow detecting what that device is.
The first is easy-ish to accomplish: there's discovery protocols like UPnP and Bonjour. However, in a home networking scenario, the easiest and most reliable way to get a list of connected devices is probably to pull the DHCP reservations from your router. You might have to scrape data from the router's HTML-based management interface—hacky as that may be—but it would work. (If you're using .NET, consider the HTML Agility Pack to accomplish this.)
Once you have a list of IP addresses of connected devices, your next problem is to figure out what each device actually is. This will be more challenging. Some possibilities:
You may be able to use the MAC address to help detect the device's vendor. (Here's a list.)
If you're using UPnP, you can ask the device what it is.
Use IP fingerprinting to determine what the device is.
Couple thoughts. The broadcast IP address - 255.255.255.255 is where devices talk and say "here I am". Should be able to listen to this and find ip addresses and more. Second, if devices are assigned an IP address by a DHCP client (obviously) you can usually find a list on the dhcp device. Devices often have names, this is a higher level protocol, like windows SMB, that you may have to interface with in order to get that information.

Peer-to-peer chat

im wondering if it's possible to create p2p chat application without server(so there is no need in external static ip.Is it true?)?
EddieC is right if the computers are located inside the same sub-network (LAN) or if the computers'ip is their interface to the Internet (WAN public ip). In that case, you can just use the ip's and ports directly.
However, usually, knowing the computers ip is not enough because the machines are located behind routers inside sub-networks. Thus, because the computers are hidden behind the routers, you will have to configure the routers to foward the packets to the right computers as function of the ports used.
Have a look at : http://wiki.vuze.com/w/Port_forwarding
If you do not want to use ip's because they are dynamic, you can configure urls with Dynamic DNS services.
Good luck
It is possible. But you must have someway for one computer to tell the other computer what their IP number is. You could email it to your friend or call them on the phone or post it on a message board.
If this program only has to work on a local network (LAN), there is something called broadcasting which might be of interest to you. It allows a packet to be sent out to every device on the network without having to know their IPs (then other instances of your program could reply with the IP of their machines so you could set up proper connections).
This won't work over the internet, though (imagine being able to broadcast to every computer connected to the internet!).

Resources