Virtualbox 桥接模式 网卡IP地址获取

1、设置桥接模式(界面名称选自己网络适配器)

2、ifconfig 后看不到网卡,才有ifconfig -a

显示的网卡没有IP地址,找到网卡配置文件(系统有的不一样)--->/etc/network/interfaces

添加网卡enp0s3 从dhcp动态获取

auto lo
iface lo inet loopback
###########
auto enp0s3
iface enp0s3 inet dhcp

3、重启网络服务

/etc/init.d/networking restart

重启成功后,网卡获取到IP地址

4、虚拟机不能Ping 外网。主机能ping 虚拟机

检查是否是防火墙过滤ICMPV4的原因

打开规则通过。解决问题。