Use systemd-networkd on Archlinux guests

Fixes #11254
This commit is contained in:
Robin Munn 2020-02-15 15:06:51 +07:00
parent 1ef024984b
commit 6671cc6986
4 changed files with 23 additions and 20 deletions

View File

@ -41,10 +41,9 @@ module VagrantPlugins
commands << <<-EOH.gsub(/^ {14}/, '').rstrip
# Configure #{network[:device]}
mv '#{remote_path}' '/etc/netctl/#{network[:device]}' &&
ip link set '#{network[:device]}' down &&
netctl restart '#{network[:device]}' &&
netctl enable '#{network[:device]}'
chmod 0644 '#{remote_path}' &&
mv '#{remote_path}' '/etc/systemd/network/#{network[:device]}.network' &&
networkctl reload
EOH
end

View File

@ -1,4 +1,6 @@
Description='A basic dhcp ethernet connection'
Interface=<%= options[:device] %>
Connection=ethernet
IP=dhcp
[Match]
Name=<%= options[:device] %>
[Network]
Description=A basic DHCP ethernet connection
DHCP=ipv4

View File

@ -1,8 +1,9 @@
Connection=ethernet
Description='A basic static ethernet connection'
Interface=<%= options[:device] %>
IP=static
Address=('<%= options[:ip]%>/<%= options[:netmask] %>')
[Match]
Name=<%= options[:device] %>
[Network]
Description=A basic static ethernet connection
Address=<%= options[:ip]%>/<%= options[:netmask] %>
<% if options[:gateway] -%>
Gateway='<%= options[:gateway] %>'
Gateway=<%= options[:gateway] %>
<% end -%>

View File

@ -1,8 +1,9 @@
Connection=ethernet
Description='A basic IPv6 ethernet connection'
Interface=<%= options[:device] %>
IP6=static
Address6=('<%= options[:ip]%>/<%= options[:netmask] %>')
[Match]
Name=<%= options[:device] %>
[Network]
Description=A basic static ethernet connection
Address=<%= options[:ip]%>/<%= options[:netmask] %>
<% if options[:gateway] -%>
Gateway6='<%= options[:gateway] %>'
Gateway=<%= options[:gateway] %>
<% end -%>