Making OPNsense Unreachable by Changing LAN IPv4 DHCP on Hetzner
In this article, we will cover the process of changing the LAN IPv4 DHCP on an OPNsense server hosted on Hetzner. This can be useful when you want to make the OPNsense server unreachable from the client server, and instead, use OPNsense for network access to the public network.
Prerequisites
- An OPNsense server hosted on Hetzner
- A client server that is currently connected to the OPNsense LAN
Changing the LAN IPv4 DHCP on OPNsense
To change the LAN IPv4 DHCP on OPNsense, follow these steps:
- Log in to the OPNsense web interface.
- Navigate to
Services > DHCPv4. - Click on the
Editbutton next to the LAN interface. - Under the
General Configurationsection, change theSubnetto a new, unique IP address range that is not currently in use on your network. - Under the
DHCP Serversection, change theRangeto match the new IP address range you specified in step 4. - Click the
Savebutton to apply the changes.
Making OPNsense Unreachable from the Client Server
Now that you have changed the LAN IPv4 DHCP on OPNsense, the client server will no longer be able to reach OPNsense using the old IP address. To make OPNsense completely unreachable from the client server, you will need to disconnect the client server from the OPNsense LAN and connect it to a different network.
Using OPNsense for Network Access to the Public Network
Once the client server is connected to a different network, you can use OPNsense to provide network access to the public network. To do this, follow these steps:
- Log in to the OPNsense web interface.
- Navigate to
Firewall > NAT. - Click on the
Addbutton to create a new NAT rule. - Under the
Interfacedropdown, select the WAN interface. - Under the
Protocoldropdown, selectTCPandUDP. - Under the
Destinationfield, enter the IP address of the public network. - Under the
Redirect Target IPfield, enter the IP address of the client server. - Click the
Savebutton to apply the changes.
- Changing the LAN IPv4 DHCP on OPNsense will make the OPNsense server unreachable from the client server.
- To use OPNsense for network access to the public network, you will need to disconnect the client server from the OPNsense LAN and connect it to a different network.
- You can then use OPNsense to provide network access to the public network by creating a NAT rule that redirects traffic from the WAN interface to the IP address of the client server.