Apache can't change listening ip addr

Rhyknowscerious asked:

I can’t get Apache to listen on a specific IP address.
It’s a local web server, not public.
I’m on CentOS 5.11 using Apache 2.2.
The default configuration httpd.conf works great but only listens to the server’s static ip address 10.0.0.101:80.

I appended Listen 10.0.0.103:80 to the end of the httpd.conf but get the error:

Starting httpd: (99)Cannot assign requested address: make_sock: could not bind to address 10.0.0.103:80

I’m following a tutorial on making a high availability cluster which can be seen at https://www.howtoforge.com/high_availability_heartbeat_centos. If I could only get Apache to start on that address, I’d be golden.

I’m using this old version of CentOS because I’m trying to put old hardware to use instead of junking it.

I looked for 4 hours straight on Google, the CentOS site, and Apache’s site and found no solution.

My answer:


Apache won’t bind to your VIP because it is not configured on any network interface.

To allow this to happen, you need to set a sysctl:

sysctl net.ipv4.ip_nonlocal_bind=1

Apache can then do the bind, but of course no traffic will flow until the VIP is assigned to the machine.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.