标签 自动获取IPv6 下的文章

vi /etc/systemd/system/obtain-ipv6.service

[Unit]
Description=Auto Obtain IPV6 Address
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/obtain-ipv6.sh start
ExecStop=/usr/bin/obtain-ipv6.sh stop
ExecReload=/usr/bin/obtain-ipv6.sh reload

[Install]
WantedBy=multi-user.target

systemctl enable obtain-ipv6.service
vi /usr/bin/obtain-ipv6.sh

#!/bin/bash
if [ $1 == "start" ];then
    dhclient -6 ens3
elif [ $1 == "STOP" ];then
    dhclient -6 -r
elif [ $1 == "reload" ];then
    dhclient -6 -r
    dhclient -6 ens3
fi

chmod u+x /usr/bin/obtain-ipv6.sh