Skip to content

Commit 9bd0a45

Browse files
committed
ipv6 in new config file
Signed-off-by: BenjiReis <benjamin.reis@vates.fr>
1 parent b9a9397 commit 9bd0a45

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

backend.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,22 +1670,18 @@ def configureNetworking(mounts, admin_iface, admin_bridge, admin_config, hn_conf
16701670
# now we need to write /etc/sysconfig/network
16711671
nfd = open("%s/etc/sysconfig/network" % mounts["root"], "w")
16721672
nfd.write("NETWORKING=yes\n")
1673+
ipv6_conf = open("%s/etc/sysctl.d/91-net-ipv6.conf" % mounts["root"], "w")
16731674
if admin_config.modev6:
16741675
nfd.write("NETWORKING_IPV6=yes\n")
16751676
util.runCmd2(['chroot', mounts['root'], 'systemctl', 'enable', 'ip6tables'])
16761677
for i in ['all', 'default']:
1677-
util.runCmd2(
1678-
['chroot', mounts['root'], 'sed', '-i', ('/^%s /s/=.*$/= 0/' % ('net.ipv6.conf.%s.disable_ipv6' % i)),
1679-
"/etc/sysctl.d/90-net.conf"]
1680-
)
1678+
ipv6_conf.write('net.ipv6.conf.%s.disable_ipv6=0')
16811679
else:
16821680
nfd.write("NETWORKING_IPV6=no\n")
16831681
for i in ['all', 'default']:
1684-
util.runCmd2(
1685-
['chroot', mounts['root'], 'sed', '-i', ('/^%s /s/=.*$/= 1/' % ('net.ipv6.conf.%s.disable_ipv6' % i)),
1686-
"/etc/sysctl.d/90-net.conf"]
1687-
)
1682+
ipv6_conf.write('net.ipv6.conf.%s.disable_ipv6=1')
16881683
netutil.disable_ipv6_module(mounts["root"])
1684+
ipv6_conf.close()
16891685
nfd.write("IPV6_AUTOCONF=no\n")
16901686
nfd.write('NTPSERVERARGS="iburst prefer"\n')
16911687
nfd.close()

0 commit comments

Comments
 (0)