Configure static IP given by ISP

My ISP has the option to have a public static IP that can be accessed from outside, for people who would like to run a server at home.
I have a server that sits behind OpenWrt, which I would like to access from this IP.

After signing up for this option, the ISP gave me the following information:

  • Static IP address
  • Subnet IP address
  • Gateway IP address
  • 3 DNS IP addresses

How can I configure OpenWrt for this purpose?
I already know how to route the traffic internally from the router to the server, so I'm just asking for the configuration of the public IP.

Depends on the approach. One option is to route the public subnet in your LAN or create a DMZ interface.
The other approach is to use private IPs inside and do DNAT/SNAT.

Can you explain that a little bit more?

  • In Network -> DHCP and DNS -> Static leases:
    Created a static DHCP lease bound to the server's MAC address, so the server has a static local 192.168.x.x IP.

  • In Firewall -> Port forwards:
    All incoming traffic from WAN port 80 routed to local server's IP address, port 80. Same with port 443.

This was working with my previous ISP. I could access my server's HTTP server from outside like this - no extra configuration.

Change the wan protocol from dhcp to static. Configure your public IP, ISP gateway, netmask / subnet and ISP DNS servers all in wan.

As far as port forwards and configuring your LAN it is the same as with a dynamic public IP, except that you know the public IP will not change.

Thanks, can you give me a hand with this? I could do with a bit more details :slight_smile:

The IP address, gateway, and DNS are one-for one the corresponding settings in LuCI. By "subnet" I assume the ISP gave you a netmask like '255.255.252.0' That would go on the netmask line.

OK thanks, I got it.
The relevant configuration resides in Network -> Interfaces -> WAN -> Edit