What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Nat-64 on Asuswrt?

Interested in see the script if you can post it
Sure..

Code:
#!/bin/sh

rtr_pref6=$(nvram get ipv6_prefix)
rtr_ipaddr=$(nvram get lan_ipaddr_rt)
tayga_conf='/jffs/configs/tayga/default.conf'
map_file='/tmp/db/tayga/dynamic.map'
wkp='64:ff9b::/96'

# NOTE: Only run this script when your PPPoE connection is UP.
# You can verify with the commands: ifconfig br0 && ifconfig ppp0 && ping6 dns.google

case "$1" in
  start)
    ## Setup tayga configuration
    touch $tayga_conf
    echo "tun-device nat64" > $tayga_conf
    echo "ipv4-addr 10.64.64.1" >> $tayga_conf    
    echo "prefix $wkp" >> $tayga_conf    
    echo "ipv6-addr ${rtr_pref6}64" >> $tayga_conf
    echo "dynamic-pool 10.64.64.0/24" >> $tayga_conf
    echo "data-dir /tmp/db/tayga" >> $tayga_conf
    ## The 'ipv4-addr' and 'dynamic-pool' are different addresses. They are _NOT_ the same as your LAN addresses.
    ## For 'ipv4-addr' and 'dynamic-pool', you can assign a separate network address that is not in used by anything.

    # configure tun interface
    echo "=== Making tun device: nat64"
    tayga --mktun
    ip addr flush nat64
    ip link set nat64 up

    ip a a ${rtr_ipaddr} dev nat64 # this must be the same as your LAN IP address.
    ip r a 10.64.64.0/24 dev nat64

    ip -6 a a ${rtr_pref6}64 dev nat64 # this is a separate address taken from your /64 DHCPv6-PD prefix.
    ip -6 r d $wkp
    ip -6 r a $wkp dev nat64

    # Add this rule at the top of the FORWARD chain or else NAT64 traffic will get blocked by the last DROP rule.
    iptables -I FORWARD -i nat64 -j ACCEPT

    # Start Tayga
    tayga -c $tayga_conf
    ;;
  stop)
    killall tayga
    iptables -D FORWARD -i nat64 -j ACCEPT
    ip addr flush nat64
    ip link del nat64
    # clear nat64 dynamic map
    [ -s $map_file ] && rm $map_file
    [ -f $tayga_conf ] && rm -f $tayga_conf
    ;;
  *)
    echo "Usage: $0: < start | stop >"
    exit 1
    ;;
esac
exit 1
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top