IP for outbound connections is not the server IP

anti-ts

Verified User
Joined
Jan 25, 2014
Messages
42
Hi,

on one DirectAdmin installation only, the IP the system is using for outbound connections is not the server IP, but an extra IP we have added.

For example using this command:
the IP shown is not the server IP, but the extra IP.

The extra IP was added using DirectAdmin (IP management). It is a "shared" IP assigned to a reseller. The IP was added to the same one and only interface as the main IP.
This extra IP is not showing in "ifconfig" output (as expected).

Note: This is the only DirectAdmin installation on RHEL8 based Linux (AlmaLinux in particularly). We run more DirectAdmin systems on CentOS7 where we always get the server IP for outbound connections there, correctly, as expected.

Does anyone know why we don't get the server IP here by default?
Is there any way we can have the system IP without firewall manipulations?


Thank you very much.
 
Last edited:
Answering my own for anyone seeing this:
This was because in RHEL8 (Alma Linux), no outbound IP is defined for default route.
In RHEL7 (Centos 7) it is.

So when extra IPs are added by DirectAdmin on the same interface, and since no src IP address is defined in default route, different outbound IPs are in use.

To fix this we had to see the default route with command ip route:
and then:
Code:
ip route replace default via XXX.XXX.XXX.XXX dev eth0 src YYY.YYY.YYY.YYY

where YYY.YYY.YYY.YYYY is the outbound IP we need to use.

(the "default via XXX.XXX.XXX.XXX. dev eth0" part is exactly as seen in ip route output, so we just add the src IP after that)
 
Back
Top