After doing some research, i am reaching out for some further help or recommendations. If i have a website sitting out on an external network(public facing) and i want to capture information about what client is requesting access to the website, is there a consistent way of doing this regardless of browser or device?
ActiveX is a no go due to install requirement.
ARP seemed promising until it said it doesn't work with routers(sigh)
Using the System.Net and grabbing the MAC addresses looked ok but appeared to also require the clients to be in the same subnet which in this wouldn't work.
Grabbing the IP of the request and then going after the MAC address with that IP seemed promising but fell short when routers come in to play as you get those devices instead of the phone/pc etc.
Is there a way for me to capture the MAC or IP of a client that is outside our network?
Related
So the problem is this, I created a restful selfhosted api, to work with my mobile app, on the app mobile I stored my public ip (190.xxx.xxx.xxx) when I try to consume the api from the same network donset work no response, If I go 3g or in anoter network its work fine.
I try on my browser those 2 situation:
http://localIp:port/api/Menu/... its work
http://externalIp:port/api/Menu/... dont work - ps. this work only if I on a diferent network or 3g.
But I need to keep sotored my plubic IP for the external users and I dont want to store 2 ips internal and external to check if the user is on local network or external.
in summary my clients can use the app outside the office, but in the office with wifi connected they cant.
Tks for anyhelp
I found this and solve my problem
https://docs.connectwise.com/ConnectWise_Control_Documentation/On-premises/On-premises_knowledge_base/Cannot_access_external_IP_address_from_LAN
Introduction
In some scenarios, a user cannot use an external IP address to access a machine on their local network. This is typically a result of security measures put in place by routers and referred to as a Network Address Translation (NAT) loopback issue. This article will discuss what this means for ConnectWise ControlĀ® on-premises users and will provide some suggestions.
What is NAT loopback?
Many routers and some security tools prevent loopback connections as a security feature. This means that a machine on your local network cannot connect to the external IP address (such as 208.112.93.73) of a machine that is also on your local network. Connecting to a local IP address (such as 192.168.0.2) of that same machine works fine.
I am trying to tell if a mac address is present on a network using c#
We are trying to make a whos in the office dashboard and we will check to see if the person's cell phone connected via wifi (who we will get the mac address from) is
I am not very strong in networking so I am not sure where to even start.
You can run a windows arp -a command line to find out all the devices that are connected to the current network.
You can then parse out the mac address of each line to figure out who is in the office.
MAC addresses are stripped off at the first router/switch, so they're not going to be useful for determining what is connected, unless you can access the monitoring port on your router/switch and you only have one. If you're on a multi-hop network, it's useless.
edit
OK, I've removed a bunch of stuff I said, now that I understand you're talking about cell phones and wifi connections.
The very easiest way to do this that I can come up with is to set your router's DHCP lease time to something short like 10 minutes, then ask the router "who is connected".
The short least time will auto-renew whenever it expires as long as the client is still there.
Many routers display the current DHCP leases on a management page. You can scrape the page with your app and get a list of all currently active DHCP leases.
You can also get it from /tmp/dnsmasq.leases (on the router) if you're running a router that uses dnsmasq. (the location may change but /tmp is pretty common).
The first solution requires parsing a web page and the second requires getting a plain text file from the router and parsing it.
In any case, the best way to know "who is connected" is to ask the device they're connected to.
I would ask if it is possible to get information about connected devices in the local wireless network.
Is there any api for xamarin to do that?
It doesn't seem like Xamarin has an API for this, but Microsoft introduced a Ping (documentation here) and a NetworkInterface class (documentation here) in .NET 2.0 that you could use.
Essentially, what you need to do, is to ping the IP adresses on your local network, which you can do asynchronously using SendAsync(). You then register the callbacks by registering an EventHandler to PingCompleted. The callback will contain a PingCompletedEventArgs which you can use to retrieve basic information (e.g. IP, MAC and Hostname) about the device.
You can find a complete guide of the implementation here.
I hope this helps.
Note: Of course, it all depends on what type of information you expect to retrieve. Although, I think you can only expect to retrieve the basic information about devices on your network, as everything else could potentially be a security risk.
Secondary note: Depending on which devices you wish to discover on your network, you could also use the SNMP component which will allow you to discover devices such as routers, switches, printers, and so on.
I am thinking you are looking for which devices at layer-2 have registered with your wireless controller/accept-point/router and by being connected you are referring to how many have successfully establish 802.x handshake (implying security exchange and channel establishment has occurred).
There exists a tool to do this work (never tested this on my mac) and you can check Flying Squirrel for the above purpose. This will ofcourse be an independent sniffer over the wireless network and you'll require the password used for wifi etc. for making this work.
If you have access to a device that exposes instrumentation (MIB) then you can get that information from the device by SNMP walking the device. At this level you'll of course get the MAC address table and if DHCP is running on your router then perhaps access to DHCP table can give you information about the MAC to IP mapping. On some medium to high end networking gear MIBs like CISCO-DOT11-ASSOCIATION-MIB can be used. Also I am assuming you are refering to 802.11 here there are other wireless protocols like BlueTooth etc. in play as well which use different scanning techniques so the answer depends on what kind of network you are referring to here.
Ok, I figured out a way without snifing the local network. It makes more sense the following way in my case...
Case:
I want to connect to an device which provide an own wlan network. Then I connect to it and pass the home wlan network to it. The device restarts and is now configured as a client in the local home network. And now I need the local ip for service communications.
My Solution:
I do a register call to the device. The device gives me the mac address. Now I register (with phone device) the mac address from the access point device in a online service. After the device has been restarted and get the new local ip address it sends to the online service.
And the I can retrieve the local ip address through polling or through getting push notification from the server...
Like what the title says, is there a way to get the mac addresses and/or ip of all routers connected to a switch in asp.net c#?
If so, is there a way to determine if the connected router is on and off?
The setup of my routers and switch is in the image link.
Managed switches uses SNMP (Simple Network Management Protocol) where you can get information such as the port connection for every port, see here.
Some more information you can get via LLDP (Link Layer Discovery Protocol), see here
I think this should be enough hints. For some work you can use pcap via c#.
I'm creating some small electronic modules for home automation based on Arduino chips, with Ethernet connectivity. I will try to make them get an IP address with DHCP if possible, but I'm also wanting to build a C# application to configure these modules, and I'd like my software to scan the network to auto-detect my modules, as an HP printer driver can auto-detect the printers on the network for instance.
I thought of :
getting the computer's IP and Mask to determine the IP set
then multi-thread pings or HTTP requests to every IP of the set
check the responses and get the mac addresses
see if the mac address matches my set
do an specific http request to retrieve the "model" of the module, and know how to interact with him
Is this algorithm plausible or do anyone know of a more efficient way ? Like broadcasting requests on the broadcast address and see what gets back ? Any samples or ideas ?
Totally plausible. Direct low-level access to put arp requests out and get the arp-table back is little tricky, but there are several questions here on the site.
Be advised that a device does not have to answer to ping to be able to function on the network. Check the documentation on the chips you use.
Assuming you only want to discover over the same network segment, I would actually suggest using a broadcast message instead (UDP). of course you will have to develop the side on the device to respond to that broadcast and listen to those responses. once you get a response, you can start a direct communication to the device using your preferred method.