As my ISP doesn't support native IPv6 so I use 6to4 relay. To this I need to configure the following in the router where "184.108.40.206" is my current WAN IP:
As my ISP often change my WAN IP, I need log into the router and configure following lines whet IP changed:
/interface 6to4 add disabled=no local-address=220.127.116.11 mtu=1472 name=6to4 remote-address=18.104.22.168 /ipv6 address add address=2002:0102:0304::1/16 advertise=no disabled=no eui-64=no interface=6to4 add address=2002:0102:0304:1234::1/64 advertise=yes disabled=no eui-64=no interface=bridge1 /ipv6 nd add advertise-dns=yes advertise-mac-address=yes disabled=no hop-limit=unspecified interface=bridge1 managed-address-configuration=\ no mtu=1472 other-configuration=yes ra-delay=3s ra-interval=3m-10m ra-lifetime=1h reachable-time=unspecified \ retransmit-interval=unspecified /ipv6 nd prefix default set autonomous=yes preferred-lifetime=1h valid-lifetime=1d /ipv6 route add disabled=no distance=1 dst-address=2000::/3 gateway=6to4 scope=30 target-scope=10
I tought ROS scripting is the best to do this automaticaly but I didn't find any command in wiki what convert decimal values to hexadecimal.
/interface 6to4 set 0 local-address=22.214.171.124 /ipv6 address set 0 address=2002:0203:0405::1/16 set 1 address=2002:0203:0405:1234::1/64
I made a shell script what takes me the "magic" lines from "new WAN IP" parameter:
This script/solution is very popular in UNIX/Linux communities.
#!/bin/sh echo "/interface 6to4" echo "set 0 local-address=$1" echo "/ipv6 address" V6PREFIX=$(printf '2002:%02x%02x:%02x%02x' $(echo $1 | tr . ' ')) echo "set 0 address=$V6PREFIX::1/16" echo "set 1 address=$V6PREFIX:1234::1/64"
Is there any way to make a script in ROS to get new WAN IP and update the needed lines automaticaly, etc. every 5min?