Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    How to prevent OpenVPN clients from accessing local IP addresses?

    Scheduled Pinned Locked Moved OpenVPN
    12 Posts 3 Posters 983 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      pfguy2018
      last edited by pfguy2018

      I have OpenVPN up and running. I would like to prevent OpenVPN clients from connecting any local IP addresses (except for the local gateway to provide DNS on port 53), and only allow the clients to connect back out to the web. What rule do I need for this, and which interface does it belong in?

      1 Reply Last reply Reply Quote 0
      • NogBadTheBadN
        NogBadTheBad
        last edited by

        Do they get IP addresses in your LAN range ?

        Andy

        1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

        1 Reply Last reply Reply Quote 0
        • P
          pfguy2018
          last edited by pfguy2018

          No, a completely different subnet. (LAN is 192.168.x.x, OpenVPN clients are assigned 10.0.x.x, DNS server would be 192.168.x.1 (edit - DNS could also be reachable at 10.0.x.1))

          1 Reply Last reply Reply Quote 0
          • NogBadTheBadN
            NogBadTheBad
            last edited by

            Here's what I do with IPSec:-

            0_1533298791453_Untitled.jpeg

            I hand out specific IP addresses to various users via FreeRadius.

            n_ipsec_trusted = 172.16.8.0/25

            n_ipsec_non_trusted = 172.16.8.128/25

            Andy

            1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

            1 Reply Last reply Reply Quote 0
            • P
              pfguy2018
              last edited by

              I already have similar rules on the OpenVPN rules tab, but the rules do not seem to block as intended, and local access is still happening. Here is what I have:

              0_1533300846540_Screen Shot 2018-08-03 at 8.52.59 AM.png

              ("Local" alias is all my local subnets other than the OpenVPN subnet)

              Any suggestions?

              1 Reply Last reply Reply Quote 0
              • NogBadTheBadN
                NogBadTheBad
                last edited by NogBadTheBad

                Whats the Advanced filter rule at the bottom doing ?

                Also why the gateway, do you have a multi wan set-up?

                Andy

                1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

                1 Reply Last reply Reply Quote 0
                • P
                  pfguy2018
                  last edited by

                  The only advanced option is the gateway - WAN_DHCP. I am not using a multiwan setup, but there are several outgoing OpenVPN clients. I think I stuck the gateway in there to make sure the connection went out over the WAN connection rather than the OpenVPN client connections. Is that somehow causing the issue?

                  NogBadTheBadN 1 Reply Last reply Reply Quote 0
                  • NogBadTheBadN
                    NogBadTheBad @pfguy2018
                    last edited by

                    @pfguy2018

                    Not sure but there is no need if you have a single wan connection.

                    try enabling logging on your rules and see what rule is being hit.

                    Andy

                    1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

                    1 Reply Last reply Reply Quote 0
                    • P
                      pfguy2018
                      last edited by

                      Turns out my rules work, for the most part. I was testing the connection by connecting to the VPN through my home network. When I connected outside my home lan, the rules worked as intended - DNS provided by the pfSense box, no other connections with the local subnets permitted. I am not sure why the connections were permitted when I originated from the home lan, but this is of little concern, as I would not normally be using a VPN when I am already on the network to which I am trying to connect.

                      NogBadTheBadN DerelictD 2 Replies Last reply Reply Quote 0
                      • NogBadTheBadN
                        NogBadTheBad @pfguy2018
                        last edited by

                        @pfguy2018 said in How to prevent OpenVPN clients from accessing local IP addresses?:

                        Turns out my rules work, for the most part. I was testing the connection by connecting to the VPN through my home network. When I connected outside my home lan, the rules worked as intended - DNS provided by the pfSense box, no other connections with the local subnets permitted. I am not sure why the connections were permitted when I originated from the home lan, but this is of little concern, as I would not normally be using a VPN when I am already on the network to which I am trying to connect.

                        By the sound of things you've set it up as a split tunnel.

                        Andy

                        1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

                        1 Reply Last reply Reply Quote 0
                        • DerelictD
                          Derelict LAYER 8 Netgate @pfguy2018
                          last edited by

                          I am not sure why the connections were permitted when I originated from the home lan

                          @pfguy2018 Because the local LAN was a local subnet to the host. That traffic won't go out the VPN, but straight out the interface.

                          Chattanooga, Tennessee, USA
                          A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                          DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                          Do Not Chat For Help! NO_WAN_EGRESS(TM)

                          1 Reply Last reply Reply Quote 0
                          • P
                            pfguy2018
                            last edited by

                            I get that. But the client was also able to access vlans on different subnetd when connected to the VPN server while originating from a home vlan. That is what confused me. (As noted earlier, this does not occur if connecting to the VPN server from outside the home)

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.