Show Table of Contents
3.7. Turning on Packet Forwarding and Nonlocal Binding
In order for the Keepalived service to forward network packets properly to the real servers, each router node must have IP forwarding turned on in the kernel. Log in as
root and change the line which reads net.ipv4.ip_forward = 0 in /etc/sysctl.conf to the following:
net.ipv4.ip_forward = 1
The changes take effect when you reboot the system.
Load balancing in HAProxy and Keepalived at the same time also requires the ability to bind to an IP address that are nonlocal, meaning that it is not assigned to a device on the local system. This allows a running load balancer instance to bind to an IP that is not local for failover.
To enable, edit the line in
/etc/sysctl.conf that reads net.ipv4.ip_nonlocal_bind to the following:
net.ipv4.ip_nonlocal_bind = 1
The changes take effect when you reboot the system.
To check if IP forwarding is turned on, issue the following command as
root:
/usr/sbin/sysctl net.ipv4.ip_forward
To check if nonlocal binding is turned on, issue the following command as
root:
/usr/sbin/sysctl net.ipv4.ip_nonlocal_bind
If both the above commands return a
1, then the respective settings are enabled.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.