在Homestead目录下,打开Vagrantfile文件
增加
config.vm.network :public_network,ip:"192.168.20.11"
参考配置
if Vagrant.has_plugin?('vagrant-hostsupdater')
config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
elsif Vagrant.has_plugin?('vagrant-hostmanager')
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
end
if Vagrant.has_plugin?('vagrant-notify-forwarder')
config.notify_forwarder.enable = true
end
config.vm.network :public_network,ip:"192.168.20.11"
提示: ip:“192.168.20.11” 需要配置未使用的ip
例子:
以太网适配器 以太网:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : fxxxxxxxxxxxxxxxxxxxxx
IPv4 地址 . . . . . . . . . . . . : 192.168.20.12
192.168.20.12 ip地址就不可以使用