DD-WRT IPv6 туннель в UA-IX от Нетассист-а
Рубрики Системное Администрирование в Сен.06, 2012
Ниже чистодраный стартовый скрипт для DD-WRT на базе этого:
IPv6 setup Hurricane Electric Tunnel Broker
Только для сервиса:
IPv6 туннель в UA-IX от Нетассист-а
#*************************** #Settings start here #*************************** #basic connection settings SERVER_IP4_ADDR="62.205.132.12" CLIENT_IPV6_ADDR="ВАШ IPV6 Адрес/64" ## Ниже ИМЕННО ./64 а не ./48 radvd понимает только /64 ROUTED_64_ADDR="ВАШ ROUTED IPV6::/64" #account info to auto update endpoint USERID="ВАШ EMAIL" PASSWD="ВАШ ПАРОЛЬ" #####Optional/Advanced Settings###### #IPv6 OpenDNS IPv6 Resolver ENABLE_OPENDNS_IPV6_DNS=0 #WAN IP Source settings #Set below to 1 to use internal NVRAM wan address instead of fetching it from a site USE_NVRAM_WAN_ADDR_INSTEAD=1 WAN_IP_SOURCE_ADDR="http://automation.whatismyip.com/n09230945.asp" #logging settings (set to /dev/null for no logging) STARTUP_SCRIPT_LOG_FILE="/tmp/ipv6.log" CRON_STATUS_LOG_FILE="/tmp/lastNAUpdate.log" #Enable this to generate a .wanup script to automatically update local tunnel endpoint address on wan change ENABLE_WANUP_SCRIPT=1 WANUP_SCRIPT_FILE_PATH="/tmp/etc/config/tunnelUpdate.wanup" #Generated files paths CRON_JOB_FILE="/tmp/report.sh" RADVD_CONFIG="/tmp/radvd.conf" #*************************** #Settings end here #*************************** echo "" >> $STARTUP_SCRIPT_LOG_FILE echo "NA IPv6 Script started" >> $STARTUP_SCRIPT_LOG_FILE insmod ipv6 sleep 10 echo `date` >> $STARTUP_SCRIPT_LOG_FILE #cut out the "/64" if user typed it in ROUTED_64_ADDR=`echo $ROUTED_64_ADDR|cut -f1 -d/` SERVER_IP4_ADDR=`echo $SERVER_IP4_ADDR|cut -f1 -d/` CLIENT_IPV6_ADDR=`echo $CLIENT_IPV6_ADDR|cut -f1 -d/` echo "User added addresses cleaned/checked" >> $STARTUP_SCRIPT_LOG_FILE #get wan ip for our own use if [ $USE_NVRAM_WAN_ADDR_INSTEAD -eq 1 ] then echo "Fetching WAN IP from NVRAM" >> $STARTUP_SCRIPT_LOG_FILE WANIP=$(nvram get wan_ipaddr); else echo "Fetching WAN IP from External Site: " $WAN_IP_SOURCE_ADDR >> $STARTUP_SCRIPT_LOG_FILE WANIP=`wget $WAN_IP_SOURCE_ADDR -O - 2>/dev/null` fi echo "External IP detected as:" $WANIP >> $STARTUP_SCRIPT_LOG_FILE if [ -n $WANIP ] then echo "configuring tunnel" >> $STARTUP_SCRIPT_LOG_FILE #update NA endpoint echo -e wget -q "http://tb.netassist.ua/autochangeip.php?l=$USERID&p=$PASSWD&ip=$WANIP" -O $CRON_STATUS_LOG_FILE >>$CRON_JOB_FILE chmod +x $CRON_JOB_FILE echo "Cron script created, sending endpoint update request to NA" >> $STARTUP_SCRIPT_LOG_FILE etime=`date +%s` wget -q "http://tb.netassist.ua/autochangeip.php?l=$USERID&p=$PASSWD&ip=$WANIP" -O /tmp/wget.tmp.$etime cat /tmp/wget.tmp.$etime >> $STARTUP_SCRIPT_LOG_FILE echo "" >> $STARTUP_SCRIPT_LOG_FILE rm /tmp/wget.tmp.$etime # The following commands are straight from HE's website ip tunnel add na-ipv6 mode sit remote $SERVER_IP4_ADDR local $WANIP ttl 255 ip link set na-ipv6 up ip addr add $CLIENT_IPV6_ADDR/64 dev na-ipv6 ip route add ::/0 dev na-ipv6 ip -f inet6 addr TEMP_ADDR=`echo $ROUTED_64_ADDR'1'` # These commands aren't on HE's website, but they're necessary for the tunnel to work ip -6 addr add $TEMP_ADDR/48 dev br0 ip route add 2000::/3 dev na-ipv6 #Enable IPv6 forwarding echo 1 > /proc/sys/net/ipv6/conf/all/forwarding # make sure to accept proto-41 #iptables -I INPUT 2 -p ipv6 -i vlan1 -j ACCEPT #make sure to not NAT proto-41 iptables -t nat -A POSTROUTING --proto ! 41 -o eth0 -j MASQUERADE echo "creating radvd conf" >> $STARTUP_SCRIPT_LOG_FILE if [ $ENABLE_OPENDNS_IPV6_DNS -eq 1 ] then echo "Open DNS ipv6 enabled" >> $STARTUP_SCRIPT_LOG_FILE echo "nameserver 2620:0:ccc::2" >> /tmp/resolv.dnsmasq echo "nameserver 2620:0:ccd::2" >> /tmp/resolv.dnsmasq fi #generate wanup script if [ $ENABLE_WANUP_SCRIPT -eq 1 ] then echo "WANUP script being generated" >> $STARTUP_SCRIPT_LOG_FILE dirname $WANUP_SCRIPT_FILE_PATH | xargs mkdir echo 'echo "WANUP script triggered on `date`" >>' $STARTUP_SCRIPT_LOG_FILE > $WANUP_SCRIPT_FILE_PATH if [ $USE_NVRAM_WAN_ADDR_INSTEAD -eq 1 ] then echo -e 'WANIP=$(nvram get wan_ipaddr);' >> $WANUP_SCRIPT_FILE_PATH else echo -e 'WANIP=`wget $WAN_IP_SOURCE_ADDR -O - 2>/dev/null`' >> $WANUP_SCRIPT_FILE_PATH fi echo -e wget -q 'http://tb.netassist.ua/autochangeip.php?l=$USERID&p=$PASSWD&ip=$WANIP' >> $WANUP_SCRIPT_FILE_PATH echo 'ip tunnel change na-ipv6 local $WANIP'>> $WANUP_SCRIPT_FILE_PATH chmod +x $WANUP_SCRIPT_FILE_PATH fi #creating radvd.conf echo "#generated by startup script" > $RADVD_CONFIG echo "interface br0 {" >> $RADVD_CONFIG echo "AdvSendAdvert on;" >> $RADVD_CONFIG echo "prefix "$ROUTED_64_ADDR"/64 {" >> $RADVD_CONFIG echo "AdvOnLink on;" >> $RADVD_CONFIG echo "AdvAutonomous on;" >> $RADVD_CONFIG echo "AdvRouterAddr on;" >> $RADVD_CONFIG echo "};" >> $RADVD_CONFIG echo "};" >> $RADVD_CONFIG echo "starting radvd" >> $STARTUP_SCRIPT_LOG_FILE radvd -C $RADVD_CONFIG -m none & fi
Декабрь 4th, 2012 | 18:03
Здравствуйте!Как с Вами можно связаться !?У меня к Вам пару коротких вопросов…