Created
August 13, 2014 07:42
-
-
Save RPDiep/7b01ba851df85525acd9 to your computer and use it in GitHub Desktop.
A script to label the secondary ipv6 addresses differently, thus making the first ipv6 the default for outgoing connections
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ETH=$(ip -6 r | awk '/^default/ {print $5}') | |
for IP in $(awk -F '=' '/IPV6ADDR_SECONDARIES/ {gsub("\"",""); gsub("/[0-9]*","/128"); print $2}' /etc/sysconfig/network-scripts/ifcfg-${ETH}) | |
do | |
ip addrlabel add prefix ${IP} label 1001 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In CentOS6, you can run this script after network startup by adding it in /sbin/ifup-local