• February 23, 2025, 06:40:25 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

This Forum Beta is ONLY for registered owners of D-Link products in the USA for which we have created boards at this time.

Author Topic: Adding route to VPN subnet on server connected to DIR-615  (Read 10052 times)

cptncrnch

  • Guest
Adding route to VPN subnet on server connected to DIR-615
« on: September 05, 2014, 03:30:25 PM »

I'm setting up a Raspberry Pi (RPi) as a VPN server and it is connected to the DIR-615 router. I am forwarding UDP traffic from port 1194 to the RPi. How do I route VPN tunnel traffic to go out from the RPi to the router?

I'm referencing the section from https://community.openvpn.net/openvpn/wiki/BridgingAndRouting#UsingroutingandOpenVPNnotrunningonthedefaultgateway.
Quote
The next thing you need to do on the router is to add a route for your VPN subnet. In the routing table on your Router, add 10.8.0.0/24 to be sent via 192.168.0.10. This is needed for the traffic from your LAN clients to be able to find their way back to the VPN clients. If this is not possible, you need add such routes explicitly on all the LAN clients you want to access via the VPN.
Logged

FurryNutz

  • Poweruser
  •   ▲
    ▲ ▲
  • *****
  • Posts: 49923
  • D-Link Global Forum Moderator
    • Router Troubleshooting
Re: Adding route to VPN subnet on server connected to DIR-615
« Reply #1 on: September 05, 2014, 03:34:22 PM »

Link>Welcome!

  • What Hardware version is your router? Look at sticker under router.
  • Link>What Firmware version is currently loaded? Found on the routers web page under status.
  • What region are you located?

Check to see if you have Routing options under Adanaced or Tools...

Internet Service Provider and Modem Configurations
  • What ISP Service do you have? Cable or DSL?
  • What ISP Modem Mfr. and model # do you have?

You may need to refer to the Mfr of the RPi for additional help and information for using there devcies.
Logged
Cable: 1Gb/50Mb>NetGear CM1200>DIR-882>HP 24pt Gb Switch. COVR-1202/2202/3902,DIR-2660/80,3xDGL-4500s,DIR-LX1870,857,835,827,815,890L,880L,868L,836L,810L,685,657,3x655s,645,628,601,DNR-202L,DNS-345,DCS-933L,936L,960L and 8000LH.

PacketTracer

  • Level 4 Member
  • ****
  • Posts: 441
Re: Adding route to VPN subnet on server connected to DIR-615
« Reply #2 on: September 05, 2014, 05:00:13 PM »

Hi,

Quote
How do I route VPN tunnel traffic to go out from the RPi to the router?

As far as I understand your OpenVPN scenario, the question should be just the other way round:

How do I route (unencrypted) VPN tunnel traffic to go out the router to the RPi (where it gets encrypted and enters the VPN tunnel)?

The idea behind this question is that local clients on network 192.168.0.0/24 when sending packets to the VPN subnet (10.8.0.0/24) will just send it to the router, because it is configured to be their default gateway.

So you have to tell your router to route traffic destined for 10.8.0.0/24 (back) to your RPi (192.168.0.10). You can do so in ADVANCED | ROUTING in the web GUI of your DIR-615.

In order to send the tunneled packets out to the Internet, your RPi only needs to have its default gateway configured to be your router, just like any other client on your local network.

PT

Logged

rosede

  • Level 1 Member
  • *
  • Posts: 12
Re: Adding route to VPN subnet on server connected to DIR-615
« Reply #3 on: September 05, 2014, 05:37:28 PM »

cptncrnch,

If I understand you correctly, you want to open a VPN tunnel to access your internal network from the outside, correct?

Daryl
Logged

cptncrnch

  • Guest
Re: Adding route to VPN subnet on server connected to DIR-615
« Reply #4 on: September 05, 2014, 08:16:13 PM »

Hardware Version: E3     Firmware Version: 5.13   Region: USA
I'm looking at RPi forums for correct iptables settings. I just want to make sure I'm setting up the router correctly too.

PacketTracer, yes, that's the route I'm trying to establish. So under "Routing", would the RPi address be the Destination IP and the tunnel address be the Gateway? And just to be sure, is the Netmask masking the Gateway address?

rosede, yes, I ultimately I want to be able to open a VPN tunnel to access my home LAN.
Logged

cptncrnch

  • Guest
Re: Adding route to VPN subnet on server connected to DIR-615
« Reply #5 on: September 05, 2014, 08:37:45 PM »

I entered the RPi address as the Destination IP, and 255.255.255.0 for the Netmask, and the tunnel address i.e. 10.8.0.1 as the Gateway. When I click Save Settings, I get a warning that says:
Quote
The 2nd range of IP address must be between 0
What is it asking to change?
« Last Edit: September 05, 2014, 10:27:54 PM by cptncrnch »
Logged

PacketTracer

  • Level 4 Member
  • ****
  • Posts: 441
Re: Adding route to VPN subnet on server connected to DIR-615
« Reply #6 on: September 06, 2014, 02:17:25 AM »

Hi,

to be most precise I hope this configuration will work:

  • Check the checkbox of the next free (probably the first one) ROUTE LIST entry and configure this entry as follows:
  • Name: VPN-NET (or whatever you like)
  • Destination IP: 10.8.0.0
  • Netmask: 255.255.255.0
  • gateway: 192.168.0.10 (or whatever RPi's address is inside your LAN)
  • Metric: 2 (but value doesn't really matter with static routing)
  • Interface: LAN

It will route all traffic for your VPN subnet 10.8.0.0/24 to the LAN interface (192.168.0.10) of your RPi/OpenVPN server. In addition the router should send ICMP redirects for any single OpenVPN client address out of this range back to your LAN clients (or should I say "LAN servers" from the point of view of your Open VPN clients?), so they learn host routes to the OpenVPN clients going directly to your RPi (but these host routes are only stored temporarily in a routing cache).

EDIT: There are D-Link router models, that, depending on firmware version, refuse to select Interface: LAN, this way rendering the feature to define static routes useless, at least insofar the need to define routes for the WAN interface should arise extremely seldom. If this is the case either with DIR-615, as a workaround you have to configure the route for 10.8.0.0/24 with gateway 192.168.0.10 on each LAN client, that shall talk to OpenVPN clients.

PT
« Last Edit: September 06, 2014, 10:36:41 AM by PacketTracer »
Logged

cptncrnch

  • Guest
Re: Adding route to VPN subnet on server connected to DIR-615
« Reply #7 on: September 06, 2014, 12:19:22 PM »

Looks like my DIR-615 router is one of the models that refuse to select Interface: LAN.

If the RPi is the only LAN client I'm interested in connecting to via VPN, is it alright to not set a static route for tunnel traffic on the DIR-615 router?
Logged

PacketTracer

  • Level 4 Member
  • ****
  • Posts: 441
Re: Adding route to VPN subnet on server connected to DIR-615
« Reply #8 on: September 06, 2014, 01:18:01 PM »

Quote
If the RPi is the only LAN client I'm interested in connecting to via VPN, is it alright to not set a static route for tunnel traffic on the DIR-615 router?

In this case an OpenVPN client (10.8.0.x) would address the OpenVPN server using its VPN subnet address 10.8.0.1, and this communication takes place inside VPN subnet only - no routing is needed. Hence the answer to your question is yes!

PT
Logged

FurryNutz

  • Poweruser
  •   ▲
    ▲ ▲
  • *****
  • Posts: 49923
  • D-Link Global Forum Moderator
    • Router Troubleshooting
Re: Adding route to VPN subnet on server connected to DIR-615
« Reply #9 on: October 22, 2014, 07:16:31 AM »

Possible to add a Virtual Server rule here. Not sure if it would help any.  :-\

One thing to consider is that most of D-Links home class routers don't support loopback or LAN to LAN routing which is reserved for there business class routers.
Logged
Cable: 1Gb/50Mb>NetGear CM1200>DIR-882>HP 24pt Gb Switch. COVR-1202/2202/3902,DIR-2660/80,3xDGL-4500s,DIR-LX1870,857,835,827,815,890L,880L,868L,836L,810L,685,657,3x655s,645,628,601,DNR-202L,DNS-345,DCS-933L,936L,960L and 8000LH.