Ubuntu14.04、Ubuntu16.04虚拟机配置桥接模式

~$ cat /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

auto lo iface lo inet loopback

auto eth1

iface eth1 inet static

address 192.168.2.171

gateway 192.168.2.1

netmask 255.255.255.0

 

要点:每台虚拟机都可以配置多个虚拟网卡,配置方式是:VMware->虚拟机设置->硬件->添加->网络适配器

添加新网卡的时候,虚拟机可以处于开机状态的,配置速度很快,使用ifconfig命令,可以查看到现有的网卡。

为了使用方便,我配置2张网卡,1张是NAT模式,1张是桥接模式,使用暂时没问题。

我们在/etc/network/interfaces文件设置网卡参数,如果不设置,系统则会使用自动获取的。

配置完成后,使用Ubuntu 16.04下使用 /etc/init.d/networking restart 重启服务。

Ubuntu14.04这个命令无效,所以直接重启虚拟机。

关于DNS设置:

可以在 /etc/resolvconf/resolv.conf.d/base 文件输入:

nameserver:XXX.XXX.XXX.XXX

不填也没关系,上网正常。

 

posted @ 2020-04-17 15:59  彭城老朽  阅读(442)  评论(0)    收藏  举报