Today, we’re going to take an important step towards making your local machine stand out on the Internet! That’s right, we’re about to configure your machine so that you can browse using a public IP. Why? Well, just imagine: you can host that amazing website you’ve already set up locally, upload a service you’ve developed and want to test in a test environment, or even publish a game server so that all your friends and players can access it easily.
Now, let’s get straight to the point and see how to do it.
The first step is to have a VPS with PfSense Web Masters.
After installing pfSense, we follow these steps:
- We will need to configure OpenVPN; we can use the Wizard itself to install it:
- Go to VPN, then OpenVPN and then the Wizards tab.
- Keep the Local User Access option and click next.
- Create a new Certificate Authority and fill in the required fields.
- Create a new certificate for the server, just name it.
- Configure the VPN as necessary; in the Tunnel settings, don’t forget to set the private IP for VPN distribution.
- Don’t forget to check the option to Add firewall rules automatically.
- Now, let’s install the OpenVPN package in pfSense:
- Go to System, then Package Manager and finally Package Installer.
- Search for OpenVPN and install it.
Troubleshooting: If the options don’t appear, try updating your pfSense and the package options will appear. If you still can’t, force the update through the pfSense terminal.
- We’ll need to create an OpenVPN user to export the settings.
- Go to System, User Manager and then add.
- Simply fill in the required details and select to create a certificate.
PS: Enter the name of the certificate that matches the server that will be using the VPN.
- Let’s Export the VPN data:
- Go to VPN and OpenVPN.
- Open the Export tab and look for the customer you created.
- Export the settings according to the desired operating system.
- Install it on your local server and log in when you connect.
- Next, after installing OpenVPN on the server, we’ll configure NAT:
- Check on the machine which IP it received from OpenVPN.
- Go to Firewall and then NAT.
- Now we have to add a new rule and configure it:
- Under Interface, we’ll put WAN.
- Address Family: IPv4.
- Protocol: TCP/UDP.
- Destination: Type: WAN address.
- Redirect target IP: Address: IP of your machine.
- Redirect target port: Leave HTTP if you are not going to use a specific port.
- That’s it, all the mandatory information has been filled in, feel free to browse through the rest and configure as you wish.
- Save and then Apply Changes.
- Finally, let’s add OpenVPN as an Interface:
- Go to Interfaces and then Assignments.
- In LAN, you will put ovpns1 (server) and add it.
- Then simply Save and Apply Changes.
So, once the settings have been finalized and the VPN is functional, to test it, simply go to the client machine, connect to the VPN and access meuip.com.br; check that the outgoing IP is that of the VPS, if so, it’s 100% functional.