日期:2014-05-16  浏览次数:20632 次

VirtualBox for Windows下安装linux的网络设置

举例:

主机(windows)设网络桥IP:192.168.1.105

虚拟机(ubuntu)eth0 IP:192.168.1.102;eth1设动态取得IP。

?

1.Windows

2.VirtualBox

?

3.Ubuntu

?

?

?

?虚拟机文件vdi迁移时vbox网卡设置要刷新。
# /etc/init.d/networking restart
问题:
ERROR: "SIOCSIFADDR: No such device eth0"
解决:
Solution:
??? 1. ifconfig -a
??? it will show something like eth1 and MAC address
??? 2. vi /etc/iftab
??? change the MAC address on eth0 to what's shown in ifconfig -a
??? 3. reboot
references:
??? http://ubuntuforums.org/showthread.php?t=221768
Gutsy also has no /etc/iftab. I disabled this behavior in two steps:
(1) Edit /etc/udev//rules.d/70-persistent-net.rules
(1.1) comment out or delete all the lines beginning with SUBSYSTEM=="net"
(2) Edit /etc/udev/rules.d/75-persistent-net-generator.rules
(2.1) comment out or delete these two lines:
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*|ath*|wlan*|ra*|sta*" \
NAME!="?*", DRIVERS=="?*", GOTO="persistent_net_generator_do"
問題:
ping命令无效.
解決:
eth0設為橋接介面卡, 不要用NAT.

?

如果虚拟机为OEL(Oracle Enterprise Linux):

1. shell中输入 startx进入图形界面。
a) 通过System->Administration->Network配置主机IP。
根据 VirtualBox Host-Only Network的设置信息:192.168.56.1 / 255.255.255.0 / 192.168.56.2
设置eth0为动态取得IP.
设置eth1为静态IP:192.168.56.101 / 255.255.255.0 / 192.168.56.2
b) 通过System->Administration->Security Level And Firewall。
关掉防火墙,否则网络客户机将不能通过ftp,http等协议访问主机。

2.设置host。
将之前host全部注释掉,增加如下内容,192.168.56.101即是刚设置的本机ip
??? 127.0.0.1 localhost.localdomain localhost
??? 192.168.56.101 corey.cloud.com corey
corey 系主机名,cloud.com是domain。这个可以自己指定。

设置完成确保如下命令通过:
ping corey
ping 192.168.56.101
ping corey.cloud.com

3.设置SElinux
由于目前bug,SElinux可能会使安装失败,因此需要设置vi /etc/selinux/config,设置SELINUX=PERMISSIVE,然后reboot