标签:
1、System - Administration - Network Tools
2、Devices下选择Ethernet interface(eth0),即第0块网卡
3、选择Configure
4、选中Auto eth0 - edit - ipv4 setting:
address:和宿主机器同一网段,避免ip冲突,例如:192.168.31.247
netmask:255.255.255.0
Gateway:和宿主机器同一网关,例如:192.168.31.1
DNS Servers:和宿主机器相同,例如:192.168.31.1
5、重启网络服务
Ubuntu:sudo /etc/init.d/networking restart
other:service network restart
如果上面两条命令不起作用,就重启系统试一试吧
方式二:修改interfaces文件,重启系统(推荐,简单,易用)
vi /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.31.247
netmask 255.255.255.0
gateway 192.168.31.1
auto eth0
如果还是上不了网,注意查看宿主机器的相关服务是否开启
如果ping不通,注意查看宿主机器和虚拟机系统的防火墙是否关闭
关闭防火墙:
centos
chkconfig iptables off 不重启不会生效:
service iptables stop 不需要重启
ubuntu
ufw disable 需要重启系统
sudo iptables -F
sudo ufw status
标签:
原文地址:http://my.oschina.net/sniperLi/blog/490240