2

I would like my raspberry to work as a gateway for LAN devices and connect to Internet. Now the default gateway is my router connected to ISP provider. Basically I would therefore like to share the connection via eth0 to other lan devices and go for the vpn, because an openvpn client is running on RPI.

This is my situation:

enter image description here

So I want that Raspberry, connected in eth0 to router via switch, became the default gateway (192.168.0.100 instead of 192.168.0.1)for client 1-3 to connect to Internet, and be passed under the vpn that runs on the RPI. I have a RPI3 B, wit debian 9 (stretch). Router will be not removed, trafficking is all through wired.

4
  • What gateway to what? To the internet? How do you plan to get connected to the internet by your provider? Using a USB/G4 dongle? Please don't answer in a comment. Instead edit your question to elaborate it.
    – Ingo
    Commented Aug 13, 2019 at 7:36
  • It is still unclear what you want to do. OK, eth0 is used to connect to the switch of your LAN. But again: how do you want to connect to the internet? What RasPi model do you have? Do you want to use the possibly available built-in WiFi device? Do you want to replace/remove the router?
    – Ingo
    Commented Aug 13, 2019 at 19:47
  • Thanks for the picture. I makes everything clear. It also shows that the question does not belong to Raspberry Pi. You can replace the RasPi with any other linux box and it will not change the question. You should better ask at superuser.com. This is a special routing problem because you have to set the default route on the RasPi to the router(192.168.0.1) on the same subnet and configure your DHCP server to give the default route to the clients. The clients will then first use the RasPi as default gateway.
    – Ingo
    Commented Aug 14, 2019 at 16:42
  • But the RasPi "knows" that clients can reach the router direct and will generate ICMP Redirect messages. It may be possible that clients follow this hint and switch the default route to the router, not using the RasPi anymore. There are possibilities to configure it the right way but cannot be done just in a comment.
    – Ingo
    Commented Aug 14, 2019 at 16:47

0

Your Answer

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

Browse other questions tagged or ask your own question.