VirtualBox上安装ubuntu虚拟机网络连接的问题

2014年07月02日 Android 10条评论 阅读19855次

VirtualBox上安装ubuntu虚拟机网络连接的问题

极乐鸟博客jileniao.net     

2014年7月2日   小雨      


先说下如何设置ubuntu虚拟机的IP地址、子网掩码和默认网关的事情。
设置上面的这些上网参数,有界面设置、命令设置、直接改写配置文件三种方法。
我推荐的是第三种直接改写配置文件的方式。
详细步骤如下
1.先备份原始的网络配置文件
 sudo cp /etc/network/interfaces /etc/network/interfaces.bak

2.用文本编辑器(我这里使用gedit)打开上面的配置文件并修改
 sudo gedit /etc/network/interfaces

3.在打开的配置文件的末尾,加入下面的配置
 auto eth0
 iface eth0 inet static
 address 192.168.0.120
 gateway 192.168.0.1
 netmask 255.255.255.0

4.用ifconfig命令查看IP信息是否设置成功,若不行则重启

5.ubuntu设置DNS服务器
 sudo gedit /etc/resolvconf/resolv.conf.d/base(这个文件默认是空的)
 向该文件中写入
 nameserver 8.8.8.8
 nameserver 8.8.4.4
 nameserver 223.5.5.5
 nameserver 223.6.6.6 
 如果有多个DNS就一行一个
 修改好保存,然后执行
 sudo resolvconf -u
 再看/etc/resolv.conf,最下面就多了几行上面配置的DNS服务器信息:
 gedit /etc/resolv.conf
  # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
  #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
  nameserver 8.8.8.8
  nameserver 8.8.4.4
  nameserver 223.5.5.5
  nameserver 223.6.6.6 
 可以看到我们的设置已经加上了,然后再ping一个域名,当时就可以解析了,无需重启。

到此,关于VirtualBox上安装的ubuntu虚拟机的网络设置就应该结束了。如果还是不能上网或还是不能和win7的主机进行通信,则注意下下面的几个注意事项

<1>推荐win7主机和virtualbox的ubuntu虚拟机用桥接的方式连接
<2>在virtualbox的虚拟机设置的网络中,注意网卡要和win7主机上网用的网卡一致
<3>虚拟机设置网络设置的高级中,把混杂模式改为全部允许。
<4>实在不行,就把网络设置中的插入网线也勾选上(没有根据,纯属瞎说的,还是不要信这条了)
<5>最后别忘记重启,可能有些设置项是要重启ubuntu才能生效的。
分享本文至:

WRITTEN BY

avatar
本文标签:ubuntu虚拟机
看了本文是不是觉得很赞,那就赶紧点击下面按钮分享给身边的朋友吧!

10 条评论

  1. avatar michaelphenow

    <a href="http://www.swnblog.com/billig-nike-hyperdunk-2015-dam%C3%A4nner-grau-skob">billig nike hyperdunk 2015 dam盲nner grau</a> <a href="http://www.weimpactmds.com/minnesota-vikings-new-era-nfl-on-field-59fifty-cap-purple-hatc">minnesota vikings new era nfl on field 59fifty cap purple</a> <a href="http://www.relsflorida.com/yeezy-boost-350-infant-pirate-black-man-runninge">yeezy boost 350 infant pirate black man</a> <a href="http://www.votuongluan.com/air-jordan-4-retro-hvid-metalleic-s%C3%B8lv-schuhea">air jordan 4 retro hvid metalleic s酶lv</a> <a href="http://www.hanayaflowers.com/nike-free-5.0-mujeres-amarillo-rosado-scarpec">nike free 5.0 mujeres amarillo rosado</a> <a href="http://www.jlchatlaw.com/nike-air-max-2019-green-uk-shoeso">nike air max 2019 green uk</a>
    michaelphenow http://www.michaelphenow.com/

  2. avatar p4vepcy8

    <a href="http://www.3191jzrh.com/air-jordan-2-quai-54-for-vente-bon-march%C3%A9-butya">air jordan 2 quai 54 for vente bon march茅</a> <a href="http://www.te73uevz.com/dam%C3%A4nner-adidas-superstar-lila-butya">dam盲nner adidas superstar lila</a> <a href="http://www.1wk531nc.com/jordan-retro-5-gris-hombres-obuvd">jordan retro 5 gris hombres</a> <a href="http://www.miuwhy36.com/nike-air-zoom-total-90-iii-sort-kit-scarpec">nike air zoom total 90 iii sort kit</a> <a href="http://www.yoes39mj.com/nike-roshe-run-hyp-rosa-svart-schuhef">nike roshe run hyp rosa svart</a> <a href="http://www.bm067skf.com/yeezy-boost-350-lyser%C3%B8d-and-sort-scarpef">yeezy boost 350 lyser酶d and sort</a>
    p4vepcy8 http://www.p4vepcy8.com/

  3. avatar solarishelp

    <a href="http://www.hitsturbines.com/b%C3%B8rn-adidas-light-up-sko-lilla-butya">b酶rn adidas light up sko lilla</a> <a href="http://www.jadamsrealtor.com/olive-camo-alfred-morris-mens-limited-jersey-46-nike-nfl-san-francisco-49ers-2017-salute-to-service-nflu">olive camo alfred morris mens limited jersey 46 nike nfl san francisco 49ers 2017 salute to service</a> <a href="http://www.karenconti.com/kvinners-nike-free-run-5.0-v4-rosa-r%C3%B8d-kurpesb">kvinners nike free run 5.0 v4 rosa r酶d</a> <a href="http://www.cliffsears.com/adidas-pr%C3%B8dator-futsal-kaskus-schuhec">adidas pr酶dator futsal kaskus</a> <a href="http://www.rfsloan.com/nike-lebron-witness-lilla-rosa-schuheg">nike lebron witness lilla rosa</a> <a href="http://www.gfwholesalers.com/hombres-air-max-90-zapatilla-de-deporteboot-blanco-rojo-kurpesc">hombres air max 90 zapatilla de deporteboot blanco rojo</a>
    solarishelp http://www.solarishelp.com/

  4. avatar annomaplexel

    <a href="http://www.swnblog.com/nike-youth-noah-spence-limited-white-road-jersey-tampa-bay-buccaneers-nfl-57-vapor-untouchable-nflr">nike youth noah spence limited white road jersey tampa bay buccaneers nfl 57 vapor untouchable</a> <a href="http://www.weimpactmds.com/pink-green-womens-adidas-adizero-f50-trx-shoes-skoa">pink green womens adidas adizero f50 trx shoes</a> <a href="http://www.relsflorida.com/nike-pegasus-27-woman-sneakere">nike pegasus 27 woman</a> <a href="http://www.votuongluan.com/billig-air-jordan-4-cem%C3%A6ndt-kurpesa">billig air jordan 4 cem忙ndt</a> <a href="http://www.hanayaflowers.com/nike-kyrie-3-womens-green-red-sneakerb">nike kyrie 3 womens green red</a> <a href="http://www.jlchatlaw.com/nike-cortez-black-gray-floral-shoesg">nike cortez black gray floral</a>
    [url=http://www.annomaplexel.com/]annomaplexel[/url]

  5. avatar labizcoach

    <a href="http://www.stevenrobins.com/ovo-kyle-lowry-jersey-nflr">ovo kyle lowry jersey</a> <a href="http://www.transgloball.com/gold-blue-mens-adidas-predator-soccer-shoes-foote">gold blue mens adidas predator soccer shoes</a> <a href="http://www.wsphotel.com/vintage-prada-shoulder-bags-jp-pradab">vintage prada shoulder bags jp</a> <a href="http://www.hispanolab.com/mulberry-bayswater-buckle-oak-florida-mulberrya">mulberry bayswater buckle oak florida</a> <a href="http://www.peoplesbit.com/billig-nike-air-max-1-dam%C3%A4nner-gr%C3%BCn-sneakere">billig nike air max 1 dam盲nner gr眉n</a> <a href="http://www.redrockrose.com/used-hermes-bracelet-hermesr">used hermes bracelet</a>
    labizcoach http://www.labizcoach.com/

  6. avatar 全智贤代言

    前来学习了哈哈!

  7. avatar 新青年摄影

    学习了

  8. avatar 屠龙

    提供的很具体,知道怎么设置了

  9. avatar 柳丹莹博客

    来博主的博客,学到了很多知识。

欢迎留言




用户登录

sitemap