SIM5320A, device connected to 3G Network but can't ping server - arduino

I've been trying to make this SIM5320A module send HTTP requests to my server but even though it appears connected to the internet I can't seem to ping any server or make any requests.
I'm sending AT commands through a terminal on my Linux PC.
AT+CPIN appears READY
I've configured through the AT+CGDCONT, AT+SOCKSETPN = 1 and AT+CGSOCKCONT commands, adding my service provider's APN.
AT+NETOPEN returns OK. Running it again returns Network is already opened.
AT+CPSI? show's that it's connected to the WCDMA network and is online.
AT+IPADDR throws a proper IPv4 address.
So I'm trying to do AT+CPING="google.com",1 but it just won't connect.
I've even been able of sending a SMS and reading GPS coordinates, just failing in the internet stuff.
Am I missing any configuration steps? There is so little information online on this device.

Related

How find correct Ip for connection Client/Server Qt?

I created two Qt apps: one client and one server.
I use them to send some data for handle a remote device.
If I am in localhost I haven't issues about them, but when i search to connect them by internet i don't know how to find correct Ip server to connect Socket Client.
How i can find this ip node?
Is there a class to find It?
you cannot find it automatically, if this is what you're asking about.
In real life you would deploy your server on some publicly accessible host, give it a domain name (important part as your host can change the IP address at any time) and connect the client via the DNS domain.
However if you're just playing around and you want to show to the world that your app works, specifying the IP address of the server in your client code would be perfectly fine (assuming you're running both the server and the client in the same network).
In that case, if you're running mac/linux run the command ifconfig (or just ip depending on the distribution). On Windows you can run the command ipconfig. Both windows and linux will give you a similar output resembling this:
Pay attention to the network adapters. There can potentially be many of them. You may have some emulated adapters if you have docker or VMWare, you may have the wireless adapters if you have a WiFi card, and then the ethernet adapters if your computer can connect to the the internet with an ethernet cable. Each of these adapters specifies a different IPv4 address. You want to pick the one that is connected to the same network as your client. So for instance if both your server machine and your client running machine are connected to the same wifi, you pick the address from the Wireless LAN adapter

How to send messages to IoT Gateway with server running on Google Linux instance

I am trying to send messages from my mac to a Google IoT Gateway running on a Google VM linux instance. Can't get the gateway server running in the linux instance to ack messages sent from scripts on my mac.
Set up Google VM linux instance and followed directions in:
https://codelabs.developers.google.com/codelabs/cloud-iot-core-gateways/index.html#0
I did try to read through https://cloud.google.com/community/tutorials/cloud-iot-gateways-rpi.
I setup GOOGLE_CLOUD_PROJECT to point to my project.
I updated the ADDR in the thermostat.py script to point to the address of the linux instance. But I am not quite sure which address to use.
The address obtained by running ifconfig on the linux instance isn't pingable from my mac. I used the static address assigned to the linux instance, and although I can ping that, I don't see the server running on the gateway ack the message send by the script.
On the linux instance I run the gateway server, and if I run thermostat.py on the same instance, I see the messages received by the gateway and the Google IoT console.
However I am having trouble running thermostat.py from my local machine (mac). I want to get this working before trying it on my embedded device. I can see the script attempt to send the message but I don't see any messages received on the server.
Which ip address should I be using to communicate with the gateway server on my linux instance ?
Other than setting the ADDR and GOOGLE_CLOUD_PROJECT, are there any other changes I need to make to thermostat.py?
The VMs in GCE (Google Compute Engine) have a locked down firewall by default. You need to open up the ports for the HTTP connection so the traffic to the gateway can get through.

Unable to load localhost on web browser in Raspberry pi

I created a web server on my Raspberry pi using Apache2 and Wordpress. At the beggining I used a local network (IP is 192.168.1.103) and then used a Huawei dongle to connect to the internet. When the dongle is connected, web browser unable to load localhost. When dongle is used it shows that:
"The website at https://192.168.1.103/ seems to be unavailable"
How do I correct this error?
The IP address you're using to connect to the site is a local network address.
When the device is using a mobile data dongle it's no longer connected to your local network so the local IP no longer works.
You could find out your IP address when the dongle is connected however that's impractical. There's a good chance each time you reconnect the IP address will change. Your server needs to have a static IP address.
You cannot directly access a device on a Local network/LAN from the outside/WAN. Notice you are trying to connect to your localhost so you need to be directly connected to the device in question or through a medium which intenrally connects the devices together, such as a router/wifi hub.
When we break your steps down; you are trying to connect to a localhost/device on your LAN but you are connecting via dongle which is actually connecting via outside/WAN connection. This means your GET request for the localhost URL is going to the ISP/dongle providers server first then trying to get back into your LAN - this is not possible, hence the error.
Fix: Connect to device directly or via a medium such as a router (through ethernet or wi-fi).
Additionally: if you wish to type in a url instead of an IP then this will need to be resolved. This is done by manually typing in an entry in your hosts file (in the Raspberry Pi) and inputting the resoloution info i.e www.yourwebsitename.co.uk and local IP i.e. 127.0.0.1.
Your webserver (i.e. Apache) may need to be restarted for changes to take effect. If site is not loading correctly then it could be that your web browser is displaying a cached image in which case simply clear cache in your web broswer and reopen.

Ethernet Data Traffic hidden from capture

I have a puzzle I am not able to figure out, I would appreciate any help.
I am connected to a remote desktop using windows default remote desktop utility (Windows 8 locally, Windows 7 remotely).
The remote desktop is not in the same sub-network as my own.
Connection is made through default port 3389. Using Wireshark locally I can confirm the TCP connection being established and the data flow.
Running Wireshark in the remote desktop, I don`t see any flow of data between the two computers.
If I send a ICMP ping from the remote desktop to my computer, it works well and I can see it in Wireshark both remotely as well as locally. But if I send the ICMP ping from my computer to the remote desktop, it fails. I see it leaving my computer through Wireshark, but it never reaches the remote desktop (I don`t see it in Wireshark).
I don't think it is a firewall issue (specially since it can't explain why Wireshark won`t capture the port 3389 RPC flow).
Does anyone have any idea of what might be going on?
I found the main issue.
In Wireshark, turns out it is possible to configure the capture interface with a filter.
To change it, go to: Capture->Interfaces
On the interface being used, stop capturing to enable the Options, there it is possible to configure a capture filter.

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.

Resources