Q. How do I add multiple IPv6 address to eth0 under Red Hat / Fedora / RHEL / CentOS Linux for virtual hosting?
A. There are two ways to add network aliaes under Red hat / CentOS Linux system. You need to edit any one of the following file in order to add IPv6 network alias.
- /etc/rc.local - Use ifconfig command and shell loop.
- /etc/sysconfig/network-scripts/ifcfg-eth0 - Set special variable called IPV6ADDR_SECONDARIES for eth0 virtual hosting (network alias).
First, setup IPv6 main server IP address and default router. Once basic IPv6 connectivity established you can setup aliases for NIC.
/etc/rc.local configuration
To add 2607:f0d0:1002:11::10 to 2607:f0d0:1002:11::50 (total 40) virtual aliases, open /etc/rc.local file, enter:
# vi /etc/rc.local
Append following code:
#IP Alias for ip in {10..40}; do /sbin/ifconfig eth0 inet6 add 2607:f0d0:1002:11::${ip}/64; done
You can type the same command at a shell prompt to immediately activate network aliases. Or create a shell script and call it from /etc/rc.local itself:
#!/bin/bash INETP="2607:f0d0:1002:11::" PRE="64" START=2 END=200 INT_IF="eth0" IFCONFIG=/sbin/ifconfig echo -n "Adding IPv6 Alias..." for i in {$START..$END} do $IFCONFIG $INT_IF inet6 add ${INETP}${i}/${PRE} done echo "Done!"
sysv style configuration
Open network interface configuration file, enter:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Append a list of secondary IPv6 addresses following code (set 5 aliases):
IPV6ADDR_SECONDARIES="2607:f0d0:1002:11::10/64 \ 2607:f0d0:1002:11::11/64 \ 2607:f0d0:1002:11::12/64 \ 2607:f0d0:1002:11::13/64 \ 2607:f0d0:1002:11::14/64"
Save and close the file. Restart networking:
# /etc/init.d/network restart
Test your connectivity using ping6 and other tools:
$ /sbin/ifconfig
$ /sbin/ifconfig eth0 | less
$ ping6 2607:f0d0:1002:11::15
You may need to setup simple or complicated IPv6 firewall.
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- My 10 UNIX Command Line Mistakes
- Linux: 20 Iptables Examples For New SysAdmins

- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
Facebook it - Tweet it - Print it -



{ 3 comments… read them below or add one }
Great Tutorials…………..by Cybetciti !!!
great, especially that for sysv ;-)
while adding ipv6 address to network ,is that prefix length is fixed to 64 or it can be vary?can anyone explain this?please….thanks in advance.