From b4a66bb43f4b974a1ffb4ef370d8b8063cc737b4 Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Tue, 12 Jan 2016 10:29:01 +0100 Subject: [PATCH] Allow to forward ports from a custom adapter Before this change, vagrant-libvirt assumed that all port forwards should be done on eth0 adapter. Now user can provide a custom adapter via "adapter" option when calling forwarded_port. --- README.md | 2 ++ lib/vagrant-libvirt/action/forward_ports.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a055a9..3df515f 100644 --- a/README.md +++ b/README.md @@ -615,6 +615,8 @@ you want the forwarded port to be accessible from outside the Vagrant host. In this case you should also set the `host_ip` option to `'*'` since it defaults to `'localhost'`. +You can also provide a custom adapter to forward from by 'adapter' option. Default is 'eth0'. + ## Synced Folders vagrant-libvirt supports bidirectional synced folders via nfs or 9p and diff --git a/lib/vagrant-libvirt/action/forward_ports.rb b/lib/vagrant-libvirt/action/forward_ports.rb index 278789d..1b32f2b 100644 --- a/lib/vagrant-libvirt/action/forward_ports.rb +++ b/lib/vagrant-libvirt/action/forward_ports.rb @@ -38,7 +38,7 @@ module VagrantPlugins def forward_ports @env[:forwarded_ports].each do |fp| message_attributes = { - adapter: 'eth0', + adapter: fp[:adapter] || 'eth0', guest_port: fp[:guest], host_port: fp[:host] }