How to create static IPv6 Routes and rules
Environment
Red Hat Enterprise Linux
Issue
-How to create persistent IPv6 routes
-How to I create persistent IPv6 rules
Resolution
- For an
IPv6route create/etc/sysconfig/network-scripts/route6-<interface>
# cat /etc/sysconfig/network-scripts/route6-ethX
<IPv6 destination/prefix> via <IPv6 gateway> dev <interface>
- For an
IPv6rule create/etc/sysconfig/network-scripts/rule6-<interface>
# cat /etc/sysconfig/network-scripts/rule6-ethX
iif <interface> table X
from <IPv6 ip of interface> table X
Root Cause
/etc/sysconfig/network-scripts/ifup-routes
42 FILES="/etc/sysconfig/network-scripts/route-$1 /etc/sysconfig/network-scripts/route6-$1"
43 if [ -n "$2" -a "$2" != "$1" ]; then
44 FILES="$FILES /etc/sysconfig/network-scripts/route-$2 /etc/sysconfig/network-scripts/route6-$2"
45 fi
46
47 for file in $FILES; do
48 if [ -f "$file" ]; then
49 if grep -Eq '^[[:space:]]*ADDRESS[0-9]+=' $file ; then
50 # new format
51 handle_file $file ${1%:*}
52 else
53 # older format
54 handle_ip_file $file
55 fi
56 fi
57 done
67 FILES="/etc/sysconfig/network-scripts/rule-$1 /etc/sysconfig/network-scripts/rule6-$1"
68 if [ -n "$2" -a "$2" != "$1" ]; then
69 FILES="$FILES /etc/sysconfig/network-scripts/rule-$2 /etc/sysconfig/network-scripts/rule6-$2"
70 fi
71
72 for file in $FILES; do
73 if [ -f "$file" ]; then
74 handle_ip_file $file
75 fi
76 done
SBR
Product(s)
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.