How to Manually Configure IPv6 Link-Local Addresses on Debian 7: Kernel Behavior and Workarounds


2 views

In Debian 7 (Wheezy), IPv6 link-local addresses (LLA) are automatically generated by the kernel when an interface is brought up, provided there's physical link detection. The address follows the standard fe80::/64 format derived from the interface's MAC address using EUI-64 conversion.

# Typical autogenerated LLA you'll see in ifconfig:
inet6 addr: fe80::a00:27ff:fed0:4d41/64 Scope:Link

The kernel requires carrier detection (physical link) before assigning an LLA. This explains why interfaces without connected cables won't automatically get IPv6 LLAs. You can verify link status with:

ip link show eth0
# Look for "state UP" and "LOWER_UP" in the output

When you need to force an LLA assignment regardless of link state:

Method 1: Using iproute2

ip addr add fe80::1/64 dev eth0 scope link
# Verify with:
ip -6 addr show dev eth0

Method 2: Using ifconfig (legacy)

ifconfig eth0 inet6 add fe80::1/64

For static configurations, add to /etc/network/interfaces:

iface eth0 inet6 static
    address fe80::1
    netmask 64
    scope link

To programmatically generate an EUI-64 address from MAC (useful for scripts):

#!/bin/bash
MAC=$(cat /sys/class/net/eth0/address)
IPV6_LLA=$(echo $MAC | awk -F: '{printf "fe80::%02x%s:%sff:fe%s:%s%s/64", \
           (("0x"$1)^2),$2,$3,$4,$5,$6}')
ip addr add $IPV6_LLA dev eth0 scope link
  • Check dmesg for interface up/down events
  • Confirm IPv6 is enabled: sysctl net.ipv6.conf.all.disable_ipv6
  • Test connectivity: ping6 -I eth0 ff02::1%eth0

In Debian 7 (Wheezy), IPv6 link-local addresses (LLA) are automatically generated when an interface is brought up using either:

ip link set dev ethX up
# or
ifconfig ethX up

The kernel automatically creates an LLA following RFC 4862 standards, which uses the interface's MAC address to form the address in the fe80::/64 scope (e.g., fe80::a00:27ff:fed0:4d41/64).

Several scenarios can prevent automatic LLA assignment:

1. No physical link/carrier detected (unplugged cable)
2. Interface lacks MAC address (virtual interfaces)
3. IPv6 completely disabled in sysctl:
   net.ipv6.conf.all.disable_ipv6=1
   net.ipv6.conf.default.disable_ipv6=1

For static interfaces without DHCP or physical links, use these alternatives:

Method 1: ip command

# Add temporary LLA (won't persist after reboot)
ip addr add fe80::1/64 dev eth0 scope link

# Verify
ip -6 addr show eth0

Method 2: ifconfig

ifconfig eth0 inet6 add fe80::2/64

Method 3: Persistent Configuration

Edit /etc/network/interfaces:

iface eth0 inet6 static
    address fe80::3/64
    scope link

For scripts that need MAC-based addresses:

#!/bin/bash
MAC=$(cat /sys/class/net/eth0/address)
IPV6_LLA=$(ipv6calc --in prefix+mac --action prefixmac2ipv6 \
           fe80::/64 ${MAC})
ip addr add ${IPV6_LLA}/64 dev eth0 scope link
  • Check interface status: ip link show eth0 (look for "UP" state)
  • Verify carrier detection: ethtool eth0 | grep -i "link detected"
  • Test connectivity: ping6 -I eth0 ff02::1%eth0 (all nodes multicast)

Control LLA generation behavior:

# Allow duplicate address detection (DAD) attempts
sysctl -w net.ipv6.conf.eth0.dad_transmits=3

# Disable automatic LLA generation (not recommended)
sysctl -w net.ipv6.conf.eth0.addr_gen_mode=0