Use "ip addr" instead of "ip addres" or "ip a".
Signed-off-by: Nick Hainke <vincent@systemli.org>
wg_interfaces=$(ip link | grep wg | awk '{print $2}' | sed 's/://')
for phy in $wg_interfaces; do
- linklocal=$(ip -6 a list dev $phy | grep "scope link" | awk '{print $2}' | sed 's/\/64//') 2>/dev/null
+ linklocal=$(ip -6 addr list dev $phy | grep "scope link" | awk '{print $2}' | sed 's/\/64//') 2>/dev/null
ips=$(ping ff02::1%$phy -w5 -W5 -c10 | awk '/from/{print($4)}' | sed 's/.$//') 2>/dev/null
delete=1
for ip in $ips; do
ip link add dev $ifname type wireguard
- ip -6 a a dev $ifname $client_ip
- ip -6 a a dev $ifname fe80::2/64
+ ip -6 addr add dev $ifname $client_ip
+ ip -6 addr add dev $ifname fe80::2/64
wg set $ifname listen-port $port private-key $privkey peer $pubkey allowed-ips 0.0.0.0/0,::0/0 endpoint "${endpoint}:${gw_port}"
ip link set up dev $ifname
ip link set mtu $mtu_client dev $ifname # configure mtu here!
# create wg tunnel
ip link add dev $ifname type wireguard
wg set $ifname listen-port $port private-key $gw_key peer $public_key allowed-ips 0.0.0.0/0,::0/0
- ip -6 address add $gw_ip_assign dev $ifname
- ip -6 address add fe80::1/64 dev $ifname
+ ip -6 addr add $gw_ip_assign dev $ifname
+ ip -6 addr add fe80::1/64 dev $ifname
v4prefix=$(uci get wgserver.@server[0].base_v4prefix)
if [ $? -eq 0 ]; then
gw_ipv4=$(owipcalc $v4prefix add $offset next 32) # gateway ip
gw_ipv4_assign="${gw_ipv4}/32"
- ip address add $gw_ipv4_assign broadcast 255.255.255.255 dev $ifname
+ ip addr add $gw_ipv4_assign broadcast 255.255.255.255 dev $ifname
fi
ip link set up dev $ifname