Merge pull request #6292 from manuelbuil/netplan-ubuntu-gw

Add the gateway parameter in netplan
pull/6334/head
Manuel Buil 2022-10-26 12:02:23 +02:00 committed by GitHub
commit 5063821ec4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -12,13 +12,16 @@ sysctl -w net.ipv6.conf.eth1.forwarding=0
if [ -z "${os##*ubuntu*}" ]; then if [ -z "${os##*ubuntu*}" ]; then
netplan set ethernets.eth1.accept-ra=false netplan set ethernets.eth1.accept-ra=false
netplan set ethernets.eth1.addresses=["$ip4_addr"/24,"$ip6_addr"/64] netplan set ethernets.eth1.addresses=["$ip4_addr"/24,"$ip6_addr"/64]
netplan set ethernets.eth1.gateway6="$ip6_addr_gw"
netplan apply netplan apply
elif [ -z "${os##*alpine*}" ]; then elif [ -z "${os##*alpine*}" ]; then
iplink set eth1 down iplink set eth1 down
iplink set eth1 up iplink set eth1 up
ip -6 addr add "$ip6_addr"/64 dev eth1 ip -6 addr add "$ip6_addr"/64 dev eth1
ip -6 r add default via "$ip6_addr_gw"
else else
ip -6 addr add "$ip6_addr"/64 dev eth1 ip -6 addr add "$ip6_addr"/64 dev eth1
ip -6 r add default via "$ip6_addr_gw"
fi fi
ip addr show dev eth1 ip addr show dev eth1
ip -6 r add default via "$ip6_addr_gw" ip -6 r