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

    Import large number of Aliases/NAT to pfsense

    Scheduled Pinned Locked Moved NAT
    13 Posts 3 Posters 1.9k 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
      Thoufiq
      last edited by

      Hi,
      I need to NAT 4 internal IPs to a public IP. So i decided to create alias for the internal IPs and public IP and do Outbound NAT. It is working... But i need to do the same for 500 hosts is there any way to import the Aliases/ NAT pfsesnse(From excel or notepad) or any other way to simplify this task!!!Please help.....

      1 Reply Last reply Reply Quote 0
      • GrimsonG
        Grimson Banned
        last edited by

        https://www.netgate.com/docs/pfsense/firewall/aliases.html RTFM.

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

          Thanks for the reply...
          Using bulk import option i can only create single alias with number of hosts... but in my case,i have to create number of aliases with different IPs

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

            What exactly are you trying to do?

            So you have 500 hosts and you want to change their outbound nats? Why would you not just use 1:1 natting?
            https://www.netgate.com/docs/pfsense/nat/1-1-nat.html
            Outgoing traffic to the Internet from the specified internal IP will originate from the associated external IP.

            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

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

              I can't do 1:1 NAT in my requirement because i need to NAT 4 internal IPs to a single public IP. So idecided to create an alias for 4 internal IPs and did outbound NAT. Similarly i need to do the same for 500 hosts.

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

                @thoufiq said in Import large number of Aliases/NAT to pfsense:

                i need to NAT 4 internal IPs to a single public IP

                That is how pfsense works out of the box... So you have 500 hosts and you need to nat 1-4 to publicIPA, and then say 5-8 to publicIPB? etc..

                Why exactly? Not understanding the scenario - happy to help once I understand what exactly you want to do such a thing, etc.

                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

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

                  In this scenario the 4 hosts serve the same purpose. Since the 4 hosts are used for same purpose i decided to create outbound NAT with a single public IP to reduce the publice IP usage.Lets consider the private IPs 10.1.1.2/3/4/5 NAT by a public IP 'w.x.y.z' and if the 10.1.1.2 fails the other three hosts still communicate with internet by the same public IP.
                  By the way this is not the issue. It will be helpful if we can create the NAT or alias using excel/Notepad and import the excel or notepad file to pfsense to create large number of Alias/Rules/ NAT. or is there any way to create it via shell.0_1540389576955_Sample.png

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

                    I still do not understand the issue here. Looks like a simple loadbalancing config? Which doesn't explain the need for aliases or outbound nats.. I am clearly missing some piece of the puzzle here.

                    But if you want to create these without going through the gui.. Should be simple enough to manipulate the XML and load it in.

                    Just grab the alias and nat sections. Edit them to your liking and then restore.. There are plenty of places that will parse a text file or csv, etc. and put it into xml format for you with all the labels needed sort of thing.

                    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
                      Thoufiq
                      last edited by

                      Thanks for the suggestion..We have created aliases to identify which internals IPs(group) are mapped to which external IP.

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

                        CAn you please explain about """"There are plenty of places that will parse a text file or csv, etc. and put it into xml format for you with all the labels needed sort of thing.""""

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

                          @johnpoz I think outbound NAT is the best option where we want to map group of Internal IPs to an external IP

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

                            example
                            http://www.convertcsv.com/csv-to-xml.htm

                            There was a thread just the other day that had like 3 of them listed

                            Once you have a couple done - you will be able to determine the formatting in the xml for other ones.

                            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

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

                              Thank you so much.. Let me try this ...

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