Using a Public IP, Floating IP, Static IP not tied to box

If you’re concerned about using ephemeral IPs, and have reserved a static IP from your provider (sometimes called floating IPs, elastic IPs, etc), the odds are your MIAB does not see it, and yells at you.

  1. use floating IP on ‘glue records’ / global dns
  2. set the PRIVATE network interface to be the gateway for outbound traffic. Digital ocean command below
  3. rerun mailinabox and you’ll get a prompt to enter the public IP. Replace the node’s IP with your static IP.

That’s it! config will detect the network card as private, show private and public IPs, and stop yelling at you in status checks.

# BOO Wrong IP
root@box:~# ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p'
165.227.38.99
# grab private gateway IP (likely 10.10.x.x) and set as default gateway
curl -s http://169.254.169.254/metadata/v1/inr_ipv4/gateway | xargs route add default gw
# YAY correct private IP
root@box:~# ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p'
10.17.0.5
#Yay now all apps use correct outbound rout, and internet sees our floating IP
root@box:~# curl 'https://api.ipify.org?format=json'
{"ip":"138.197.58.21"}

Regardless of provider, MIAB will see both IPs correctly once default gateway route add default gw [IP] is set.

Primary Hostname: box.example.com
Public IP Address: 138.197.58.21
Private IP Address: 10.17.0.5
Mail-in-a-Box Version:  v55

Hope that’s helpful to anyone else who runs into this issue!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.