Fix lxc-system-manage ipv6 setup
When the lxc-dnsmasq service is restarted while ipv6 is active, it will always fail to restart because the ip -6 addr add command fails due to the address already existing on the interface. ex. Apr 01 22:39:48 lsn-mc1009 systemd[1]: Starting lxc dnsmasq service... Apr 01 22:39:48 lsn-mc1009 lxc-system-manage[19134]: Creating LXC IPtables rules. Apr 01 22:39:48 lsn-mc1009 lxc-system-manage[19134]: RTNETLINK answers: File exists Apr 01 22:39:48 lsn-mc1009 systemd[1]: lxc-dnsmasq.service: Control process exited, code=exited status=2 Apr 01 22:39:48 lsn-mc1009 systemd[1]: Failed to start lxc dnsmasq service. Apr 01 22:39:48 lsn-mc1009 systemd[1]: lxc-dnsmasq.service: Unit entered failed state. Apr 01 22:39:48 lsn-mc1009 systemd[1]: lxc-dnsmasq.service: Failed with result 'exit-code'. Apr 01 22:39:50 lsn-mc1009 systemd[1]: lxc-dnsmasq.service: Service hold-off time over, scheduling restart. Change-Id: Ia3ebaf2125a00c4031f50bf03b60dd5659f9d660
This commit is contained in:
parent
0b4558baeb
commit
1871fbec7b
@ -95,7 +95,7 @@ function add_rules {
|
||||
if [ -n "$LXC_IPV6_ADDR" ] && [ -n "$LXC_IPV6_MASK" ] && [ -n "$LXC_IPV6_NETWORK" ]; then
|
||||
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
|
||||
echo 0 > /proc/sys/net/ipv6/conf/${LXC_BRIDGE}/autoconf
|
||||
ip -6 addr add dev ${LXC_BRIDGE} ${LXC_IPV6_ADDR}/${LXC_IPV6_MASK}
|
||||
ip -6 addr add dev ${LXC_BRIDGE} ${LXC_IPV6_ADDR}/${LXC_IPV6_MASK} || true
|
||||
if [ "$LXC_IPV6_NAT" = "true" ]; then
|
||||
ip6tables $USE_IPTABLES_LOCK -t nat -A POSTROUTING -s ${LXC_IPV6_NETWORK} ! -d ${LXC_IPV6_NETWORK} -j MASQUERADE
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user