《一步步教你用VMware玩OpenWrt.docx》由会员分享,可在线阅读,更多相关《一步步教你用VMware玩OpenWrt.docx(10页珍藏版)》请在三一办公上搜索。
1、一步步教你用VMware玩OpenWrt作者:Cappie简介本文为本人学习玩OpenWrt时候的经验分享,旨在分享如何用VMware虚拟机安装OpenWrt 并搭建出一个可联网的OpenWrt虚拟机环境操作1.下载OpenWrt的虚拟盘镜像,下载地址:http:/backfire.openwrt.org/10.03.1-rc4x86/openwrt-x86-generic-combined-ext2.vmdkhttp:/downloads.openwrt.org/backfire/10.03.1-rc4x8&openwrt-x86-generic-combined-ext2.vm dkMD5
2、Sums:a258b7a5787f6bd8c8169391941813f4 openwrt-x86-generic-combined-ext2.vmdk两个连接下载的内容应该是一样的,我下载的是第一个地址的。2.打开VMware新建一台虚拟机(ALT+F、N、M或Ctrl+N)Guest Operating System InstallationA virtual machine is like a physical computer; it needs an operating system. How will you install the guest operating system?I
3、nstall from:L Installer disc:DVD/CD-RW 驱动器(G:)二广 Installer disc image file (iso):|) :CappieWE57O5 .isoBrowse.install the operating system later JThe virtual machine will be created with a blank hard disk.Help |CancelVirtual lachiiie lizardMaximum recommended memory: 1740 MBRecommended memory:256 MBM
4、emory for the Virtual MachineHow much memory would you like to use for this virtual machine?Guest 05 recommended minimum:32 MB3. 到上面一步,点击 Customize Hardware.删除 New CD、Floppy、USB Controller、Sound Card、Printer添加 Network Adapter 2Har dw eDevice ._ Summary1, jMemory 56 MBWProcessors1 New CD/DVD (IDE)Aut
5、o detectH Floppy-Auto detectNetyyprk AdapterNATU5B ControllerPresent硕。Sound CardAuto detectPrinterPresentQ DisplayAuto detect如何点击Finish就会添加一台名为“OpenWRT”的虚拟机4.复制下载的openwrt-x86-generic-combined-ext2.vmdk到虚拟机目录,并修改虚拟机目录 下的OpenWRT.vmx文件,本例中虚拟机目录为:E:VMwarePCOpenWRT搜索ide0:0.fileName这句,把原来的“OpenWRT.vmdk”改为
6、上面下载的文件:“openwrt-x86-generic-combined-ext2.vmdk”f1 OpenTKT. nx - 记事本匚OpenTKT. vbx -记事本艾件E) 编辑西格式查看明希助I-encoding =config .uersion = 8uirtualHW.uersion = 7scsiB.present = TRUE memsize = 64ide。二O.prESznt = “TRUE”文件 编辑 格式廷)查看也 帮助01).encoding = CBK conFig.uersion = 8 uirtualHW.uersion =7 scsiO-present =
7、TRUE nemsize = W idMW.pwent = “TRUE”.FileName = ,openwrt-x86-generic-combined-ext2-umdkEthernetO.present = TRUEEthernetO-connectionType = custom ethernetB-wakeOnPcktRcu = FALSE1 ethernet B.addressType = ,generated, ethernetl .present = TRUE ethernetl -connectionType = custom ethernetl.uakeOnPcktRcu
8、= FALSE ethernetl .addressType = ,generated, ehci.present = TRUEIe therneto.present = TRUE ethernetO.connectionType = custom ethernetB-wakeOnPcktRcu = FALSE ethernetB.addressType = generated ethernetl -present = TRUE ethernetl .connectionType = custom ethernetl.wakeOnPcktRcu = FALSE ethernetl -addre
9、ssType = generated ehci .present = TRUE 5. 打开 Virtual Network Editor,修改 VMnetl 为 192.168.1.0 段6.配置OpenWRT虚拟机的网卡配置OpenWRTOpenWRTState:Powered offGuest 05:Other Liniiix 2.6.? kernelLocation:E: VMwarePCOpen WRT(Version:Workstation 6.5-7;x virtu;Commands& Power on this virtual machine 仙 Edit virtual mac
10、hine settings臼 Enable ACE features What is ACE?)注意:两张网卡必修配置不同的虚拟网络,在测试中发现OpenWRT默认用Network Adapter 连接内网,Network Adapter 2暂时没启用,如果两个网卡设置的网络反过来,会不能连接, 具体为什么,我也不知道,只能大家自己试试。设置好后可启动OpenWRT虚拟机。7. 设置 Windows 上的虚拟网卡 VMware Network Adapter VMnetl原本 VMware Network Adapter VMnetl 的 IP 为:192.168.1.1现在设置其为自动获取,
11、因为OpenWRT的DHCP服务是默认启动的,会为该网卡分配IP。 同时要注意,如果你电脑连接的路由器也使用192.168.1.0网段,请设置到其他网段。设置完成后,禁用VMware Network Adapter VMnet1并重新启用,在OpenWRT虚拟机开启 的情况下,VMware Network Adapter VMnet1会自动获取到IP,就像从路由获取那样。8.最后步骤,设置路由我们需要设置静态路由,确保只有对192.168.1.0段的访问是通过VMware Network AdapterVMnet1出去的,而其他访问是通过无线网络连接出去的。设置如下:C: TmOTSsyste
12、B32cBd. exe C:poute -C: route add 0.0. E. 0 mask 0. 0.0.0 192.168.11.1 rietric 22C:X打入route -是清除当前路由表打入 route add 0.0.0.0 mask 0.0.0.0 192.168.11.1 metric 22添加静态路由,让其他访问 internet的请求都走192.168.11.1网关(物理网卡的网关)。其中metric 22是让路由优先级降低,确保对192.168.1.0段的访问先选择192.168.1.250这个 出口9. 在浏览器打入192.168.1.1即可访问OpenWRT默认
13、的LuCI界面。到此,虚拟软路由搭建 成功,按照普通路由的设置方法设置OpenWRT虚拟路由了。10. 把wen 口设置到eth1,设置DHCP自动获取地址,然后虚拟软路由就可以访问网络了(SpenWRTrootOpenUrt:i fconf ig ethlethl Link encap :Ethernet HUaddr 00:0C:29:fi7:Dfi:Dfiinet addr:192.168.11.100 Beast:192.168.11.255 Mask:255.255.255.0UP BKOfiDCfiST RUNNING MULTICAST MTU:1500 Metric:lKX p
14、ackets:312 errors:0 dropped:0 ouerruns:0 frane:0TX packets:394 errors:0 dropped:0 overruns:0 carrier:0co 11 is ions:0 txqueuelen:1000HX bytes:43417 (42.3 KiB) TX bytes:65853 (64.3 KiB)Interrupt:16 Base address:0x2080rootOpenUrt:/# ping PING Hww.baidu.coM (220.181.111.147) : 56 64 64 64 64 64 64 Cbyt
15、es bytes bytes bytes bytes bytesf tom f tom f tom f tom f tom f tom220.181.111.147:220.181.111.147:220.181.111.147:220.181.111.147:220.181.111.147: 220.181.111.147:seqseqseqseqseqseqa12345tt 1 tt 1 tt 1 tt 1 tt 1 tt 1a t t t t t t ta 5 5 5 5 5 5 d 4 4 4 4 4 4bjt esiMe=71.958 ms iMe=69.490 ms iMe=83.
16、492 ms iMe=72.654 ms iMe=73.302 ms iMe=71.462 ms,龄 .492packet lossMSnnn.ba ping stat ist ics6 packets transMitted, 6 packets received round-trip Min/aug/Max = 69.490/73.726/83 rootOpenUrt:_11. 一些注意事项我使用的是ESET安全套装,在开启防火墙的情况下,无论如何设置VMware Network Adapter VMnet1都不能获取地址,所以如果遇到类似情况,请检查防火墙。可以在线安装X-Wrt,但是我发现X-Wrt的X86版本缺少Packages.gz文件,所以我选择 了用ar71xx版本的:http:/downloads.x-wrt.org/xwrt/backfire/10.03ar71xx/packages/Packages.gz能正常安装,也能显示中文,但是使用上好像有问题。以下是截图: