My host has 2 IP addresses. One main (management) IP and one that is used for services and whitelisted. The service IP has no gateway but goes through the gateway of the management IP.
My netplan looks like that:
network:
version: 2
ethernets:
enp7s0:
addresses:
- 93.XX.XX.44/24
- 93.XX.XX.33/27
match:
macaddress: 00:02:c9:4f:b2:4c
mtu: 1500
nameservers:
addresses:
- 1.1.1.1
- 1.0.0.1
routes:
- on-link: true
to: 0.0.0.0/0
via: 93.XX.XX.1
from: 93.XX.XX.33
metric: 100
set-name: enp7s0
So far the host networking works totally fine. IP route shows the following:
default via 93.XX.XX.1 dev enp7s0 proto static src 93.XX.XX.33 metric 100 onlink
So the correct .33 IP is used for network requests. And there is no route with the management IP (which is what I want).
Now, within Docker, if I do curl https://icanhazip.com/
, I see the management IP (.44).
I read a little bit about Docker networking but can't seem to find any way to specifically set routing for Docker Bridge networks. Is there a way to globally (or at least per network) enable routing through a specific IP?