Why and when to use Port Forwarding?
For setting up a Spotipo captive portal with UniFi controllers, Port forwarding is necessary as it directs traffic from your public IP address to your UniFi controller using its private IP address and port number.
Setting up static IP address for UniFi controller?
Find the Device's MAC Address:
Go to the UniFi Controller and navigate to UniFi Devices.
Select the device you need to configure. The MAC address will be displayed in the panel on the right.
Router with Graphical Interface:
Log into your router's web interface.
Find the Static IP, DHCP Reservation or similar option (name varies by router).
Add a new entry with the device's MAC address and assign the desired static IP address.
Router with CLI-Based Interface (Example for Cisco IOS):
enable
configure terminal
ip dhcp pool <pool_name>
network <ip address> <mask>
default-router <router_ip>
dns-server <dns-server_ip>
host <ip_address> <mask>
hardware-address <MAC_Address>
exit
write memory
Setting up port forwarding
Prepare Your Router:
Ensure that your UniFi device has a static IP address assigned.
Configure Port Forwarding on Your Router:
Graphical Interface:
Find the Port Forwarding, Port Mapping, Virtual Server, or NAT option (name varies by router).
Add a new rule to forward traffic to the UniFi device's IP address.
Use TCP protocol and port 443 (used by UniFi controllers).
CLI based interface (example for Cisco IOS)
enable
configure terminal
interface <Outside_Interface>
ip nat outside
interface <Inside_Interface>
ip nat inside
ip nat inside source static tcp <UniFi_ip> 443 interface <Outside_Interface> 8080
write memory
Verify the Configuration:
Check that the port forwarding rule is active and working.