ubus call network.interface.wan_6 status | grep -A 3 '"ipv6-prefix":' | grep address | awk '{print $2}' | grep -oE '[0-f]{0,4}\:[0-f]{0,4}\:[0-f]{0,4}\:[0-f]{0,4}'
ip -o addr show dev pppoe-wan scope global dynamic
ip -o addr show dev br-lan scope global dynamic|awk '{print $4}'|awk -F '/' '{print $1}'
获得路由器br-lan口的ipv6,即路由器管理ipv6地址
ip addr show br-lan|grep -A1 'inet6 [^f:]'|sed -nr ':a;N;s#^ +inet6 ([a-f0-9:]+)/.+? scope global .*? va
lid_lft ([0-9]+sec) .*#\2 \1#p;ta'|sort -nr|head -n1|cut -d' ' -f2
最简单的办法
ubus call network.interface.wan_6 status | jsonfilter -e '@["ipv6-address"][0].address'
不用jq的方法
ip addr show br-lan|grep -A1 'inet6 [^f:]'|grep 'inet6'|awk '{print $2}'|awk -F '/' '{print $1}'
使用ifconfig
ifconfig pppoe-wan |grep 'Scope:Global'| awk '/inet6/{print $3}'|awk -F '/' '{print $1}'