- 论坛徽章:
- 0
|
今天总算把家里的UML环境搭好了.不过root fs还不够好.下来就介绍整个过程及网络拓扑.
整个网络结构
ip: 都是 192.168.x.x
------------ [vmnet8] [eth0] --------- [tap0] ------------
| Real | -------------------- |
[email=Ubuntu@vmWare]Ubuntu@[/email]
| -------- | uml switch |
| Machine | 83.2/32 83.129 | vmWare | 0.254 ------------
------------ --------- / \
------ ------
| uml1 | | uml2 |
------ ------
0.222 0.223
各端配置
Real machine: windows-XP,安装了vmware, vmnet8为NAT虚拟网卡:
network: 192.168.83.0
gateway: 192.168.83.2
Ubuntu: Ubuntu 5.1, eth0架到虚拟网卡vmnet8上做NAT. 再配置一个tap0 的tun/tap网络设备.
配置命令:
modprobe tun
tunctl -u root
ifconfig tap0 192.168.0.254 up
echo 1 > /proc/sys/net/ipv4/ip_forward # enable ip forward
echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp # enable arp proxy
arp -Ds 192.168.0.222 eth0 pub # make arp proxy for uml machines
arp -Ds 192.168.0.223 eth0 pub
uml_switch -daemon -tap tap0 /dev/null # open uml switch virual device
OK, 现在将这些命令保存再一个script中,以便使用方便
该网络配置的准备工作做完后,就可以开始构架UML本身了
我直接通过apt-get取得kernel-source & uml-patch, 及Debian-r3.0的fs
patch, make menuconfig ARCH=um, make..... 一般步骤拉.
最后可以使用 ./linux eth0=daemon ubd0=/fspath 启动uml了.
当然这样启动UML时候,eth0不会 bring up.需要在UML里配置.
UML: 配置/etc/network/interface:
iface eth0 inet static
address 192.168.0.223
network 192.168.0.0
netmask 255.255.255.0
up route add default gw 192.168.0.254
auto eth0
这样uml一启动就自己配置网络.
到目前为止, UML可以和外界网络相通了,ping一下218.94.81.240(电信分配给的ip)成功.不过你想
从real machine上ping到UML,还需要在windows下route ADD 一个到192.168.0.0的路由,默认路由
目的192.168.83.129也就是vmware的机器.
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/14459/showart_77766.html |
|