Access phone over home wifi router using a fixed IP - http

I want have an app on my android phone (which I will write) which will respond to some HTTP request. The request is going to come from a programmable board/microchip (like Arduino) over the home wifi router. The programmable board would be able to send the request to a hardcoded URL.
(I don't understand networking. So, please pardon me if my next statements are technically ambiguous/incorrect.) I would NOT be running the HTTP server on my phone over a public/constant IP. My phone currently shows me a private IP of 192.168.1.4. I am guessing it might not remain the same every time as I and others in the house disconnect/reconnect various devices. Is there a way to ensure I reach my phone every time through some internal IP? I don't need it to be accessible from outside my wifi router.
Thanks.
-- Parag

Related

Client cannot reach website hosted on Server when both are connected to the same hotspot

I've connected two devices to the same personal hotspot (e.g. using an iPhone's one). I did it because I want to create a local network where the two devices can communicate with each other and also both can access to the Internet.
One is the Client, the other one plays the role of the Server and hosts a website. The two devices can ping each other but when I open the browser on the Client and put the Server's IP address and the port where the website is served, for example 172.20.10.8:3000, nothing gets displayed and eventually the page shows the request has run out of time.
This issue happens also when using an Android device's hotspot. On the other hand, when I connect both to a normal Wifi network everything works just fine.
Does it mean there's some sort of limitations when using a Hotspot?
Eventually I've found out that you need to set the Hotspot connection as a Private Network in both clients. Otherwise it will be set to Public Network and the devices' IP Address would not be visible by others.

Wireless with 802.1x

I have the following problem.
I'm trying to configure my router (Iskratel F50 or Mikrotik hAP lite) to control WiFi traffic with 802.1x and some kind of RADIUS server. But, when I configure everything on the router, and try to connect on that WiFi with my Android phone, it just refreshes the list of available wifi connections and shows the test connection as "saved". Nothing else happens.
If I'm right, the router should send UDP package, with access request data to RADIUS server or whatever it is on specified IP, right?
Can someone help me?
I need my device to get access request and then decide to allow or deny access to that client, depending on other details.
At the RADIUS IP is an Arduino device, that shows all data that came on RADIUS port to the LCD.
Thank you.
Generally, for a 802.1x-authentication over RADIUS, one would indeed expect to see several packets. The default ports for RADIUS are 1812/UDP (authentication) and 1813/UDP (accounting).
The first packet your router sends to the RADIUS IP should already have a User-Name-attribute. The connecting device should query the user for this. So, when you connected to that SSID, did your phone prompt you for a username (and password)?

Networking: How do wifi enabled IoT products allow remote access?

I have been looking for an answer to this problem, but I cannot find what I am looking for. I think, perhaps, it is because I lack the knowledge to ask the question in meaningful way.
I have been learning a lot about remote access to devices at home. I know that ISP's change public IP addresses regularly (dynamic IP address). I know that to get around this, one could use a service like "no-ip", etc. Or one could get a static IP address.
What I do not understand is how some of the latest home automation devices are able to be controlled remotely without use of a static IP, or a service like "no-ip". For example, a wifi enabled thermostat, or lighting system.
If the device had a built in server, or client, then I assume that the device could connect to an outside server in a remote location. The user could then also log into that server and send commands to the device. What I don't understand is how commands sent to the device from a cell phone, for example, can reach the home device. Presumably the off site location of the server would have to know the public IP address where the devise is located, and then port-forwarding would have to be set up to allow access to the device.
What am I missing here? Is it possible to create a homemade wifi enabled thermostat, webcam, or other device without using port-forwarding, no-ip, or a static IP?
Well, there are several ways to bypass the inbound connection constraint of NAT protocol. Such as:
A virtual adapter on the device configured to a VPN server that has an inbound port open ready to transfer data. Various open source solutions such as openVPN are considered as great examples for this service over IOT boards like Raspberry Pi, Beagle Bone, etc. These are used as gateways often. Further, they communicate with the microcontrollers over popular IOT protocols such as MQTT, COAP, etc.
Another solution is to create a port forwarding tunnel, since the router won't block the outbound connection. There are various tunneling services that are availble such as localtunnel, ngrok, etc. You could also use a cloud server that has a public IP such as AWS, DigitalOcean, etc. Again as above mentioned point, they can be implemented in the gateways.
Some devices "phone home" to a server so that there are ports open between them and the servers, and the mobile apps just contact the servers. This is the same way your web browser can receive web pages from a web server. If you have a NAT router, the router must open a port from the inside device to the outside server. This is maintained in a NAT table with expiration timers for UDP and session monitoring for TCP.

Obtaining MAC address

According to Obtain client MAC address in ASP.NET Application, it is not possible. I am not entirely convinced because whenever I connect to Tim Hortons WiFi, my MAC address is known.
Occasionally, the network is slow and I see this URL like this before being redirected to the Connect page:
http://timhortonswifi.com/cp/tdl3/index.asp
?cmd=login
&switchip=172.30.129.73
&mac=60:6c:66:17:1a:83
&ip=10.40.66.229
&essid=Tim%20Hortons%20WiFi
&apname=TDL-ON-NEP-02177-WAP1
&apgroup=02177
&url=http%3A%2F%2Fweather%2Egc%2Eca%2Fcity%2Fpages%2Fon-72_metric_e%2Ehtml
So according to this URL, the site knows the IP address of the router, my MAC address, the IP address assigned to my device by the router, the network SSID, some other pieces of information, and the URL I was trying to access prior to connecting.
There's two options: Tim Hortons WiFi Basic and Tim Hortons WiFi Plus, where the "Plus" option allows me to connect to any Tim Hortons WiFi access point in Canada automatically with this device. Registration requires an email address, so I'm assuming this is possible by checking the MAC address and storing it in a database that routers ping upon connection. More info here.
According to the extension of this page, I can safely assume it is ASP. How are they obtaining this information?
When your client traffic reaches the first router, that router will route the traffic to the adecuated port, changing the response MAC address with its own MAC address so the answer will be routed to it. And this will happen for each of the routers the packets travel by. So, at the end, the web server will only see the MAC address of the last router where the answer will be sent to be routed back to the previous roter, and this process repeated until the answer reaches the client.
No, there is not way to obtain the MAC address of client from server side.
But, what you are seeing is a client sending its information to a server. So, the answer can be converted into "how can i obtain my local mac address and send it to the server?".
Browsers do not allow to read this information. Some properly signed/configured ActiveX or Java applets can do it, but they can be blocked, or you can have some device that will not execute java nor activex, so it is not a reliable way of doing it.
In the case in your post, the easiest way of doing it is configuring the wifi access point dhcp or dns server to serve a proxy configuration file that will allow to configure a redirection to the desired web server, redirection that has been created inside the access point, which have all the shown information in your post.

Networking Dilemma IP stack(Microcontrollers)

I basically have used the ethernet connection successfully with Microcontrollers to control real world aspects,The dilemma is of IP address I mean how can 192.168.0.155 be accessed from around the world without any specific MAC ID attached to it, I wanted to implement the same networking usage with a GSM module eliinating wires but that doesn't have MAC addressing so TCP connection from it towards a IP client won't reach?
I am not sure how you did your 'real world control' with Ethernet before, but the MAC address does not 'live' past the next recipient (which means after the next switch) so do not use it for anything.
Your 192.168.x.x address is private, so it will never appear beyond your internet gateway (i.e. your GSM modem if you used GPRS), and it cannot be used directly for anything on the internet. It is not easy to briefly explain here how the internet routing works, but you should either use port forwarding towards your private IP address given to you by hour DHCP server (in which you have to initiate request from the client so that other side would not the IP address and the port), or you have to either have fixed public IP address or you could use some dynamic DNS service (like http://www.noip.com/), or you can update data from the client on some server over which you have control (like if you updated data manually from your PC).
All summed up, it is not very clear what you are trying to achieve, but I would say you need to check out some things about internet routing before you proceed.

Resources