Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- YETI_DEVICE=eth1
- YETI_SERVICE=2001:4b98:dc2:45:216:3eff:fe4b:8c5b
- YETI_TABLE=Yeti-DNS
- USE_RDISC6=yes
- # Apparently not always done automatically
- ifconfig ${YETI_DEVICE} up
- if [ "${USE_RDISC6}" = "yes" ]; then
- sleep 30
- ROUTER=$(rdisc6 --single ${YETI_DEVICE} | awk '/^ from/ {print $2}')
- else
- # Does not work, ip -6 neigh returns other machines which are not routers
- #ROUTER=$(ping6 -c1 -I ${YETI_DEVICE} ff02::1 > /dev/null; ip -6 neigh | awk "/dev ${YETI_DEVICE}.*router REACHABL
- E/ {print \$1}" | tail -n 1)
- sysctl -w net.ipv6.conf.eth1.accept_ra_defrtr=1
- ROUTER=$(ping6 -c1 -I ${YETI_DEVICE} ff02::1 > /dev/null; ip -6 route | awk "/^default.*dev ${YETI_DEVICE}.*proto r
- a/ {print \$3}" | tail -n 1)
- fi
- if [ -z "${ROUTER}" ]; then
- echo "Cannot find IPv6 router on ${YETI_DEVICE}"
- exit 1
- fi
- if [ "${USE_RDISC6}" != "yes" ]; then
- sysctl -w net.ipv6.conf.eth1.accept_ra_defrtr=0
- fi
- echo 200 ${YETI_TABLE} >> /etc/iproute2/rt_tables
- ip -6 rule add from ${YETI_SERVICE} table ${YETI_TABLE}
- ip -6 route add default via ${ROUTER} dev ${YETI_DEVICE} table ${YETI_TABLE}
- ip -6 route flush cache
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement