網工67 文件 VirtualBox的bridge mode網路?
作者: keung 強 (12-18 01:48) 發表討論 列印 詳細資料
參考life學長裡面的連結文件兩篇
 有關FreeBSD安裝於VirtualBox虛擬機器 
 VirtualBOX網路設定達成~~~

其中有參考連結1為 http://cha.homeip.net/blog/archives/2007/01/innotek_virtual.html
這篇文章所做的部份如下:


Jamyy's Weblog: InnoTek VirtualBox 虛擬 PC

bridge 網路模式

http://rpmfind.net/ 搜尋 uml-utilities:
wget
ftp://fr2.rpmfind.net/linux/opensuse/distribution/SL-10.1/inst-source/suse/i586/uml-utilities-20040406-11.i586.rpm

rpm -ivh --nodeps uml-utilities*.rpm

yum -y install bridge-utils

tunctl –t tap1 –u root

brctl addbr br0

ifconfig eth0 0.0.0.0 promisc

brctl addif br0 eth0

dhclient br0

brctl addif br0 tap1

啟動 VirtualBox, 將 VirtualHost 的 Network Interface Name 設定為 tap1 即可

ifconfig tap1 up
chmod 666 /dev/net/tun


也參考過第二個連結照做如下:
http://163.23.89.100/~chi/blog/index.php?load=read&id=74

M6 Linux 安裝Virtualbox (2)

attachments/200708/4124476047.png



[1.安裝橋接器]
yum install bridge-utils


[2.下載tunctl並放到/usr/sbin/下]

cd /usr/sbin/
wget ftp://163.23.89.100/M6-Linux/tunctl
chmod 755 tunctl


[3.下載小弟雞婆寫的批次檔,放在自己的家目錄下]

a.下載
cd /home/XXX
wget  ftp://163.23.89.100/M6-Linux/Vbox-start.sh

b.修改一下
gedit Vbox-start.sh

找到下段將XXX改為您的帳號,另外tap1可隨自己的意思改名!
## 3.新增一個我用的網路卡,名稱為tap1

/usr/sbin/tunctl -t tap1 -u XXX


c.變更權限
chmod 755 Vbox-start.sh

##用 root 執行(每次系統有重新啟動或開機時要執行一次)
./Vbox-start.sh


[4.打開VBox,設定好網路]

然後呢?就開始玩吧!

 


大約幾天前
2種方法都試了很久
還是不知道設定完畢後
要怎麼知道橋接網路是不是可以連通?
guset端的freebsd要怎樣設定
要設定ip多少?

我目前的做法是
WAN:140.115.236.28/16
ip分享器
LAN IP:192.168.11.x/24
GW:192.168.11.1
                 ↓
HOST OS:LINUX
IP:192.168.11.233/24
GW:192.168.11.1
                 ↓
GUEST OS:FreeBSD
IP:192.168.11.234/24
GW:192.168.11.1

然後還是ping不到 反向ip查dns或正向查詢ip都沒回應

上面2種方法,都試過,也沒有錯誤訊息
要如何確定是設定成功?
ifconfig嗎?

在還沒有找到這2個文件之前...我還讀了一下virtualbox軟體本身的F1 HELP說明文件

http://www.virtualbox.org/download/UserManual.pdf
6.5.1.3 Bridging on Redhat and Fedora hosts
To create a bridge on Redhat and Fedora, you must first install the bridge utilities
(bridge-utils) package. Then you must create a configuration file describing the
bridge you wish to create. The following is the contents of an example configuration
file /etc/sysconfig/network-scripts/ifcfg-br0, which sets the bridge br0
to get its IP address using DHCP and to start automatically when the system is started.
You will probably want to adjust this to match your networking requirements.

DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
To add the network card eth0 to the bridge, add the following line to the end of
the file /etc/sysconfig/network-scripts/ifcfg-eth0:
BRIDGE=br0
You can activate the bridge immediately after creating it with the command:
sudo /sbin/service network restart
The bridge will be activated automatically from now on when the host is restarted.
Now, to create a permanent host interface called vbox0 (all host interfaces created
in this way must be called vbox followed by a number) and add it to the network
bridge created above, use the following command (see chapter 6.5.1.5, Host Interface
Networking utilities for Linux, page 68 for more details):
sudo VBoxAddIF vbox0 <user> br0
Replace <user> with the name of the user who is supposed to be able to use the
new interface.
To tell VirtualBox to use this interface (vbox0) for a virtual machine, select the
VM in the main window, configure one of its network adaptors to use Host Interface
Networking (using “Settings”, “Network”, “Attached to”) and enter “vbox0” into the
“Interface name” field.
Alternatively, you can use the VBoxManage command line tool (in this example we
are attaching the interface to the first network card of the virtual machine “My VM”:
VBoxManage modifyvm "My VM" -hostifdev1 vbox0

之後還有
6.5.1.5 Host Interface Networking utilities for Linux
6.5.2 Creating interfaces dynamically when a virtual machine
starts up
6.6 Internal networking
好長的大大篇...........................................(真的被打敗了)
因為英文程度很不好,實在看不下去了
然後只做到
6.5.1.3 Bridging on Redhat and Fedora hosts
就沒做下去
那時以為做完了,就試著設IP看看,結果freebsd當然不能上網
是後來才發現還有後面的要做

然後找到學長那2篇教學試著做看看結果做完了也不知道問題出在哪裡?

ifconfig
一開始會有
br0
也有抓到我ip分享器的 ip 192.168.11.x
也多一個網路介面
vbox0

後來我沒做下去 就把br0改名
mv /etc/sysconfig/network-scripts/ifcfg-br0 /etc/sysconfig/network-scripts/ifcfg-br0.bak

想移除vbox0這個網路介面
在目錄/etc/sysconfig/network-scripts/
也找不到vbox0

接著最後才試著做我前面po的那2篇教學,還是不知道問題在哪?

後來就沒時間再繼續try
不知道有沒有同學或者請老師幫忙指引一下,謝謝!

相關討論:
  1. 老師所提供的script(tap1.sh)....還是不行? (11 篇回應, 12-20 18:42 by guru)
  2. 謝謝你囉 (2 篇回應, 12-19 02:51 by keung 強)