How to Assign a Static IPv6 Address

Introduction

Assigning a static IPv6 address gives your device a permanent, unchanging network identifier. Unlike dynamic addresses that change periodically, static IPv6 addresses remain constant, making them essential for servers, network infrastructure, and services that need reliable accessibility. This guide covers when to use static addressing, how to configure it across different platforms, and best practices to avoid common pitfalls.

When to Use Static vs Dynamic IPv6 Addresses

Static IPv6 Addresses Are Best For:

Dynamic Addressing ([SLAAC](slaac-explained) or [DHCPv6](configure-dhcpv6)) Is Better For:

Important Note: Android devices don't support DHCPv6, so if you need dynamic addressing for Android clients, you must use SLAAC (Stateless Address Autoconfiguration).

Understanding IPv6 Address Structure

Before configuring static addresses, understand IPv6 address components:

All IPv6 subnets must use a /64 prefix length. This is a fundamental requirement of IPv6 architecture - using any other prefix length breaks many IPv6 features including SLAAC and privacy extensions.

Configuring Static IPv6 on Windows

Method 1: Control Panel (All Windows Versions)

  1. Open Control Panel > Network and Internet > Network and Sharing Center
  2. Click Change adapter settings in the left panel
  3. Right-click your network adapter and select Properties
  4. Select Internet Protocol Version 6 (TCP/IPv6) and click Properties
  5. Choose Use the following IPv6 address
  6. Enter your configuration:
    • IPv6 Address: Your static address (e.g., 2001:db8:1234:5678::10)
    • Subnet Prefix Length: Typically 64
    • Default Gateway: Your router's IPv6 address (e.g., 2001:db8:1234:5678::1)
  7. Configure DNS servers:
    • Preferred DNS Server: (e.g., 2001:4860:4860::8888 for Google DNS)
    • Alternate DNS Server: (e.g., 2001:4860:4860::8844)
  8. Click OK to apply settings

Method 2: Windows Settings App (Windows 10/11)

  1. Open Settings > Network & Internet
  2. Click on your active connection (Ethernet or Wi-Fi)
  3. Click Properties
  4. Under IP settings, click Edit
  5. Change dropdown to Manual
  6. Enable the IPv6 toggle
  7. Fill in your static configuration
  8. Click Save

Method 3: PowerShell Command Line

First, identify your network adapter:

Get-NetAdapter

Note the InterfaceIndex number, then configure the static address:

New-NetIPAddress -InterfaceIndex 10 -IPAddress 2001:db8:1234:5678::10 -PrefixLength 64 -DefaultGateway 2001:db8:1234:5678::1

Configure DNS servers:

Set-DnsClientServerAddress -InterfaceIndex 10 -ServerAddresses ("2001:4860:4860::8888","2001:4860:4860::8844")

Alternatively, use the legacy netsh command:

netsh interface ipv6 set address "Ethernet" 2001:db8:1234:5678::10
netsh interface ipv6 add dnsserver "Ethernet" address=2001:4860:4860::8888

Configuring Static IPv6 on Linux

Ubuntu/Debian Using Netplan

Modern Ubuntu systems use Netplan for network configuration. Edit /etc/netplan/01-netcfg.yaml:

network:
  version: 2
  ethernets:
    eth0:
      dhcp4: true
      dhcp6: no
      addresses:
        - 2001:db8:1234:5678::10/64
      routes:
        - to: ::/0
          via: 2001:db8:1234:5678::1
      nameservers:
        addresses:
          - 2001:4860:4860::8888
          - 2001:4860:4860::8844

Apply the configuration:

sudo netplan apply

Red Hat/CentOS/Rocky Linux

Edit /etc/sysconfig/network-scripts/ifcfg-eth0:

IPV6INIT=yes
IPV6ADDR=2001:db8:1234:5678::10/64
IPV6_DEFAULTGW=2001:db8:1234:5678::1
DNS1=2001:4860:4860::8888
DNS2=2001:4860:4860::8844

Restart networking:

sudo systemctl restart NetworkManager

Using NetworkManager Command Line

nmcli con mod "Wired connection 1" ipv6.method manual \
  ipv6.addresses "2001:db8:1234:5678::10/64" \
  ipv6.gateway "2001:db8:1234:5678::1" \
  ipv6.dns "2001:4860:4860::8888,2001:4860:4860::8844"
nmcli con up "Wired connection 1"

Static Interface Identifier (IID) with [SLAAC](slaac-explained)

If you want to use SLAAC for the prefix but maintain a static host portion, you can configure an IPv6 token. This creates a predictable address while still benefiting from dynamic prefix updates:

sudo nmcli connection modify "Wired connection 1" ipv6.token ::10

This will create addresses like 2001:db8:1234:5678::10 regardless of the prefix advertised by your router.

Configuring Static IPv6 on macOS

Method 1: System Preferences GUI

  1. Open System Preferences > Network
  2. Select your active network interface (Ethernet or Wi-Fi)
  3. Click Advanced
  4. Go to the TCP/IP tab
  5. For Configure IPv6, select Manually
  6. Enter your configuration:
    • IPv6 Address: Your static address
    • Router: Gateway address (optional, usually provided by Router Advertisements)
    • Prefix Length: Typically 64
  7. Switch to the DNS tab and add DNS servers
  8. Click OK, then Apply

Method 2: Command Line

sudo networksetup -setv6manual "Ethernet" 2001:db8:1234:5678::10 64 2001:db8:1234:5678::1
sudo networksetup -setdnsservers "Ethernet" 2001:4860:4860::8888 2001:4860:4860::8844

Note on macOS Addressing: By default, macOS uses stable addresses based on the MAC address with privacy extensions disabled. The address marked as "global dynamic" in the interface will remain constant unless you change network hardware or networks, effectively serving as a static address for most purposes.

Router and Gateway Static IPv6 Configuration

Residential Router Setup

Most home routers provide a web interface for IPv6 configuration:

  1. WAN Configuration: If your ISP provides static IPv6:

    • Select "Static IPv6" as the connection type
    • Enter the IPv6 address and prefix provided by your ISP (often /64 for WAN, /48 or /56 for delegation)
    • Set the default gateway (usually provided by ISP)
    • Configure DNS servers
  2. LAN Configuration: Assign IPv6 to your local network:

    • If you received a /48 or /56 from your ISP, divide it into multiple /64 subnets
    • Assign one /64 subnet to each LAN interface
    • Configure Router Advertisement (RA) to advertise the prefix to clients
    • Optionally enable DHCPv6 for managed addressing

Example: Assigning from a /56 Delegation

If your ISP delegates 2001:db8:1200::/56, you can create 256 /64 subnets:

Static Routes

For advanced routing scenarios, configure static IPv6 routes:

Cisco/Network Equipment:

ipv6 route 2001:db8:2000::/48 2001:db8:1234:5678::2

Linux:

sudo ip -6 route add 2001:db8:2000::/48 via 2001:db8:1234:5678::2

Windows PowerShell:

New-NetRoute -DestinationPrefix "2001:db8:2000::/48" -NextHop "2001:db8:1234:5678::2" -InterfaceIndex 10

DNS Configuration Considerations

Configuring IPv6 DNS Servers

Popular public IPv6 DNS servers:

Creating DNS Records for Static IPv6 Addresses

When running a server with a static IPv6 address, create AAAA records in your DNS zone:

www.example.com.    IN    AAAA    2001:db8:1234:5678::10
mail.example.com.   IN    AAAA    2001:db8:1234:5678::20

Reverse DNS (PTR Records)

For server deployments, configure reverse DNS. IPv6 reverse DNS uses the ip6.arpa domain. For 2001:db8:1234:5678::10, the reverse zone would be:

0.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.7.6.5.4.3.2.1.8.b.d.0.1.0.0.2.ip6.arpa. IN PTR server.example.com.

Contact your ISP or hosting provider to configure reverse DNS records.

Avoiding Conflicts with [SLAAC](slaac-explained)

SLAAC (Stateless Address Autoconfiguration) automatically assigns IPv6 addresses based on Router Advertisements. When using static addresses, follow these guidelines to prevent conflicts:

Best Practices

  1. Reserve Static Address Range: Use the upper portion of your /64 subnet for static addresses:

    • SLAAC/Dynamic: 2001:db8:1234:5678::/64 (lower addresses)
    • Static assignments: 2001:db8:1234:5678::ff00/120 to ::ffff (upper addresses)
  2. Disable SLAAC on Static Devices:

    • When manually configuring, ensure SLAAC is disabled on the interface
    • On Linux, set ipv6.method manual in NetworkManager
    • On Windows, the static configuration automatically takes precedence
  3. Configure DHCPv6 Exclusions: If running DHCPv6, exclude your static address range from the DHCP pool

  4. Document Static Assignments: Maintain an inventory of static addresses to prevent accidental conflicts

  5. Use Unique Interface Identifiers: Don't use common patterns like ::1 (reserved for loopback), ::2, ::3 for static hosts - these might conflict with SLAAC-generated addresses

Coexistence Strategy

Many networks successfully run both SLAAC and static addressing:

Server and Infrastructure Use Cases

Web Server Example

Configuring a web server with static IPv6:

  1. Assign Static Address: 2001:db8:1234:5678::80 (::80 suggests HTTP service)
  2. Create DNS AAAA Record: Point domain to the IPv6 address
  3. Configure Firewall: Allow inbound TCP port 80 and 443
  4. Configure Web Server: Ensure it binds to both IPv4 and IPv6 addresses

Apache Configuration:

Listen [2001:db8:1234:5678::80]:80
Listen [2001:db8:1234:5678::80]:443

Nginx Configuration:

listen [2001:db8:1234:5678::80]:80;
listen [2001:db8:1234:5678::80]:443 ssl;

SSH Server Configuration

For remote administration servers:

  1. Assign a memorable static IPv6 address
  2. Configure /etc/ssh/sshd_config:
ListenAddress ::
AddressFamily any
  1. Update firewall rules to allow SSH on IPv6
  2. Create AAAA record if using DNS

Database Server

Database servers benefit from static addressing for application configuration:

  1. Assign static IPv6 address to database server
  2. Configure database to listen on IPv6:
    • PostgreSQL: Set listen_addresses = '*' in postgresql.conf
    • MySQL: Ensure bind-address supports :: or specific IPv6 address
  3. Update application connection strings to use IPv6 addresses or dual-stack DNS names

Container and VM Infrastructure

For Docker, Kubernetes, or virtual machine environments:

  1. Assign static IPv6 to host systems
  2. Configure container networks with IPv6 support
  3. Use static addressing for service discovery and load balancing
  4. Document IPv6 allocation scheme for orchestration

Verifying Your IPv6 Configuration

After configuring your static IPv6 address, verify connectivity:

Command-Line Testing

Check Interface Configuration:

# Linux
ip -6 addr show

# macOS/BSD
ifconfig

# Windows
ipconfig

Test Connectivity:

# Ping Google's IPv6 DNS
ping6 2001:4860:4860::8888

# Trace route
traceroute6 google.com

# Test DNS resolution
nslookup -type=AAAA google.com

Web-Based Testing

Visit test-ipv6.run for comprehensive IPv6 connectivity testing. This tool will:

The site runs all tests directly in your browser, providing immediate feedback on your IPv6 configuration quality.

Troubleshooting Common Issues

Address Not Reachable

DNS Not Working

Conflicts with SLAAC

No Default Gateway

Conclusion

Static IPv6 addressing is essential for servers, infrastructure, and services requiring consistent network identity. While dynamic addressing with SLAAC or DHCPv6 works well for client devices, static configuration provides the reliability needed for production services.

By following platform-specific configuration steps, avoiding SLAAC conflicts, and properly configuring DNS, you can successfully deploy static IPv6 addressing in any environment. Always verify your configuration with testing tools like test-ipv6.run to ensure full connectivity and optimal performance.

Remember that IPv6 is designed to coexist with IPv4 in dual-stack configurations, so maintaining both protocols during the transition period is recommended for maximum compatibility.