0

I own a dashcam that creates a WiFi hotspot that I can connect to using my phone and download all the footage. However, that is extremely annoying to do, so I want to make something automated to download all the footage. Therefore I would like my Raspberry Pi to connect to the hotspot over WiFi using an USB dongle and also connect to my home network with an ethernet cable. Then I want something on the Pi to give the hotspot an IP on my home network, so I can access the dashcam's hotspot using any device on my network.

The setup could look something like this:

 Computer

    |
    v

  Router

    ^
    |

Raspberry Pi

    |
    v

 Dashcam

I just need to access http://192.168.0.1 on the dashcam from my computer, but my computer doesn't have WiFi and I would rather like to have the dashcam on my home network instead.

I haven't been able to find any guides on this, so maybe you guys knew?

2
  • @jsotola You're completely right. Thanks Aug 11, 2020 at 19:47
  • this actually is not an RPi question ... it is a linux networking question ... i am not well versed in networking ... perhaps the solution could be as simple as creating a second interface on the RPi ... the RPi would forward all traffic on one of the interfaces to the dashcam ..... google debian multiple interfaces on single ethernet port and debian route ethernet interface to wifi
    – jsotola
    Aug 12, 2020 at 3:04

1 Answer 1

3

There is no way to give the access point an ip address originated from the Raspberry Pi. It must have a static ip address as fixed entry point for the hotspot. And it cannot have an ip address from your local network because the RasPi must transfer the traffic between its two interaces wlan0 and eth0 so it has to bridge both interfaces. But you cannot bridge a WiFi interface as client connection due to hardware limitations of the on-board WiFi device of a Raspberry Pi. So forget to give the Dashcam an ip address from your local network.

But you can use destination NAT (Network Address Translation) on the RasPi that will translate a local ip address into the ip address of the Dashcam. For my example I will use the subnet 192.168.1.0/24 as local home network, managed by the router.

First give your RasPi a static ip address on eth0, e.g. 192.168.1.254. Be sure it isn't used by any other device, of course. The Dashcam has still 192.168.0.1. Then enable ip-forwarding on the RasPi. This ensures that ip traffic is forwarded between interfaces:

rpi ~$ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward

For a persistent setting look how it is done on the networking environment you use.

Then use iptables to set a destination NAT:

rpi ~$ sudo iptables -t nat -A PREROUTING -d 192.168.1.254/32 -j DNAT --to-destination 192.168.0.1

Now you should be able to connect to the Dashcam with http://192.168.1.254. This simple setup has the disadvantage that you cannot connect to the RasPi anymore. But it is no problem to give interface eth0 a second ip address that can be used to connect to the RasPi. How it is done, also depends on your networking environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.