Accede a tu red desde cualquier lugar sin IP pública - OPNSense - ZeroTier | NETWORLD

3 min read 20 days ago
Published on Sep 04, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

In this tutorial, we will guide you through the process of accessing your private network from anywhere, even without a public IP address. We will use ZeroTier in conjunction with OPNSense to enable remote access to your internal servers or devices over the Internet. This method is particularly useful for those who need secure access to their home or office networks without the need for a static public IP.

Step 1: Setting Up OPNSense

  1. Install OPNSense:

    • Download the OPNSense ISO from the official website.
    • Use a USB drive to create a bootable installer.
    • Follow the installation instructions to set up OPNSense on your hardware.
  2. Basic Configuration:

    • Access the OPNSense web interface by navigating to http://192.168.1.1 in your browser.
    • Log in with the default credentials (username: root, password: opnsense).
    • Change the default password for security.
  3. Network Configuration:

    • Go to Interfaces > Assignments to configure your network interfaces.
    • Assign the WAN and LAN interfaces appropriately based on your network setup.

Step 2: Installing ZeroTier

  1. Create a ZeroTier Account:

    • Visit the ZeroTier website and sign up for a free account.
    • Confirm your email to activate your account.
  2. Install ZeroTier on OPNSense:

    • Access the OPNSense shell via SSH or the console.
    • Run the following commands to install the ZeroTier package:
      pkg install zerotier
      
  3. Start ZeroTier Service:

    • Enable the ZeroTier service to start at boot:
      sysrc zerotier_enable="YES"
      
    • Start the ZeroTier service:
      service zerotier start
      

Step 3: Joining a ZeroTier Network

  1. Create a Network in ZeroTier:

    • In the ZeroTier web console, create a new network.
    • Note the Network ID provided.
  2. Join the OPNSense Device to the Network:

    • In the OPNSense shell, run the following command (replace YOUR_NETWORK_ID with the actual Network ID):
      zerotier-cli join YOUR_NETWORK_ID
      
  3. Authorize the Device:

    • Go back to the ZeroTier web console.
    • Find your OPNSense device listed under members and authorize it to connect to the network.

Step 4: Configuring Firewall Rules

  1. Set Up Firewall Rules in OPNSense:

    • Navigate to Firewall > Rules.
    • Add rules that allow traffic from the ZeroTier interface to your internal network.
    • Ensure that the rules permit the necessary ports for the services you want to access.
  2. Testing Connectivity:

    • From a device connected to the ZeroTier network, try to ping the OPNSense LAN IP address.
    • Check connectivity to your internal servers or devices.

Conclusion

By following these steps, you have successfully set up a secure connection to your private network using OPNSense and ZeroTier, allowing you to access your internal resources from anywhere without needing a public IP address. Ensure to regularly check your ZeroTier dashboard for connected devices and maintain your firewall rules for security. If you encounter any issues, refer back to the ZeroTier and OPNSense documentation for troubleshooting tips.