0

On a hosted environment where we do not have control over the routers all we have is a internal network and a DMZ network and a host in each. In the DMZ is a RHEL server running Openswan and terminating a IPsec VPN tunnel to another site.

The system in the internal network needs to access the systems on the other side of the tunnel. The idea is to create a route on the internal host pointing to the DMZ host as the gateway to get to the hosts on the other side of the tunnel.

Based on research, it appears that I cannot have a gateway in another subnet that is not directly connected to me. Is this indeed the case and is there any way to get around this?

This is the command I run on the internal host:

route add -host $hostOnOtherSideOfVPN gw $hostInDMZ dev eth0

I am able to access the host in the DMZ without any issues (ICMP, telnet, etc). Can anyone point me in the right direction?

random
  • 450
  • 1
  • 9
  • 16
gdurham
  • 879
  • 7
  • 10

3 Answers3

3

Routing of end devices (non-routers) works on 3 pieces of information, your IP address, your subnet mask, and your default gateway. The host does math on the IP address and subnet mask to figure out what IPs are "local" and which should be sent to the default gateway for further processing. So, your default gateway must be on the same subnet as you are, otherwise the configuration simply won't work.

Aaron
  • 2,968
  • 1
  • 23
  • 36
  • In this case this is not the default gateway just a gateway to get to a single host/network. – gdurham Sep 22 '11 at 17:07
  • Sure, most hosts will generally allow you to add additional routes. However, they must point to another IP *on the same subnet*. Remember, all the default gateway (router) knows about a packet is the destination IP address. If you have A-B and then C and D both connecting to B, then there's no way for A to say "I want these packets to go to C and these other ones to go to D". B makes that decision. – Aaron Sep 22 '11 at 17:41
1

You can have a route to another network via your default gateway by adding a route to that network in your default gateway. So the traffic goes through a specific route rather than the default route (which would at that point be the routers default gateway).

So what you need is this:

Local LAN--->DG--->DMZ host--->Local VPN Endpoint--->Remote VPN Endpoint--->Remote LAN

Which should be accomplished by adding a route for the remote LAN in your DG that routes to the local DMZ VPN Endpoint. The local DMZ VPN endpoint then should have a route (it may already be there by virtue of the VPN connection) to the remote LAN in it's routing table.

joeqwerty
  • 109,901
  • 6
  • 81
  • 172
0

You could setup an SSH reverse proxy between $DMZHost and $RemoteHost(s) but depending on number of remote hosts and remote host ports you need to access on the other side, this might be a bit unwieldy.

If it's doable, you would then connect to $DMZHost on the forwarded port(s) you specified in your tunnel.

gravyface
  • 13,957
  • 19
  • 68
  • 100