Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- RACONF="/etc/radvd.conf"
- tmp=`sudo ifconfig eth1 | grep global | awk -F " " '{ print $2 }'`
- if [ "$tmp" ]; then
- echo "Active IPv6 Prefix found"
- CURRENT_INET6=${tmp::-1}
- fi
- if [ "$CURRENT_INET6" ]; then
- echo $CURRENT_INET6 > ~/CURRENT_INET6
- if [ -f ~/LAST_INET6 ]; then
- LAST_INET6=`cat ~/LAST_INET6`
- if [ "$CURRENT_INET6" != "$LAST_INET6" ]; then
- sed '$d' $RACONF > /var/tmp/radvd.conf
- mv /var/tmp/radvd.conf $RACONF
- echo "Different IPv6 Prefix found"
- echo " prefix "$LAST_INET6"/64 {" >> $RACONF
- echo " AdvOnLink on;" >> $RACONF
- echo " AdvPreferredLifetime 0;" >> $RACONF
- echo " AdvAutonomous on;" >> $RACONF
- echo " AdvValidLifetime 0;" >> $RACONF
- echo " };" >> $RACONF
- echo "};" >> $RACONF
- /etc/init.d/radvd reload
- echo $CURRENT_INET6 > ~/LAST_INET6
- else
- echo "Same prefix as before"
- fi
- else
- echo "Copying..."
- cp ~/CURRENT_INET6 ~/LAST_INET6
- fi
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement