hashicorp / vagrant

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

[Former issue #9426] Assigning private network to ETH2 interface got magically assigned to the ETH1 interface?! #9510

Open ZoranStojsavljevic opened 6 years ago

ZoranStojsavljevic commented 6 years ago

Vagrant version

vagrant -v ==>> Vagrant 2.0.1

Host operating system

uname -a ==>> Linux localhost.localdomain 4.14.14-300.fc27.x86_64 #1 SMP Fri Jan 19 13:19:54 UTC 2018 GNU/Linux uname -r ==>> Linux localhost.localdomain 4.14.14-300.fc27.x86_64 -> FEDORA 27

Guest operating system

uname -r ==>> 4.9.0-4-amd64 -> DEBIAN 9

Vagrantfile (networking part of it)

config.vm.network :forwarded_port, guest: 8888, host: 8888 config.vm.network :forwarded_port, guest: 8010, host: 8010 config.vm.network :forwarded_port, guest: 5000, host: 5000 config.vm.network :forwarded_port, guest: 8080, host: 8080 config.vm.network :forwarded_port, guest: 443, host: 4443 config.vm.network "private_network", bridge: "eth2", ip: "192.168.15.2", type: "static"

Debug output

root@stretch:~# ip route show default dev eth0 scope link 10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 192.168.15.0/24 dev eth1 proto kernel scope link src 192.168.15.2 root@stretch:~# netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 eth0 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 192.168.15.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 root@stretch:~# ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255 inet6 fe80::a00:27ff:fe8d:c04d prefixlen 64 scopeid 0x20 ether 08:00:27:8d:c0:4d txqueuelen 1000 (Ethernet) RX packets 1774 bytes 186641 (182.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1187 bytes 165406 (161.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.15.2 netmask 255.255.255.0 broadcast 192.168.15.255 inet6 fe80::a00:27ff:fe57:855c prefixlen 64 scopeid 0x20 ether 08:00:27:57:85:5c txqueuelen 1000 (Ethernet) RX packets 5 bytes 2420 (2.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 24 bytes 3206 (3.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::210:60ff:fe31:d452 prefixlen 64 scopeid 0x20 ether 00:10:60:31:d4:52 txqueuelen 1000 (Ethernet) RX packets 15 bytes 4920 (4.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9 bytes 2106 (2.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1 (Local Loopback) RX packets 3662 bytes 1138885 (1.0 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 3662 bytes 1138885 (1.0 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

vagrant up --debug

https://pastebin.com/2X99QijT

### Vagrantfile [full version]
Vagrant.configure(2) do |config|
  config.vm.provider :virtualbox do |vbox, override|
    config.vm.box = "debian/stretch64"

    ## vagrant plugin install vagrant-vbguest
    ## vagrant-vbguest: a vagrant plugin to keep VirtualBox Guest Additions up to date
    if !Vagrant.has_plugin?("vagrant-vbguest")
      system('vagrant plugin install vagrant-vbguest')

      raise("vagrant-vbguest installed. Run command again.");
    end

    vbox.customize ["modifyvm", :id, "--vram", "128"]
    vbox.customize ["modifyvm", :id, "--memory", "4096"]
    vbox.customize ["modifyvm", :id, "--cpus", "2"]
    vbox.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
    vbox.customize ["modifyvm", :id, "--draganddrop", "bidirectional"]

    vbox.customize ["modifyvm", :id, "--usb", "on"]
    vbox.customize ["modifyvm", :id, "--usbehci", "on"]
  end

  if !Vagrant.has_plugin?("vagrant-proxyconf")
    system('vagrant plugin install vagrant-proxyconf')
    raise("vagrant-proxyconf installed. Run command again.");
  end

  config.vm.network :forwarded_port, guest: 8888, host: 8888
  config.vm.network :forwarded_port, guest: 8010, host: 8010
  config.vm.network :forwarded_port, guest: 5000, host: 5000
  config.vm.network :forwarded_port, guest: 8080, host: 8080
  config.vm.network :forwarded_port, guest: 443, host: 4443
  config.vm.network "private_network", bridge: "eth2", ip: "192.168.15.2", type: "static"
end

root@stretch:~# dmesg | grep "register 'asix'" [ 6.091255] asix 1-1:1.0 eth2: register 'asix' at usb-0000:00:0b.0-1, ASIX AX88772 USB 2.0 Ethernet, 00:10:60:31:d4:52 root@stretch:~#

Expected behavior

ETH2 should take place of ETH1

Actual behavior

ETH1 popped out of nowhere

Steps to reproduce

vagrant up (always)

IMPORTANT!

Please, do note that my filter is on USB ASIX AX88772 device, which, after hijacking from host. got assigned to ETH2!

root@stretch:~# dmesg | grep "register 'asix'" [ 6.091255] asix 1-1:1.0 eth2: register 'asix' at usb-0000:00:0b.0-1, ASIX AX88772 USB 2.0 Ethernet, 00:10:60:31:d4:52 root@stretch:~#

ZoranStojsavljevic commented 6 years ago

Moved issue #9426 https://github.com/hashicorp/vagrant/issues/9426 to #9510 -> Closed Issue #9426.

Zoran

jamiejackson commented 6 years ago

I added my own case here, but was asked to create a new ticket. Here it is: #9546

chrisroberts commented 5 years ago

I have been attempting to reproduce the error you were encountering with this Vagrantfile using the latest release and have been unable to reproduce the state. Are you still experiencing this issue with the latest release?

ZoranStojsavljevic commented 5 years ago

I have tried the newest (as I could find) vagrant: vagrant -v ==>> Vagrant 2.2.2 [vagrant-1:2.2.2-1.x86_64]

It does work, but it is NOT good enough! I am not able to attach to it DHCP server.

I am using the following commands in the Vagrantfile:

CONF 1: config.vm.network "public_network", use_dhcp_assigned_default_route: true config.vm.network "private_network", ip: "192.168.15.2", netmask:"24"

CONF 2: config.vm.network "public_network", use_dhcp_assigned_default_route: true config.vm.network "private_network", ip: "192.168.15.2", netmask:"24", type: "dhcp"

What is the right command to configure/attach DHCP server on the "private_network" interface???

Thank you, Zoran

chrisroberts commented 5 years ago

@ZoranStojsavljevic Using the following Vagrantfile:

Vagrant.configure(2) do |config|
  config.vm.box = "debian/stretch64"
  config.vm.network "public_network", use_dhcp_assigned_default_route: true, bridge: "eth0"
  config.vm.define "node1" do |c|
    c.vm.network "private_network", ip: "192.168.33.232", netmask: "24"
  end
  config.vm.define "node2" do |c|
    c.vm.network "private_network", type: "dhcp", ip: "192.168.33.232", netmask: "24"
  end
  config.vm.synced_folder ".", "/vagrant", disabled: true
end

I bring up the guests:

$ vagrant up --provider=virtualbox
Bringing machine 'node1' up with 'virtualbox' provider...                     
Bringing machine 'node2' up with 'virtualbox' provider...                       
==> node1: Importing base box 'debian/stretch64'...                          
==> node1: Matching MAC address for NAT networking...            
==> node1: Checking if box 'debian/stretch64' is up to date...
==> node1: Setting the name of the VM: vagrant-scratch-2_node1_1545410543503_11130
==> node1: Fixed port collision for 22 => 2222. Now on port 2201.                   
==> node1: Clearing any previously set network interfaces...
==> node1: Preparing network interfaces based on configuration...
    node1: Adapter 1: nat                                                    
    node1: Adapter 2: bridged                                                                   
    node1: Adapter 3: hostonly   
==> node1: Forwarding ports...                                                              
    node1: 22 (guest) => 2201 (host) (adapter 1)
==> node1: Running 'pre-boot' VM customizations...                           
==> node1: Booting VM...                                                           
==> node1: Waiting for machine to boot. This may take a few minutes...
    node1: SSH address: 127.0.0.1:2201                                                      
    node1: SSH username: vagrant                                              
    node1: SSH auth method: private key                                                 
    node1:                                               
    node1: Vagrant insecure key detected. Vagrant will automatically replace
    node1: this with a newly generated keypair for better security.
    node1:                  
    node1: Inserting generated public key within guest...
    node1: Removing insecure key from the guest if it's present...                                   
    node1: Key inserted! Disconnecting and reconnecting using new SSH key...
==> node1: Machine booted and ready!                                                                 
==> node1: Checking for guest additions in VM...
    node1: No guest additions were detected on the base box for this VM! Guest
    node1: additions are required for forwarded ports, shared folders, host only
    node1: networking, and more. If SSH fails on this machine, please install                        
    node1: the guest additions and repackage the box to continue.
    node1:                                                                                                                    
    node1: This is not an error message; everything may continue to work properly,                                                  
    node1: in which case you may ignore this message.                                                                                
==> node1: Configuring and enabling network interfaces...                                                                         
==> node2: Importing base box 'debian/stretch64'...                                                                  
==> node2: Matching MAC address for NAT networking...                                                                    
==> node2: Checking if box 'debian/stretch64' is up to date...                                     
==> node2: Setting the name of the VM: vagrant-scratch-2_node2_1545410590830_36554                        
==> node2: Fixed port collision for 22 => 2222. Now on port 2200.                      
==> node2: Clearing any previously set network interfaces...                                     
==> node2: Preparing network interfaces based on configuration...                                              
    node2: Adapter 1: nat                                                                  
    node2: Adapter 2: bridged                                                                      
    node2: Adapter 3: hostonly                                                            
==> node2: Forwarding ports...                                                           
    node2: 22 (guest) => 2200 (host) (adapter 1)                                                               
==> node2: Running 'pre-boot' VM customizations...                                       
==> node2: Booting VM...                                                                             
==> node2: Waiting for machine to boot. This may take a few minutes...                           
    node2: SSH address: 127.0.0.1:2200                                                     
    node2: SSH username: vagrant                                                                
    node2: SSH auth method: private key                                             
    node2:                                                                               
    node2: Vagrant insecure key detected. Vagrant will automatically replace                         
    node2: this with a newly generated keypair for better security.                                
    node2:                                                                                                     
    node2: Inserting generated public key within guest...           
    node2: Removing insecure key from the guest if it's present...     
    node2: Key inserted! Disconnecting and reconnecting using new SSH key...
==> node2: Machine booted and ready!                                                                 
==> node2: Checking for guest additions in VM...                                         
    node2: No guest additions were detected on the base box for this VM! Guest
    node2: additions are required for forwarded ports, shared folders, host only
    node2: networking, and more. If SSH fails on this machine, please install
    node2: the guest additions and repackage the box to continue.
    node2:                                                    
    node2: This is not an error message; everything may continue to work properly,
    node2: in which case you may ignore this message.                               
==> node2: Configuring and enabling network interfaces...   

==> node1: Machine 'node1' has a post `vagrant up` message. This is a message
==> node1: from the creator of the Vagrantfile, and not from Vagrant itself:                    
==> node1:                       
==> node1: Vanilla Debian box. See https://app.vagrantup.com/debian for help and bug reports

==> node2: Machine 'node2' has a post `vagrant up` message. This is a message
==> node2: from the creator of the Vagrantfile, and not from Vagrant itself:       
==> node2:                                                            
==> node2: Vanilla Debian box. See https://app.vagrantup.com/debian for help and bug reports

After this I can check node1 and see that is has been configured with the static IP defined:

$ vagrant ssh node1 -- ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo                                          
       valid_lft forever preferred_lft forever                     
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever           
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:8d:c0:4d brd ff:ff:ff:ff:ff:ff                      
    inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0                                               
       valid_lft forever preferred_lft forever  
    inet6 fe80::a00:27ff:fe8d:c04d/64 scope link                              
       valid_lft forever preferred_lft forever                                  
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:2f:22:03 brd ff:ff:ff:ff:ff:ff           
    inet 192.168.1.180/24 brd 192.168.1.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe2f:2203/64 scope link
       valid_lft forever preferred_lft forever
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:69:15:fa brd ff:ff:ff:ff:ff:ff
    inet 192.168.33.232/24 brd 192.168.33.255 scope global eth2
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe69:15fa/64 scope link
       valid_lft forever preferred_lft forever

And checking node2 shows that it has an address assigned to it via DHCP on the same network:

$ vagrant ssh node2 -- ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:8d:c0:4d brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe8d:c04d/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:a5:e1:2a brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.181/24 brd 192.168.1.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fea5:e12a/64 scope link
       valid_lft forever preferred_lft forever
4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:55:cb:9e brd ff:ff:ff:ff:ff:ff
    inet 192.168.33.3/24 brd 192.168.33.255 scope global eth2
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe55:cb9e/64 scope link
       valid_lft forever preferred_lft forever

Is this the state you are attempting to reach?

ZoranStojsavljevic commented 5 years ago

I have defined in my Vagrantfile the following:

config.vm.network "public_network", use_dhcp_assigned_default_route: true config.vm.network "private_network", type: "dhcp", ip: "192.168.15.1", netmask: "24"

I bring up the guest:

[vuser@fedora28-ssd referent_lava_BatD]$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Checking if box 'debian/stretch64' is up to date... ==> default: A newer version of the box 'debian/stretch64' for provider 'virtualbox' is ==> default: available! You currently have version '9.4.0'. The latest is version ==> default: '9.6.0'. Run vagrant box update to update. ==> default: Clearing any previously set forwarded ports... ==> default: Vagrant has detected a configuration issue which exposes a ==> default: vulnerability with the installed version of VirtualBox. The ==> default: current guest is configured to use an E1000 NIC type for a ==> default: network adapter which is vulnerable in this version of VirtualBox. ==> default: Ensure the guest is trusted to use this configuration or update ==> default: the NIC type using one of the methods below: ==> default: ==> default: https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type ==> default: https://www.vagrantup.com/docs/virtualbox/networking.html#virtualbox-nic-type ==> default: Clearing any previously set network interfaces... ==> default: Available bridged network interfaces: 1) wlo1 2) enp0s20u2 3) enp0s25 ==> default: When choosing an interface, it is usually the one that is ==> default: being used to connect to the internet. default: Which interface should the network bridge to? 1 ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: bridged default: Adapter 3: hostonly ==> default: Forwarding ports... default: 8888 (guest) => 8888 (host) (adapter 1) default: 8010 (guest) => 8010 (host) (adapter 1) default: 5000 (guest) => 5000 (host) (adapter 1) default: 8080 (guest) => 8080 (host) (adapter 1) default: 443 (guest) => 4443 (host) (adapter 1) default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Running 'pre-boot' VM customizations... ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Connection reset. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Connection reset. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Remote connection disconnect. Retrying... default: Warning: Connection reset. Retrying... default: Warning: Remote connection disconnect. Retrying... ==> default: Machine booted and ready! [default] GuestAdditions 5.2.22 running --- OK. ==> default: Checking for guest additions in VM... ==> default: Configuring and enabling network interfaces... ==> default: Rsyncing folder: /home/vuser/projects2/vagrant/referent_lava_BatD/ => /vagrant ==> default: Machine already provisioned. Run vagrant provision or use the --provision ==> default: flag to force provisioning. Provisioners marked to run always will still run.

==> default: Machine 'default' has a post vagrant up message. This is a message ==> default: from the creator of the Vagrantfile, and not from Vagrant itself: ==> default: ==> default: Vanilla Debian box. See https://app.vagrantup.com/debian for help and bug reports [vuser@fedora28-ssd referent_lava_BatD]$

And checking shows that it has an address assigned to it via DHCP on the same network:

[vuser@fedora28-ssd referent_lava_BatD]$ vagrant ssh -- ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:8d:c0:4d brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fe8d:c04d/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:51:b6:ad brd ff:ff:ff:ff:ff:ff inet 192.168.178.100/24 brd 192.168.178.255 scope global eth1 valid_lft forever preferred_lft forever inet6 fd00::a00:27ff:fe51:b6ad/64 scope global mngtmpaddr dynamic valid_lft 7098sec preferred_lft 3498sec inet6 2001:a61:3804:7a01:a00:27ff:fe51:b6ad/64 scope global mngtmpaddr dynamic valid_lft 6411sec preferred_lft 2811sec inet6 fe80::a00:27ff:fe51:b6ad/64 scope link valid_lft forever preferred_lft forever 4: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 08:00:27:99:da:63 brd ff:ff:ff:ff:ff:ff inet 192.168.15.3/24 brd 192.168.15.255 scope global eth2 valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fe99:da63/64 scope link valid_lft forever preferred_lft forever 5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 00:10:60:31:d3:9b brd ff:ff:ff:ff:ff:ff [vuser@fedora28-ssd referent_lava_BatD]$

I reached the state you have asked me. But this is just a beginning of the story! Let me continue.

The following is what I have when I login into the Vbox VM:

root@stretch-server:/home/vagrant# ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255 inet6 fe80::a00:27ff:fe8d:c04d prefixlen 64 scopeid 0x20 ether 08:00:27:8d:c0:4d txqueuelen 1000 (Ethernet) RX packets 1128 bytes 110438 (107.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 875 bytes 102991 (100.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.178.100 netmask 255.255.255.0 broadcast 192.168.178.255 inet6 fe80::a00:27ff:fe51:b6ad prefixlen 64 scopeid 0x20 inet6 fd00::a00:27ff:fe51:b6ad prefixlen 64 scopeid 0x0 inet6 2001:a61:3804:7a01:a00:27ff:fe51:b6ad prefixlen 64 scopeid 0x0 ether 08:00:27:51:b6:ad txqueuelen 1000 (Ethernet) RX packets 421 bytes 35239 (34.4 KiB) RX errors 0 dropped 42 overruns 0 frame 0 TX packets 93 bytes 9556 (9.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.15.3 netmask 255.255.255.0 broadcast 192.168.15.255 inet6 fe80::a00:27ff:fe99:da63 prefixlen 64 scopeid 0x20 ether 08:00:27:99:da:63 txqueuelen 1000 (Ethernet) RX packets 5 bytes 2420 (2.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 24 bytes 3206 (3.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1 (Local Loopback) RX packets 1421 bytes 377354 (368.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1421 bytes 377354 (368.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

root@stretch-server:/home/vagrant#

As we see, eth2 is there, and the assignment is correct. But I do NOT see if eth2 interface has attached DHCP server (within Vbox VM), To check this, I need to bring the following: DUT, embedded device, which is attached to Vbox VM. The embedded platform is BeagleBoneBlack (BBB) with Sitara am3358 A8 armv7.

I have ser2net service properly configured inside Vbox VM. So I can see serial (rs232) console directly within Vbox VM. And this is what I see on BBB (when I bring up Debian 9.5.0 on it):

root@beaglebone:~# ifconfig eth0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC> mtu 1500 inet6 fe80::66cf:d9ff:feff:6705 prefixlen 64 scopeid 0x20 ether 64:cf:d9:ff:67:05 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 28 bytes 5932 (5.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 51

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 164 bytes 13240 (12.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 164 bytes 13240 (12.9 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

usb0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.7.2 netmask 255.255.255.252 broadcast 192.168.7.3 ether 64:cf:d9:ff:67:07 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

usb1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.6.2 netmask 255.255.255.252 broadcast 192.168.6.3 ether 64:cf:d9:ff:67:0a txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

root@beaglebone:~#

So, as you see, BBBs' eth0 interface is attached to the host notebook, and passed through host using VT-d capabiliy to Vbox VM on eth2. Now, since I know that they are correctly physically connected, I'll activate DHCP Client on BBB to ask Vbox VM eth2 DHCP server to land one IP address:

root@beaglebone:~# dhclient eth0 -v Internet Systems Consortium DHCP Client 4.3.5 Copyright 2004-2016 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/64:cf:d9:ff:67:05 Sending on LPF/eth0/64:cf:d9:ff:67:05 Sending on Socket/fallback DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 10 DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 12 DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 18 DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14 No DHCPOFFERS received. No working leases in persistent database - sleeping. root@beaglebone:~#

Now, let us see if I have correct 192.168.15.x on BBBs' eth0 interface:

root@beaglebone:~# ifconfig eth0 eth0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC> mtu 1500 inet 169.254.170.123 netmask 255.255.0.0 broadcast 169.254.255.255 inet6 fe80::66cf:d9ff:feff:6705 prefixlen 64 scopeid 0x20 ether 64:cf:d9:ff:67:05 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 366 bytes 180893 (176.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 51

root@beaglebone:~#

I do NOT have it, so, clearly, there is NO DHCP server configured on Vbox VMs' eth2 interface!

How can I configure Vbox VMs' eth2 interface to have DHCP server on it using VAGRANT???

Thank you, Zoran

ZoranStojsavljevic commented 5 years ago

@chrisroberts , the issue is NOT solved. You have the same problem in the following Vagrant release:

[vuser@fedora28-ssd lava-dispatcher-vm]$ rpm -q vagrant
vagrant-2.2.2-1.x86_64

In the Vagrantfile I have the following network setup:

 ## Vagrant network configuration

  ## Forward port 8020 for the ser2net terminal
  config.vm.network :forwarded_port, guest: 8020, host: 8020

  # Configure network accessibility for tftp server
  ## config.vm.network "public_network", use_dhcp_assigned_default_route: true
  # route for connections to the board - does not work for now!
  ## config.vm.network "private_network", type: "dhcp", ip: "192.168.15.2", netmask: "24"
  config.vm.network "private_network", bridge: "eth2", ip: "192.168.15.2", netmask: "24"
  ## config.vm.network "private_network", bridge: "eth2", ip: "192.168.15.2", type: "dhcp"

And in the VBox VM, created by vagrant the following:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::a00:27ff:fe8d:c04d  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:8d:c0:4d  txqueuelen 1000  (Ethernet)
        RX packets 14454  bytes 1891778 (1.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13807  bytes 1175764 (1.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.15.2  netmask 255.255.255.0  broadcast 192.168.15.255
        inet6 fe80::a00:27ff:fe1d:15d3  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:1d:15:d3  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 22  bytes 1716 (1.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 8  bytes 624 (624.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 624 (624.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Please, could you fix this issue???

Thank you, Zoran