ubuntu虚拟机启用双网卡IP配置
首先要登入自己的虚拟机,这里以ubuntu为例。
配置两块网卡,一块eth0为NAT模式,另一块为eth1仅主机模式
# 进入网卡配置页面
vi /etc/network/interfaces
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 192.168.60.202 netmask 255.255.255.0 network 192.168.60.0 broadcast 192.168.60.255 gateway 192.168.60.2 auto eth1 iface eth1 inet static address 192.168.15.202 netmask 255.255.255.0 network 192.168.15.0 broadcast 192.168.15.255
# 此块网卡不配置网关
然后重启网卡即可
/etc/init.d/networking restart
如果ping不通域名
则需要修改此文件
vim /etc/resolv.conf
修改添加一下内容,即可
search localdomain nameserver 8.8.8.8
作者:Jace Jin
github地址:https://github.com/buxianghua
原创文章版权归作者所有.
欢迎转载,转载时请在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
欢迎转载,转载时请在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.