hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.17k stars 4.43k forks source link

vagrant uses incorrect name of network interface for bridged interface #7988

Closed aston-r closed 7 years ago

aston-r commented 7 years ago

Dear Developers,

This is continuation of bug that I reported in https://github.com/mitchellh/vagrant/issues/7858 . I have updated to vagrant 1.8.7 and still had the same issue:

INFO global: Vagrant version: 1.8.7
INFO global: Ruby version: 2.2.5
INFO global: RubyGems version: 2.4.5.1
...
DEBUG guest: Searching for cap: network_interfaces
DEBUG guest: Checking in: redhat
DEBUG guest: Checking in: linux
DEBUG guest: Found cap: network_interfaces in linux
 INFO guest: Execute capability: network_interfaces [#<Vagrant::Machine: RHEL-7.2 (VagrantPlugins::ProviderVirtualBox::Provider)>] (redhat)
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: /sbin/ip -o -0 addr | grep -v LOOPBACK | awk '{print $2}' | sed 's/://' (sudo=true)
DEBUG ssh: Exit status: 0
DEBUG network_interfaces: Unsorted list: ["eth0", "eth1", "eth0.1@eth0"]
DEBUG network_interfaces: Sorted list: ["eth0", "eth0.1@eth0", "eth1"]
DEBUG network_interfaces: Ethernet preferred sorted list: ["eth0", "eth0.1@eth0", "eth1"]
DEBUG ssh: Uploading: /tmp/vagrant-redhat-configure-networks20161110-29035-19ldhw3 to /tmp/vagrant-network-entry-eth0.1@eth0-1478782550-0
DEBUG ssh: Re-using SSH connection.
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: # Down the interface before munging the config file. This might
# fail if the interface is not actually set up yet so ignore
# errors.
/sbin/ifdown 'eth0.1@eth0'
# Move new config into place
mv -f '/tmp/vagrant-network-entry-eth0.1@eth0-1478782550-0' '/etc/sysconfig/network-scripts/ifcfg-eth0.1@eth0'
# attempt to force network manager to reload configurations
nmcli c reload || true

....
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

ERROR vagrant: /opt/vagrant/embedded/gems/gems/vagrant-1.8.7/plugins/communicators/ssh/communicator.rb:240:in `execute'
/opt/vagrant/embedded/gems/gems/vagrant-1.8.7/plugins/communicators/ssh/communicator.rb:250:in `sudo'
/opt/vagrant/embedded/gems/gems/vagrant-1.8.7/plugins/guests/redhat/cap/configure_networks.rb:56:in `configure_networks'

As you can see vagrant uses vlan(eth0.1), while it should use eth1.

> ip -o -0 addr | grep -v LOOPBACK | awk '{print $2}'
eth0:
eth1:
eth0.1@eth0:

> ls -l /etc/sysconfig/network-scripts/ifcfg-eth0.1*
-rw-r--r-- 1 root      root  119 Nov 10 01:53 /etc/sysconfig/network-scripts/ifcfg-eth0.1
-rw------- 1 vinod-990 devels 149 Nov 10 12:55 /etc/sysconfig/network-scripts/ifcfg-eth0.1@eth0

> cat /etc/sysconfig/network-scripts/ifcfg-eth0.1@eth0 
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
BOOTPROTO=dhcp
ONBOOT=yes
DEVICE=eth0.1@eth0
#VAGRANT-END

Let me know if you need more info.

aston-r commented 7 years ago

Hi @chrisroberts

patched helped. thanks.

INFO ssh: Execute: /sbin/ip -o -0 addr | grep -v LOOPBACK | awk '{print $2}' | sed 's/://' (sudo=true)
DEBUG ssh: Exit status: 0
DEBUG network_interfaces: Unsorted list: ["eth0", "eth1", "eth0.1@eth0"]
DEBUG network_interfaces: Sorted list: ["eth0", "eth0.1@eth0", "eth1"]
DEBUG network_interfaces: Ethernet preferred sorted list: ["eth0", "eth1", "eth0.1@eth0"]
DEBUG ssh: Uploading: /tmp/vagrant-redhat-configure-networks20161111-16449-fv6bl4 to /tmp/vagrant-network-entry-eth1-1478848731-0
DEBUG ssh: Re-using SSH connection.
DEBUG ssh: Re-using SSH connection.
INFO ssh: Execute: # Down the interface before munging the config file. This might
# fail if the interface is not actually set up yet so ignore
# errors.
/sbin/ifdown 'eth1'
ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.