• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Virtualbox
 

Virtualbox

on

  • 1,574 views

virtualbox 分析

virtualbox 分析

Statistics

Views

Total Views
1,574
Views on SlideShare
1,574
Embed Views
0

Actions

Likes
0
Downloads
14
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Virtualbox Virtualbox Presentation Transcript

    • VirtualBox http://www.virtualbox.org/
      • Cfddream
      • 2011-04-14
      • 为什么用?
        • 工作
        • 学习、研究
      • 怎么用?
    • 搭建虚拟环境
      • OS
        • Host -- Windows
        • Guest – Debian, Archlinux etc.
      • Create
          • 控制 -> 新建 -> 下一步 -> 下一步。。。 -> 完成
          • 载入 iso 镜像文件
    • Start
        • Install os
          • 选择语言、设置键盘、设置 root 密码、创建新用户及密码、时区、分区(选择默认即可)、安装包、选择镜像
    • Network - NAT
        • NAT 网络地址转换 (Network Address Translation)
        • Host IP: 192.168.1.102
        • Guest IP: 10.0.2.15
        • Gateway: 10.0.2.255
        • DNS: 10.0.2.3
          • cfd@ubuntu:~$ ifconfig eth0
          • eth0 Link encap:Ethernet
          • HWaddr 08:00:27:da:22:43
          • inet addr:10.0.2.15
          • Bcast:10.0.2.255 Mask:255.255.255.0…
          • Inter addr = ip 地址 bcast = 网关 mask = 子网掩码
    • Net Host Guest 缺点:对公网不可见,只能通过 Host 做端口映射 / 转发 优点 : 不管主机是否连上网线,都可以通过端口转发进行通信。
    • Network – Bridged Adapter
      • Bridged Adapter 桥接
      • Host IP: 192.168.1.102
      • Guest IP: 192.168.1.103
      • Gateway: 192.168.1.255
      • Mask: 255.255.255.0
    • Net Host Guest Guest IP: 由 DHCP 自动分配,与主机同一网段。虚拟机与主机可以相互通信。也可以采用 固定 ip 的方式, 缺点:主机没联网,与虚拟机就不能进行通信。  优点:同一网段,可以直接通信。
    • Network - Host-Only
          • Host IP: 192.168.56.1
          • Server IP: 192.168.56.100
          • Guest IP: 192.168.56.101
          • Gateway: 192.168.56.255
          • Mask: 255.255.255.0
      cfd@ubuntu:~$ ifconfig eth0 eth0 Link encap:Ethernet HWaddr 08:00:27:da:22:43 inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0
    • Net Host Guest Host-Only Guest 只能与 Host 相互通信,无法连外网, Guest 的网卡连接到 VirtualBox 的 vboxnet0 网卡, Host 与 Guest 共同使用 Host-Only 这张网卡,并且进行通信   缺点:虚拟机不能联网   优点:同一网段,可以直接通信。
    • Network - Internal 内部网络
      • 虚拟机与外网完全断开
    • 搭建 1-Host, N-Guests
      • NAT: Guests 之间只能通过 Host 端口转发
      • BA: Host 联网,才能建立通信
      • HO: Guests 无法联网
      • NAT+HO( 推荐 ): Guests 无需借助 Host 的端口转发
    • NAT+HO Example Host : windows Guests : network : 同时开启双网卡          eth0(NAT) dhcp          eth1(Host-Only) dhcp/static ip
      • Guest1 : debian
      • Network config: /etc/network/interfaces
      NAT+HO Example Static: allow-hotplug eth0   iface eth0 inet dhcp auto eth1 iface eth1 inet static address 192.168.56.101 netmask 255.255.255.0 Dhcp: allow-hotplug eth0   iface eth0 inet dhcp allow-hotplug eth1   iface eth1 inet dhcp
    • NAT+HO Example
      • Guest2 : Archlinux
      • Network config: /etc/rc.conf
      Dhcp: eth0="dhcp" eth1="dhcp" INTERFACES=(eth0 eth1) Static: eth0="dhcp" eth1="eth1 192.168.56.102 netmask 255.255.255.0 broadcast 192.168.56.255" INTERFACES=(eth0 eth1)
    • NAT+HO Example
      • Commands :
      • 检查通信: ping –c3 www.g.cn
      • 编辑 network config: sudo vi /etc/network/interfaces
      • 所有网卡状态: sudo ifconfig –a
      • 某网卡状态: ifconfig eth0
      • 开启 / 关闭网卡: sudo ifconfig eth0 down | up
      • 移动 vdi 虚拟磁盘,无法联网的 bug: sudo rm /etc/udev/rules.d/*-net.rules
      • 路由: route –n
      • 端口: netstart –lnpt
            • 联网:
            • debian -  /etc/init.d/networking stop | start | restart
            • archlinux -  /etc/rc.d/network stop | start | restart
            • sshd:
            • debian - sudo service sshd start | stop | restart
            • archlinux – sudo /etc/rc.d/sshd start | stop | restart
            • ssh: ssh –p 22 [email_address] | ssh –l cfd 192.168.56.101
    • NAT+HO Example
      • Debian web server
      • sudo aptitude install -y apache2
      • sudo aptitude install -y php5
      • web dir: /var/www
      • Archlinux web server
      • https://wiki.archlinux.org/index.php/LAMP
    • NAT+HO Example
      • Tools:
        • Putty
        • secureCRT
    • Thanks!
      • cfddream [at] gmail [dot] com
      • My dotfiles By githum.com
      • virtualbox 笔记 .txt