OpenVPN config to allow client to access local network


Recommended Posts

I am trying to get my one Raspberry PI to connect to an OpenVPN server but still allow it to talk to my local lan subnet 192.168.0.1/16 so I can SSH into it but all other traffic goes out the VPN (Split Tunneling?)

 

I tried to add 

 

route-nopull
route 192.168.0.1 255.255.0.0

 

into my ovpn config file all I get back is an error

 

  Quote

Options error: option 'route' cannot be used in this context

Expand  

and I lose connection to my SSH session

 

does anyone know the correct way to allow traffic from a OpenVPN client to the local network?

  On 24/09/2021 at 19:13, neufuse said:

192.168.0.1/16

Expand  

That is not a network, that is a host address.  And that would not be how you would do it on the client side even if network was correct.. You would need the gateway to use.

 

So I take it this pi is on the 192.168.0.0/.16 network?  With an address of 192.168.0.1?  And you want to talk to say 192.168.0.2 but route all other traffic out the vpn connection? Why would you use up all of the rfc1918 192.168 space via 1 network for starters.

 

Your pi being on any network normally wouldn't route traffic that local out the vpn.  Do you have other networks in the 192.168/16 space locally that your trying to get to?  Maybe a drawing of your network, and some details of exactly what your trying to accomplish would help.

 

If you use the route-nopull in your client, you would not be sending anything to the vpn unless you route traffic specifically to it.

 

What is the normal client config, server config your connecting to.. Do you have this - or is this some vpn service?

 

Normally if the vpn is setup correctly.. The client will route internet out the vpn, but any local networks would still be accessible be it on the local same network as the client.. If your server is using redirect-gateway, and you need to get to some local network.. For example in my case 192.168.3/24 is another network local.. While My server send internet traffic out the vpn, my local 192.168.9/24 traffic is local.. But can not get to 192.168.3/24

 

openvpn.jpg.44458dd7e2d451a15a904f1acf04435a.jpg

 

So just add the local route to my client config.

route 192.168.3.0 255.255.255.0 net_gateway

 

Now when connected to vpn, I can get to internet via vpn, my local network directly attached to 192.168.9/24 and also the other local network that my local router routes.

 

localnetworks.jpg.28c8567074d065e1dd928d8955c074bc.jpg

 

 

 

 

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Grab Motorola's Razr Ultra 2025 at 15% off and ditch your slab phone by Paul Hill Motorola is currently selling the Razr Ultra 2025 on Amazon at a discount of 15%, meaning you can pick it up now for $1,099.99 instead of the usual $1,299.99. This is a notable saving on a premium foldable smartphone, but it still remains a high-end purchase. Any Prime members out there can get free overnight delivery and if you have an old device to trade in, then you can get up to $725 in Amazon.com Gift Card credit that you can use towards your upgrade. One of the main perks of this device is that it’s universally unlocked, meaning you can use it on all major US carriers. It’s powered by the Snapdragon 8 Elite and comes with 16GB RAM and 512GB storage. With these specs, this device should be able to run any apps you throw at it. The Pantone Scarab color, a soft, velvety suede-like texture, is the result of a collaboration with the Italian brand Alcantara, known for its premium materials, giving the phone a very unique look. As a flip phone, you also get an intelligent and interactive external display that lets you access apps without opening your phone. Even with this external display, Motorola says you can expect over 36 hours of battery life and when you do need to recharge, you have fast charging. The main display on this device is 7 inches and features a Super HD resolution which is 2992 x 1224, the refresh rate is 165Hz. The external display has a resolution of 1272 x 1080. This phone could be a good pick for fashion-conscious users with its unique materials. It’s also a great device for anyone after a compact form factor or who is a fan of Motorola devices. The style, compact design, external display, fast performance, and improved camera system (50MP) are all positives on this device. There’s also IP48 rating for dust and water protection, adding durability. Motorola Razr Ultra 2025: $1,099.99 (Amazon US) / MSRP $1,299.99 This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
    • Lots of people want a world where everything is personal and nothing is ever discussed rationally. List me as one of the people who doesn't think that's a good approach.
    • I think it's great that we're learning more about the early universe through observation. Knowing that our assumptions were off is a good thing. Once space based gravitational wave detectors exist, we may be able to "see" into the period where the universe was still condensed before matter formed. That'll be cool
  • Recent Achievements

    • One Month Later
      BA the Curmudgeon earned a badge
      One Month Later
    • First Post
      Doreen768 earned a badge
      First Post
    • One Month Later
      James_kobe earned a badge
      One Month Later
    • Week One Done
      James_kobe earned a badge
      Week One Done
    • Week One Done
      macomen earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      653
    2. 2
      ATLien_0
      253
    3. 3
      Xenon
      168
    4. 4
      neufuse
      147
    5. 5
      +FloatingFatMan
      127
  • Tell a friend

    Love Neowin? Tell a friend!