Skip to main content
17 of 31
added 1753 characters in body
Agustin
  • 146
  • 12

qAccessing a hotspot raspberry pi 3B+ and accessing network devices

I have a Raspberry Pi 3B+ which is working as a hotspot using a Hologram Nova usb modem where it receives Internet from and routes the internet through WiFi and Ethernet. This Hologram usb modem does not allow port forwarding so can't play around with ports.

I have realized that the IP address on the Pi changes every time the Pi reboots, Given that it's a mobile SIM, the cellphone company does not assign a permanent IP address. This makes it very hard or impractical to connect through SSH or access the local network.

The pi hotspot's local IP address is 192.168.4.1; however it uses a bridge with a range of 192.168.50.0/24 that work or route both wlan0 and eth0 interfaces. The pi hotspot also has another network interface in the form of ppp0 (which is the one that enables the data). All devices connected to the hotspot via wlan0 or eth0 obtain an ip in the range of the 192.168.50.0/24.

I was thinking of creating a home VPN using Pi VPN (different Pi, located at home and acting as a server), and have the RPI hotspot connect to the RPI VPN (at home) using PiVPN as a client. There is no tunnel installed in the RPI hotspot as of yet.

The purpose of this is so that once the hotspot is connected to the vpn, I can see the pi and all the other devices connected to it on my local network using either FING (phone app) or nmap (linux) or any type of ip scanner application.

I'm stuck in this. I have installed a no-ip client to get access to the Pi's public IP, but I haven't been able to ssh to the hotspot using the public IP.

Edit: I have removed the no-ip client. And I am just past step # 2 on Ingo's Answer.

I also installed the client VPN part however when I run the client and access the hotspot, and run the ip scanner app, I don't see attached devices.

Result of ip addr:

pi@RPiHotspot:~ $ ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
   valid_lft forever preferred_lft forever
inet6 ::1/128 scope host 
   valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
link/ether b8:27:eb:3f:0e:89 brd ff:ff:ff:ff:ff:ff

3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 8a:ea:17:87:3f:87 brd ff:ff:ff:ff:ff:ff
inet 192.168.50.1/24 brd 192.168.50.255 scope global br0
   valid_lft forever preferred_lft forever
inet6 fe80::88ea:17ff:fe87:3f87/64 scope link 
   valid_lft forever preferred_lft forever

4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000
link/ether b8:27:eb:6a:5b:dc brd ff:ff:ff:ff:ff:ff
inet6 fe80::ba27:ebff:fe6a:5bdc/64 scope link 
   valid_lft forever preferred_lft forever

5: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 3
link/ppp 
inet XX.XX.XX.X/32 scope global ppp0
   valid_lft forever preferred_lft forever

6: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 100
link/none 
inet 10.8.0.2 peer 10.8.0.1/32 scope global tun0
   valid_lft forever preferred_lft forever
inet6 fe80::2bda:2ce:7c23:31d3/64 scope link flags 800 
   valid_lft forever preferred_lft forever

Result of ip route:

pi@RPiHotspot:~ $ ip route

default via XX.XX.XX.X dev ppp0 proto static 
10.8.0.1 dev tun0 proto kernel scope link src 10.8.0.2 
10.176.0.0/16 via XX.XX.XX.X dev ppp0 proto static 
10.254.0.0/16 via XX.XX.XX.X dev ppp0 proto static 
192.168.50.0/24 dev br0 proto kernel scope link src 192.168.50.1                                                                
                    

I have also modified my peer2.conf file to have the remote with my public IP address at home, instead of 192.168.4.3. and I'm having the following issue when checking the status of [email protected]

pi@RPiHotspot:~ $ sudo systemctl status [email protected][email protected] - OpenVPN connection to peer2
Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-08-09 20:40:32 EDT; 1min 24s ago
 Docs: man:openvpn(8)
       https://community.openvpn.net/openvpn/wiki/Openvpn23ManPage
       https://community.openvpn.net/openvpn/wiki/HOWTO
Process: 350 ExecStart=/usr/sbin/openvpn --daemon ovpn-peer2 --status /run/openvpn/peer2.status 10 --cd /etc/openvpn --config /etc/openvpn/peer2.conf --write
Main PID: 390 (openvpn)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/system-openvpn.slice/[email protected]
       └─390 /usr/sbin/openvpn --daemon ovpn-peer2 --status /run/openvpn/peer2.status 10 --cd /etc/openvpn --config /etc/openvpn/peer2.conf --writepid /run

Aug 09 20:40:33 RPiHotspot ovpn-peer2[390]: UDP link remote: [AF_INET]72.140.29.88:1194
Aug 09 20:40:33 RPiHotspot ovpn-peer2[390]: write UDP: Network is unreachable (code=101)
Aug 09 20:40:33 RPiHotspot ovpn-peer2[390]: write UDP: Network is unreachable (code=101)
Aug 09 20:40:33 RPiHotspot ovpn-peer2[390]: write UDP: Network is unreachable (code=101)
Aug 09 20:40:33 RPiHotspot ovpn-peer2[390]: write UDP: Network is unreachable (code=101)
Aug 09 20:40:43 RPiHotspot ovpn-peer2[390]: write UDP: Network is unreachable (code=101)
Aug 09 20:40:54 RPiHotspot ovpn-peer2[390]: write UDP: Network is unreachable (code=101)
Aug 09 20:41:04 RPiHotspot ovpn-peer2[390]: write UDP: Network is unreachable (code=101)
Aug 09 20:41:14 RPiHotspot ovpn-peer2[390]: write UDP: Network is unreachable (code=101)
Aug 09 20:41:24 RPiHotspot ovpn-peer2[390]: write UDP: Network is unreachable (code=101)

                

And then the results are inconsistent, I got this after I restarted the peer2.service with:

sudo systemctl restart [email protected]

result is:

pi@RPiHotspot:~ $ sudo systemctl status [email protected][email protected] - OpenVPN connection to peer2
Loaded: loaded (/lib/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-08-09 20:57:39 EDT; 5min ago
 Docs: man:openvpn(8)
       https://community.openvpn.net/openvpn/wiki/Openvpn23ManPage
       https://community.openvpn.net/openvpn/wiki/HOWTO
Main PID: 638 (openvpn)
CGroup: /system.slice/system-openvpn.slice/[email protected]
       └─638 /usr/sbin/openvpn --daemon ovpn-peer2 --status /run/openvpn/peer2.status 10 --cd /etc/openvpn --config /etc/openvpn/peer2.conf --writepid /run

Aug 09 20:57:39 RPiHotspot systemd[1]: Starting OpenVPN connection to peer2...
Aug 09 20:57:39 RPiHotspot ovpn-peer2[638]: TUN/TAP device tun0 opened
Aug 09 20:57:39 RPiHotspot ovpn-peer2[638]: do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Aug 09 20:57:39 RPiHotspot ovpn-peer2[638]: /sbin/ip link set dev tun0 up mtu 1500
Aug 09 20:57:39 RPiHotspot ovpn-peer2[638]: /sbin/ip addr add dev tun0 local 10.8.0.2 peer 10.8.0.1
Aug 09 20:57:39 RPiHotspot ovpn-peer2[638]: TCP/UDP: Preserving recently used remote address: [AF_INET]XX.XXX.XX.XX:1194
Aug 09 20:57:39 RPiHotspot ovpn-peer2[638]: UDP link local (bound): [AF_INET][undef]:1194
Aug 09 20:57:39 RPiHotspot ovpn-peer2[638]: UDP link remote: [AF_INET]XX.XX.XX.XX:1194
Aug 09 20:57:39 RPiHotspot systemd[1]: Started OpenVPN connection to peer2.

But still cannot ping 10.8.0.1

Thank you kindly!

Agustin
  • 146
  • 12