Discover raspberry's IP - networking

I have a Raspberry with win 10 IoT, working as a main server for a cloud of sensors. In the raspberry I have a server that broadcast its IP using UDP broadcast. Then all my distributed sensors notice it and connect to the Raspberry via TCP and the fun can start.
I added a web server to the raspberry to be able to monitor the status of my sensors and then I encountered a funny problem .. how do I discover the IP of the raspberry to be able to enter the website ??
All my sensors (and the PI) have hardcoded the SSID and pass of my WiFi at home. But the thing will need to be portable. In theory I plan to set the pi as Access Point and hardcode in the sensors the SSID of the Pi and have a portable system.
Can a Pi on Windows IoT be set as AP ? When doing so can it's IP be forced ?

Can a Pi on Windows IoT be set as AP ?
Windows IoT Core device can be set as soft AP. When the Windows 10 IoT Device have access to the internet (e.g. through a wired LAN connection), it can share the Internet access with other devices connected to your device over the Wi-Fi SoftAP via Internet Connection Sharing (ICS). You can follow this tutorial to do this.
When doing so can it's IP be forced ?
You can set a static IP address to the device. For example, via the device portal, like this:
More information of setting static IP of the Raspberry Pi running Windows IoT Core you can reference this thread.

Related

Access raspberry Pi without ip

Is there a way to reach the raspberry Pi, since the ip is dynamically assigned to each device.
I have to use the API that the raspberry Pi is serving.
You have to know its IP to access, for example, via SSH. To connect to your Pi via SSH, you will need to enable SSH first. So, you will have to connect the Pi to a monitor first to enable it.
To find out its IP, you can do a LAN neighbours scan in your network. You can use a mobile app like Wifi Analyzer or you can use a windows program like GlassWire.

zeroconf on wireless connection without password

I want to setup a register / discover type of service connection between 2 devices on the same wireless LAN. Idea is to find, connect and send wireless router password to a new device for easy installation. This needs communication between 2 devices on the same wireless network before connecting to router with SSID, password.
I'm aware of zeroconf, bonjour and mDNS libraries. All implementations I see start with connecting to wifi in station mode to get a local IP with hardcoded SSID and password, which is not known at this stage.
In other words, how can connect to wireless and get a link local IP without SSID and password?
-- Edit for better explanation --
The flow i'm looking for is like this:
1- Mobile phone (iphone or android) is connected to secure home wireless network as usual
2- A new device with wireless interface is powered on first time.
3- Device gets (or sets) a local IP and local dns name (multicast ip and name) for itself
4- Device broadcasts its available services to the network
5- Phone discovers the service, along with devices' local name and even local ip already assigned.
6- Phone initiates a direct connection with the device to send wireless configuration information (ssid and password for the access point)
7 - Device saves this information, resets into normal operation mode
8 - Device connects to internet
9 - Device services are still available in the local network
-- edit --
Code will run on esp32 or esp8266, so compatible c or arduino libraries are ok.
I'm aware of smartconfig implementation of ESPTouch application, but it is a horrible design! Discovery program tries to create sockets to every possible IP address to find the peer IP.
Read this sentence in your question again and think about it:
In other words, how can connect to wireless and get a link local IP
without SSID and password?
The protocols you mentioned are only possible AFTER you're part of the network. As you know, wifi networks are protected to prevent unauthorized access.
Try wifi protected setup (WPS) in Google.

How to connect to raspberry Pi over internet if we know only its MAC Address

I have Raspberry Pi and a mobile app developed in ionic.It has to communicate over SocketIO and normal HTTP request. I can communicate if i know IP address and port no. But what if I'm using it over internet and my raspberry pi's IP address is changing dynamically due to DHCP. How do i connect to my raspberry Pi device. Is their a way to connect if I know MAC address of Rasspberry PI.
Short Answer: no
Slightly Longer:
MAC is only useful at Layer 2. So the minute you have a router between you and the device, you will no longer be able to see the MAC. If you control the Layer 2 network you can statically assign a DHCP address, or you can look at the logs and see what IP it was assigned, but if the device is connecting to networks you don't control and its address is changing, you will need a way for the Raspberry Pi to register where it currently lives. There are a variety of ways to do this, such as dynamic dns registration, or you could have it phone home to some sort of locator service that your app could then query, etc... But without extra software you are probably out of luck.
You should use a dynamic IP service like www.noip.com. They provide a free linux and/or windows client.
That way, when your public IP changes, you will still be able to connect.

How to access to my personal computer from work using VNC

I want to access to all kind of webpages without restriction from work, so I thought I could set up a vnc server on my raspberry pi, forward 80 port to 5900 port (for example) on my router and try to access to my raspi from work using a client like RealVNC. Now the question would be, Is this going to work? If not, what would be the correct solution?
Start with this video overview: Raspberry Pi - How to put your Pi Online
Use the TightVNC Server as it is widely supported and compatible with the Raspberry Pi. Here's a tutorial on how to setup a Tight VNC server on the Raspberry Pi: Raspberry Pi - Installing VNC server
Setup Dynamic DNS on your Raspberry Pi. This will give you one address to point your VNC viewer at that will stay the same. With out it your address may change every now and then at the ISP's discretion.
Setup TightVNC Viewer on your work computer and point it to your new dynamic address and your TightVNC servers port. Then connect.

Communicate through a VPN link using Arduino UART WiFi Module

The following describes the configuration of the system and other details. The problem is mentioned after that. If the initial description is too much or not needed, please skip it.
I have a VPN (between two SIMs). One SIM is in a USB dongle, the other one is in a WiFi router. The dongle is connected to computer 'A', and another computer ('B') is wirelessly connected to the WiFi router which can access the dongle. The VPN is between the router and the computer 'A' (dongle). As the WiFi router leases 'B' a private IP, 'A' can't ping 'B'. But 'B' can ping 'A'. There is no issue up to now.
I have created a socket-based simple Java network application (client - server pair). The client is running on 'B', the server is running on 'A. Only the client can send data to the server, the other way around is not possible. This part also is OK. Now I need to replace the computer 'B' with an Arduino. I need to send some data from the Arduino to computer 'A' through the same network.
For this, the Arduino needs a WiFi module to access the router. I've this USART WiFi module with the shield. It can successfully connect to the router, (I can ping it from a computer, which is also connected to the router).
THE PROBLEM
Now the configuration is as below.
There's the (server) application running on computer 'A', which is listening on a given port (port 8090). How can I send some data (eg. some text "hello!"), from the Arduino to the computer 'A'?
Please note that for the WiFi module I'm using, I found some examples for applications based on the Arduino WiFi shield. But I can't apply them to my configuration (can I?).

Resources