Skip to content

Instantly share code, notes, and snippets.

@aw
Created June 5, 2011 08:38
Show Gist options
  • Save aw/1008793 to your computer and use it in GitHub Desktop.
Save aw/1008793 to your computer and use it in GitHub Desktop.
Simple ip_nonlocal_bind IPv6 workaround
#! /bin/sh
#
## Tested on Linux Debian 5.0 (Lenny)
#
# OK I know this is nothing new/special.
# If you've always configured your LBs a certain way, you might have to use this method instead.
#
# Scenario: High-availability setup with 2 HAProxy/Keepalived load-balancers on IPv6
#
# Problem: HAProxy won't start (cannot bind socket) because the virtual IPv6 address is not assigned
#
# With IPv4, you can set the sysctl parameter: net.ipv4.ip_nonlocal_bind=1
#
# Solution: configure the floating/virtual IPv6 address on the LOOPBACK interface
#
# Example:
/sbin/ip -6 addr add 2001:db8::ffff:1/64 dev lo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment