dt_legend
2017-03-03 14:18
config.vm.box = "vagrant-centos-7.2" config.vm.hostname = "nginx" config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.network "private_network", ip: "192.168.33.21" config.vm.synced_folder "/code", "/home/wwwroot/default"
上面这段是我的相关配置
==> default: Attempting graceful shutdown of VM... ==> default: Clearing any previously set forwarded ports... ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: hostonly ==> default: Forwarding ports... default: 80 (guest) => 8080 (host) (adapter 1) default: 22 (guest) => 2222 (host) (adapter 1) ==> 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: Machine booted and ready! ==> default: Checking for guest additions in VM... ==> default: Configuring and enabling network interfaces... ==> default: Mounting shared folders... default: /vagrant => /vagrant/virtual/nginx_web default: /home/wwwroot/default => /code ==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` ==> default: flag to force provisioning. Provisioners marked to run always will still run.
登陆之后无法查看到ip
[vagrant@localhost ~]$ ifconfig enp0s3: 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:fe6c:3e95 prefixlen 64 scopeid 0x20<link> ether 08:00:27:6c:3e:95 txqueuelen 1000 (Ethernet) RX packets 391 bytes 43887 (42.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 303 bytes 42432 (41.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 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
之前有次不知道怎么回事,成功了一次。
另外,我现在这边只配置了一个共享目录,但他又两个。
另一个是之前配置的,为什么还存在?
麻烦啦!!!谢谢!!!
注意我的重点是 auto_config: true
类似我这样的ip配置看看
config.vm.network "private_network", ip: "192.168.199.101",auto_config: true
目前端口映射是可以用的、、、
vagrant打造跨平台可移动的开发环境
13889 学习 · 117 问题
相似问题