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

    Allow only certain IPs to connect to home pfSense?

    Scheduled Pinned Locked Moved IPsec
    7 Posts 3 Posters 637 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.
    • T
      terryzb
      last edited by

      Apologies in advance for the newbie question. I used Netgate docs and have IPsec working to connect my Mac at work to the home pfSense 2100 to then screen share my home Mac. Looking through pfSense IPsec logs I see a quite a few random connection attempts. Since I only connect from one place is there any benefit to allowing only the work router IP for IPsec connections? If so, how would I do that?

      johnpozJ 1 Reply Last reply Reply Quote 0
      • johnpozJ
        johnpoz LAYER 8 Global Moderator @terryzb
        last edited by johnpoz

        @terryzb It is always best to secure your connection to specific IP or limited set of IPs. No matter if a secure vpn type service with secure auth method, etc. if possible

        The rule on your wan that allows access to the service your exposing can be set to only allow a specific source IP. Or a netblock, or even when you don't know the source, you could lock it down to a list of geoips.. Like only the US for example. Or the ASN of the provider they would be coming from like comcast or whatever other isp they might be using.

        If you know the only place your going to connect to your vpn is from your work IP.. Then sure lock it down to that IP.

        I have openvpn setup, and I am quite confident that someone is not going to just be able to auth to my vpn.. They need the cert issued by me, and they would also have to have the tls key to even start the auth process, etc. But I still lock it down to US based IPs, while I don't know what IP I would be coming from on the road, I do know its going to be a US based IP.

        If nothing else it keeps noise out of your vpn log ;)

        An intelligent man is sometimes forced to be drunk to spend time with his fools
        If you get confused: Listen to the Music Play
        Please don't Chat/PM me for help, unless mod related
        SG-4860 24.11 | Lab VMs 2.8, 24.11

        T 1 Reply Last reply Reply Quote 0
        • T
          terryzb @johnpoz
          last edited by

          @johnpoz Thank you very much John. I always appreciate your experience and advice.

          S 1 Reply Last reply Reply Quote 0
          • S
            SteveITS Galactic Empire @terryzb
            last edited by

            @terryzb See
            https://docs.netgate.com/pfsense/en/latest/config/advanced-firewall-nat.html#disable-auto-added-vpn-rules

            If you want to, say, use a laptop, you can install a dynamic DNS client on the laptop and allow your dyndns hostname in the firewall rule. pfSense updates hostnames every 5 minutes by default.

            Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
            When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
            Upvote 👍 helpful posts!

            1 Reply Last reply Reply Quote 0
            • T
              terryzb
              last edited by

              I'm now blocking port 4500 from any IPs not in a range of IPs my work's ISP assigns. Should I also block port 500?
              41830733-8b73-4e71-a4b0-c84da1df8347-image.png

              S 1 Reply Last reply Reply Quote 0
              • S
                SteveITS Galactic Empire @terryzb
                last edited by

                @terryzb If you checked “Disable Auto-added VPN rules” then you need to add allow rule(s). I do not know where the hidden, auto rules are in the list, I would guess the top.

                And yes there are two ports.
                https://docs.netgate.com/pfsense/en/latest/vpn/ipsec/firewall-rules.html#outer-ipsec-traffic

                Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                Upvote 👍 helpful posts!

                T 1 Reply Last reply Reply Quote 0
                • T
                  terryzb @SteveITS
                  last edited by

                  @SteveITS Thanks Steve. I did not Disable Auto-added VPN rules. The block ports 500 and 4500 rules I added are being hit and the logs have been quiet, so looks like being at the bottom of the WAN list is okay.

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