Guest User!

You are not Sophos Staff.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SSL VPN question - is there possible to use NAT?

Here's a problem that cracks my mind recently.
I've successfuly managed to connect from the subnet (Internal) to one of the SSL-VPN clients.
Now I have the following setup:
-there is a VPN client with static VPN IP, say 10.0.13.37; client uses a link with dynamic address, which doesn't work with dyndns (3G broadband link - client is hidden behind several NATs); it is possible for the client to use an alternative uplink, also modile broadband;
-client is connected to ASG via SSL-VPN; wether the client is accessible from Internal network depends on the rules on firewall;
-ASG works on a link with a static IP, multiple firewall rules, multiple NATs, etc, everything works as desired;
---
Up to this point everything works OK.
---
The goal is:
-to have 2 ports, say 80 and 22, NATed, so everyone connecting to the ASG's external IP on port 22 gets redirected to client's interface; in other words the goal is to allow remote SSH connections to the client.

I've failed with this task, I have simply no idea on what to do.
Client connects correctly to the ASG, gets it's desired IP (mentioned above), client is accessible from Internal subnet according to the firewall rules.

Does anyone of you have any idea on how to achieve this?
Thanks in advance.


This thread was automatically locked due to age.
  • Some thoughts...

    If you DNAT all incoming port 22 traffic, you won't be able to allow Support to connect via SSH to your device.  If this is a home unit, that's not an issue.

    "Static VPN IP" - It is not possible to assign a fixed IP to a remote client with the SSL VPN.  If you're using a Host definition with a fixed IP in a Firewall rule, you probably want to replace the defnition in the rule with "Username (User Network)" instead.

    I'm a bit confused as to why you would want to use a DNAT for someone connected via VPN.  A VPN can be configured to allow connections with internal devices - no NATting should be required.

    If you are connected via VPN and are not able to communicate with a device in "Internal (Network)", then you probably have a very common configuration error.  Please check all of your Host and Network definitions to confirm that none is bound to a specific interface; all definitions should have 'Interface: >'.

    If none of those random thoughts help, then please show any relevant lines from the Firewall log and the Intrusion Prevention log.

    Cheers - Bob
  • You problem is likely that the client doesn't know that the incoming IP comign through the DNAT is supposed to be routed back out through the Sophos/Astaro gateway.

    Under Remote Access ->  SSL -> Global -> Local Networks you would likely need to put Any to get the client routing ALL Internet bound traffic through the tunnel.  Else, you can do a Full NAT instead of a DNAT for 80 and 22 that changes the source to something that is covered by an entry in that Local Networks field aforementioned.
  • Some thoughts...

    If you DNAT all incoming port 22 traffic, you won't be able to allow Support to connect via SSH to your device.  If this is a home unit, that's not an issue.
    (...)
    I'm a bit confused as to why you would want to use a DNAT for someone connected via VPN.  A VPN can be configured to allow connections with internal devices - no NATting should be required.
    Cheers - Bob


    The reason is simple: my internet uplink is a mobile broadband, so my home router is hidden behind several provider's masquerades. This doesn't allow me to access my home network from outside.
    A close friend has got an uplink with public IP, and he runs an ASG there.
    The reason why do I need such a weird NAT is that I require remote access to my home automation, for some reasons critical for me.

    (...)
    Under Remote Access ->  SSL -> Global -> Local Networks you would likely need to put Any to get the client routing ALL Internet bound traffic through the tunnel.(...)


    Thank you, both of you. I'll check this in a few hours, then I shall post the results.
  • Update:
    I've just done a fresh config.
    The config is as follows:
    On ASG: I've set "all" in allowed SSL networks, I've put a temporary "any to any" rule in firewall.

    Ifconfig on a linux box (the one I need to have access to) shows:
    tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              inet addr:10.242.2.6  P-t-P:10.242.2.5  Mask:255.255.255.255
    which is OK.

    ASG successfully pings the box on shown IP.

    The box pings ASG's internal IP, or machines in the Internal network.

    There is a DNAT set on ASG: traffic to External on port 22 goes to [username (user network)].

    Nmap shows port 22 as filtered, SSH doesn't connect.

    With FullNAT it works in the same way, mean it doesn't work.

    The only difference between my setup and the default one is that I've managed to make an autoconnect script.
  • Hi, 

    Don't use FullNAT.

    Did you check the 'auto packetfilter rule' on the DNAT?

    Do you have Masquerading setup for your VPN user, and can it access the internet?

    Barry
  • Yes, there is a masquerade: VPN users (there are 2 users here) -> External.
    Yes, the Automatic Firewall rule is ON.
    I've switched to DNAT, but as the box is offline at the moment I'll check it later, and post results.
    Thank you for the idea.
    ---
    Edit:
    It still doesn't work, despite of making changes described here.
    ASG pings the client, client pings the ASG, client routes it's traffic through ASG.
    The box got the same IP on the VPN than yesterday.
    Both SSH and NMAP fail: SSH doesn't connect, NMAP shows the port as 'filtered'.
  • Ruhllatio and BarryG, do either of you guys understand what's where, why the Linux box has an IP in "VPN Pool (SSL)", whether "client" means the Remote Access client or the Linux box or both, what his friend's ASG with a public IP has to do with this, etc.?

    Cheers - Bob
  • Bob,
    Not completely, but it looks like the linux box is a point-to-point VPN client.

    Barry
  • I hope the image will clarify things a bit.

    On the left side there is my subnet, with The Box mentioned above. Traceroute from a computer in that network pasted below the image.
    On the right side is friend's subnet, with a NAS, etc.
    Blue are the things that work. I am able to access the NAS through the SSL VPN.
    Red are the things I'd like to work - as I don't have public IP I assume I need to bounce off friend's router to access The Box from the outside world.
    Anticipating further question: No, placing an ASG in my subnet is not possible for various reasons, but I know it would solve the problem - I've done it at work once.



    ---
    kociak@kociak:~$ tracepath google.pl
     1:  kociak                                                0.107ms pmtu 1500
     1:  gateway                                               1.341ms 
     1:  gateway                                               1.016ms 
     2:  10.9.208.97                                          96.761ms asymm  3 
     3:  10.9.208.102                                         78.900ms 
     4:  10.9.241.2                                          147.806ms 
     5:  10.9.241.29                                         1233.191ms asymm  4 
     5:  10.9.241.29                                         5295.276ms asymm  4 
     6:  10.9.243.1                                           87.301ms asymm  4 
     7:  10.9.243.222                                        108.714ms asymm  4 
     8:  [redacted].pl                        169.200ms asymm  4 
     9: (...)

    8 is the address that appears on sites such as What Is My IP Address
    Those 10.9-whatevers are provider's devices.
  • Two ideas, but I've not tried either one.  If the first doesn't work, try the second one.  Both assume that The Box and the mobile client are connected via SSL VPN Remote Access.

    1. Maybe just a Firewall rule: 'VPN Pool (SSL) -> Any -> VPN Pool (SSL) : Allow'

    2. If not, put an additional address named "The Box" on the Internal interface of the ASG.  Assume that your linux box is logged in with username "Kociak-Box" and that you are logged in as 'Kociak' as the remote mobile user.  Make a NAT rule in the ASG:

    Kociak (User Network) -> Any -> Internal [The Box] (Address) : FullNAT from Internal (Address) to Kociak-Box (User Network)



    Any luck with either approach?

    Cheers - Bob