流浪客人没有获得正确的IP分配

时间:2017-03-02 19:11:11

标签: networking vagrant

我的Vagrantfile包含行config.vm.network :private_network, ip: "192.168.33.10",但当机器出现时ifconfig显示:

eth0      Link encap:Ethernet  HWaddr 08:00:27:1B:06:06  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe1b:606/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:921 errors:0 dropped:0 overruns:0 frame:0
          TX packets:926 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:92471 (90.3 KiB)  TX bytes:97079 (94.8 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:255 errors:0 dropped:0 overruns:0 frame:0
          TX packets:255 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:40178 (39.2 KiB)  TX bytes:40178 (39.2 KiB)

因此,来宾将从完全不同的范围分配IP。主持人ifconfig的结果显示:

enp1s0    Link encap:Ethernet  HWaddr 1c:1b:0d:3b:06:a0  
          inet addr:10.100.102.10  Bcast:10.100.102.255  Mask:255.255.255.0
          inet6 addr: fe80::89fb:6606:8d85:ba21/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:214746 errors:0 dropped:0 overruns:0 frame:0
          TX packets:124683 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:295158044 (295.1 MB)  TX bytes:10146317 (10.1 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:35183 errors:0 dropped:0 overruns:0 frame:0
          TX packets:35183 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:4777700 (4.7 MB)  TX bytes:4777700 (4.7 MB)

vboxnet0  Link encap:Ethernet  HWaddr 0a:00:27:00:00:00  
          inet addr:192.168.33.1  Bcast:192.168.33.255  Mask:255.255.255.0
          inet6 addr: fe80::800:27ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4204 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:188146 (188.1 KB)

关于如何让流浪者分配正确的IP的任何想法? (这是流浪汉1.9.1,主机是Ubuntu 16,客人是CentOS 6。

修改:这是vagrant up的输出:

$ vagrant up dev
Bringing machine 'dev' up with 'virtualbox' provider...
==> dev: Clearing any previously set forwarded ports...
==> dev: Clearing any previously set network interfaces...
==> dev: Preparing network interfaces based on configuration...
    dev: Adapter 1: nat
    dev: Adapter 2: hostonly
==> dev: Forwarding ports...
    dev: 22 (guest) => 2222 (host) (adapter 1)
==> dev: Running 'pre-boot' VM customizations...
==> dev: Booting VM...
==> dev: Waiting for machine to boot. This may take a few minutes...
    dev: SSH address: 127.0.0.1:2222
    dev: SSH username: vagrant
    dev: SSH auth method: private key
==> dev: Machine booted and ready!
==> dev: Checking for guest additions in VM...
    dev: The guest additions on this VM do not match the installed version of
    dev: VirtualBox! In most cases this is fine, but in rare cases it can
    dev: prevent things such as shared folders from working properly. If you see
    dev: shared folder errors, please make sure the guest additions within the
    dev: virtual machine match the version of VirtualBox you have installed on
    dev: your host and reload your VM.
    dev: 
    dev: Guest Additions Version: 4.3.26
    dev: VirtualBox Version: 5.1
==> dev: Setting hostname...
==> dev: Configuring and enabling network interfaces...
==> dev: Mounting shared folders...
    dev: /vagrant => /home/johnny/dev/lumify
    dev: /home/vagrant/.m2 => /home/johnny/.m2
==> dev: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> dev: flag to force provisioning. Provisioners marked to run always will still run.

2 个答案:

答案 0 :(得分:1)

基于我刚刚做的一些测试,我认为这里的答案是升级到Vagrant 1.9.2。我之前没有注意到这一点,因为我主要使用Ubuntu盒子,但是使用CentOS 7.2来宾VM我得到的结果与你相同。我按如下方式定义了一个专用网络:

x.vm.network :private_network, ip: 10.211.54.5

vagrant up之后,登录该框并检查ifconfig的输出:

之前(Vagrant 1.9.1,VirtualBox 5.0.30r112061,Mac主机10.11.6)

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:fea3:aab6  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:a3:aa:b6  txqueuelen 1000  (Ethernet)
        RX packets 40213  bytes 49148144 (46.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10192  bytes 647080 (631.9 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 0  (Local Loopback)
        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

之后(将Vagrant升级到1.9.2):

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:fea3:aab6  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:a3:aa:b6  txqueuelen 1000  (Ethernet)
        RX packets 41483  bytes 49218539 (46.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10982  bytes 694063 (677.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.211.54.5  netmask 255.255.255.0  broadcast 10.211.54.255
        inet6 fe80::a00:27ff:fe25:5f05  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:25:5f:05  txqueuelen 1000  (Ethernet)
        RX packets 3  bytes 846 (846.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 23  bytes 2538 (2.4 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 0  (Local Loopback)
        RX packets 8  bytes 656 (656.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8  bytes 656 (656.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

我搜索了Vagrant更改日志和问题并且无法确定更改,但有几个提到了Redhat / CentOS的网络相关修复。

答案 1 :(得分:1)

看起来Lumify的开源版本的积极开发于2015年结束。您是否尝试过open source version of Visallo?如果您需要其他功能或更高的可扩展性,还有enterprise edition