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.
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.
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.