首页 > 代码库 > 3、vagrant的3种网络连接方式

3、vagrant的3种网络连接方式

1. 简介

vagrant提供了3种网络连接方式,分别是forwarded ports,host-only networking和bridged networking


2. forwarded ports

config.vm.network "forwarded_port", guest: 80, host: 80   //将vagrant虚拟机的80端口映射到主机的80端口


3. host-only networking

config.vm.network "private_network", ip: "192.168.56.10"     //private_network定义host-only networking,"192.168.56.10"为分配的静态IP


4. bridged networking

config.vm.network "public_network"


本文出自 “桃子先生” 博客,请务必保留此出处http://peach3412.blog.51cto.com/12037226/1850715

3、vagrant的3种网络连接方式