SlideShare a Scribd company logo
如何透過 NAT 連線到 guest OS

   如何使用分享資料夾



      Ying-Shiuan Pan



                        Ying­Shiuan Pan
如何透過 NAT 連線到 guest OS
   Where is the VM profile?
   open­ssh server
   What is NAT?
   Add port forwarding rule
   Try to connect to guest Os

    疑難排解
   Reference


                                 Ying­Shiuan Pan
Where is the VM profile?
   Windows XP
          C:Documents and
            Settings???.VirtualBox
   Linux
          /home/???/.VirtualBox


   each VM's profile in 
          .VirtualBox/Machines/VM_name
                 VM_name.xml

                                       Ying­Shiuan Pan
ssh server

    安裝
         $ sudo apt-get install openssh-
           server

   啟動 ssh server ( 也許需要 )
         $ sudo /etc/init.d/ssh restart


    測試
         $ ssh localhost


                                     Ying­Shiuan Pan
What is NAT?




鳥哥
http://linux.vbird.org/linux_server/0250simple_firewall.php


                                                              Ying­Shiuan Pan
Check your NIC type




                      Ying­Shiuan Pan
Plan your port forwarding rule
   What is the name of your guest OS?
          eg. Ubuntu 904
   Which port in host OS?
          eg. 32790
   Which port in guest OS?
          eg. 22




                                         Ying­Shiuan Pan
add port forwarding rule
   Windows:
          開始 → 執行 → cmd
          cd "Program FilessunVirtualBox"
   Linux
          應用程式 → 附屬應用程式 → 終端機 (cht)
          Applications → Accessories → Terminal (eng)
       




                                                Ying­Shiuan Pan
add port forwarding rule
   $ VBoxManage setextradata "VM_name"
      "VBoxInternal/Devices/pcnet/0/LUN#0/Config/
      guestssh/Protocol" TCP


   $ VBoxManage setextradata "VM_name"
      "VBoxInternal/Devices/pcnet/0/LUN#0/Config/
      guestssh/GuestPort" 22


   $ VBoxManage setextradata "VM_name"
      "VBoxInternal/Devices/pcnet/0/LUN#0/Config/
      guestssh/HostPort" 32790


                                      Ying­Shiuan Pan
add port forwarding rule
   "VM_name"
         the name of the virtual machine
   pcnet
         the NIC type
                  Intel PRO... (82540em)    →    e1000
                  PCnet­FAST (Am79c973)     →    pcnet
   guestssh
         the name of the rule
   TCP, 22, 32790
         protocol, guest OS port, host OS port
                                                   Ying­Shiuan Pan
add port forwarding rule




                      Ying­Shiuan Pan
Try to connect to guest OS (1)




                          Ying­Shiuan Pan
Try to connect to guest OS (2)




                          Ying­Shiuan Pan
    Ying­Shiuan Pan
疑難排解
   從 guest OS 無法連到自己的 ssh
         確認 guest OS 的 ssh 是否打開
                從 guest OS 連線到自己試試看
   從 host 無法連線到 guest
         確認 port forwarding rule 是否正確
                查看該 VM 的 profile (.xml)
         檢查 guest OS 的防火牆是否被打開了
             
                 關掉他



                                           Ying­Shiuan Pan
疑難排解
   從其他電腦無法連線到 guest OS
         是否使用 IP 分享器
               外界電腦連入需要作 IP 分享器的 port forwarding
                 設定
         是否 host OS 的防火牆擋住了外面連線
            
                視不同的防火牆作設定




                                         Ying­Shiuan Pan
Reference
   http://log­keep.blogspot.com/2007/09/virtualbox­
      nat­port­forwarding.html
   http://blog.yam.com/flyzc/article/15137400
   http://koukaipan.pixnet.net/blog/post/23993776




                                           Ying­Shiuan Pan
如何使用分享資料夾
   Install VirtualBox Guest Addiction first
   Plan your shared folder
   Add your shared folder
   Mount your shared folder




                                               Ying­Shiuan Pan
Plan your shared folder
   Directory in host OS
          /data/vbox_shared          (a)


   Directory in guest OS
          /mnt/vbox_shared           (b)


   The name of the shred directory
          vbox_shared                (c)

                                       Ying­Shiuan Pan
Add your shared folder




               (a)
               (c)



                     Ying­Shiuan Pan
Mount the shared folder
   Create mount point
                                           (b)
              $ sudo mkdir /mnt/vbox_shared
   Do mount
              $ sudo mount -t vboxsf (c)
                vbox_shared /mnt/vbox_shared (b)
   test
              $ cd /mnt/vbox_shared (b)
              $ ls


                                                 Ying­Shiuan Pan
screenshot




             Ying­Shiuan Pan

More Related Content

What's hot

Ruby on Windows (uru/RubyInstaller/Devkit)
Ruby on Windows (uru/RubyInstaller/Devkit)Ruby on Windows (uru/RubyInstaller/Devkit)
Ruby on Windows (uru/RubyInstaller/Devkit)
Shigeru UCHIYAMA
 
MQTTS mosquitto - cheat sheet -
MQTTS mosquitto - cheat sheet -MQTTS mosquitto - cheat sheet -
MQTTS mosquitto - cheat sheet -
Naoto MATSUMOTO
 
Aloofix
AloofixAloofix
Aloofix
Kevin Johnson
 
Hybrid (Windows + Linux) Apps with Docker Swarm
Hybrid (Windows + Linux) Apps with Docker SwarmHybrid (Windows + Linux) Apps with Docker Swarm
Hybrid (Windows + Linux) Apps with Docker Swarm
Runcy Oommen
 
How to twist a IPv6 over Bluetooth (6lowpan)
How to twist a IPv6 over Bluetooth (6lowpan) How to twist a IPv6 over Bluetooth (6lowpan)
How to twist a IPv6 over Bluetooth (6lowpan)
Naoto MATSUMOTO
 
LinuxをインストールしてWebサーバーを立ち上げてみよう【OSC2018 Tokyo/Spring】
LinuxをインストールしてWebサーバーを立ち上げてみよう【OSC2018 Tokyo/Spring】LinuxをインストールしてWebサーバーを立ち上げてみよう【OSC2018 Tokyo/Spring】
LinuxをインストールしてWebサーバーを立ち上げてみよう【OSC2018 Tokyo/Spring】
Masataka Tsukamoto
 
VirtualBox Ubuntu Host Windows Guest
VirtualBox Ubuntu Host Windows GuestVirtualBox Ubuntu Host Windows Guest
VirtualBox Ubuntu Host Windows Guest
aindilis
 
Building a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitchBuilding a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitch
Goran Cetusic
 
OSS AWS 핸즈온 강의
OSS AWS 핸즈온 강의OSS AWS 핸즈온 강의
OSS AWS 핸즈온 강의
Juhong Jung
 
Introduction to Node.js - March 2015
Introduction to Node.js - March 2015Introduction to Node.js - March 2015
Introduction to Node.js - March 2015
daniel miller
 
Proxmox for DevOps
Proxmox for DevOpsProxmox for DevOps
Proxmox for DevOps
Jorge Moratilla Porras
 
Docker e postgresql
Docker e postgresqlDocker e postgresql
Docker e postgresql
Fernando Ike
 
Building a moat bastion server
Building a moat   bastion serverBuilding a moat   bastion server
Building a moat bastion servernseemiller
 
Docker techzone
Docker techzoneDocker techzone
Docker techzone
Bjørn Nordlund
 
Proxmox ve-datasheet
Proxmox ve-datasheetProxmox ve-datasheet
Proxmox ve-datasheet
Miguel Angel
 
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
NLJUG
 
Docker Insight
Docker InsightDocker Insight
Docker Insight
Tiago Pires
 
Node Web Development 2nd Edition: Chapter2 Setup Node and NPM
Node Web Development 2nd Edition: Chapter2 Setup Node and NPMNode Web Development 2nd Edition: Chapter2 Setup Node and NPM
Node Web Development 2nd Edition: Chapter2 Setup Node and NPM
Rick Chang
 

What's hot (20)

Ruby on Windows (uru/RubyInstaller/Devkit)
Ruby on Windows (uru/RubyInstaller/Devkit)Ruby on Windows (uru/RubyInstaller/Devkit)
Ruby on Windows (uru/RubyInstaller/Devkit)
 
MQTTS mosquitto - cheat sheet -
MQTTS mosquitto - cheat sheet -MQTTS mosquitto - cheat sheet -
MQTTS mosquitto - cheat sheet -
 
Aloofix
AloofixAloofix
Aloofix
 
Hybrid (Windows + Linux) Apps with Docker Swarm
Hybrid (Windows + Linux) Apps with Docker SwarmHybrid (Windows + Linux) Apps with Docker Swarm
Hybrid (Windows + Linux) Apps with Docker Swarm
 
How to twist a IPv6 over Bluetooth (6lowpan)
How to twist a IPv6 over Bluetooth (6lowpan) How to twist a IPv6 over Bluetooth (6lowpan)
How to twist a IPv6 over Bluetooth (6lowpan)
 
LinuxをインストールしてWebサーバーを立ち上げてみよう【OSC2018 Tokyo/Spring】
LinuxをインストールしてWebサーバーを立ち上げてみよう【OSC2018 Tokyo/Spring】LinuxをインストールしてWebサーバーを立ち上げてみよう【OSC2018 Tokyo/Spring】
LinuxをインストールしてWebサーバーを立ち上げてみよう【OSC2018 Tokyo/Spring】
 
VirtualBox Ubuntu Host Windows Guest
VirtualBox Ubuntu Host Windows GuestVirtualBox Ubuntu Host Windows Guest
VirtualBox Ubuntu Host Windows Guest
 
Building a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitchBuilding a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitch
 
20111126 ns2 installation
20111126 ns2 installation20111126 ns2 installation
20111126 ns2 installation
 
OSS AWS 핸즈온 강의
OSS AWS 핸즈온 강의OSS AWS 핸즈온 강의
OSS AWS 핸즈온 강의
 
Virtualbox and Mysql
Virtualbox and MysqlVirtualbox and Mysql
Virtualbox and Mysql
 
Introduction to Node.js - March 2015
Introduction to Node.js - March 2015Introduction to Node.js - March 2015
Introduction to Node.js - March 2015
 
Proxmox for DevOps
Proxmox for DevOpsProxmox for DevOps
Proxmox for DevOps
 
Docker e postgresql
Docker e postgresqlDocker e postgresql
Docker e postgresql
 
Building a moat bastion server
Building a moat   bastion serverBuilding a moat   bastion server
Building a moat bastion server
 
Docker techzone
Docker techzoneDocker techzone
Docker techzone
 
Proxmox ve-datasheet
Proxmox ve-datasheetProxmox ve-datasheet
Proxmox ve-datasheet
 
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
Gebruik dezelfde Docker container voor Java applicaties tijdens ontwikkelen e...
 
Docker Insight
Docker InsightDocker Insight
Docker Insight
 
Node Web Development 2nd Edition: Chapter2 Setup Node and NPM
Node Web Development 2nd Edition: Chapter2 Setup Node and NPMNode Web Development 2nd Edition: Chapter2 Setup Node and NPM
Node Web Development 2nd Edition: Chapter2 Setup Node and NPM
 

Similar to using Virtualbox NAT and shared folder

OVN 設定サンプル | OVN config example 2015/12/27
OVN 設定サンプル | OVN config example 2015/12/27OVN 設定サンプル | OVN config example 2015/12/27
OVN 設定サンプル | OVN config example 2015/12/27
Kentaro Ebisawa
 
VM.ppt
VM.pptVM.ppt
VM.ppt
SexyOne1
 
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
Ruoshi Ling
 
Introduction to vSphere APIs Using pyVmomi
Introduction to vSphere APIs Using pyVmomiIntroduction to vSphere APIs Using pyVmomi
Introduction to vSphere APIs Using pyVmomi
Michael Rice
 
NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin
Davide Cioccia
 
Linux Containers From Scratch: Makfile MicroVPS
Linux Containers From Scratch: Makfile MicroVPSLinux Containers From Scratch: Makfile MicroVPS
Linux Containers From Scratch: Makfile MicroVPS
joshuasoundcloud
 
5. hands on - building local development environment with Open Mano
5. hands on - building local development environment with Open Mano5. hands on - building local development environment with Open Mano
5. hands on - building local development environment with Open Mano
videos
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environment
bocribbz
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for real
Codemotion
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
Michele Orselli
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with Vagrant
Brian Hogan
 
Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de Vagrant
Leandro Nunes
 
VMWare VSphere4 Documentation Notes
VMWare VSphere4 Documentation NotesVMWare VSphere4 Documentation Notes
VMWare VSphere4 Documentation NotesGrit Suwa
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Partner S.A.
 
Pythonic Deployment with Fabric 0.9
Pythonic Deployment with Fabric 0.9Pythonic Deployment with Fabric 0.9
Pythonic Deployment with Fabric 0.9
Corey Oordt
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
Michele Orselli
 
LOAD BALANCING OF APPLICATIONS USING XEN HYPERVISOR
LOAD BALANCING OF APPLICATIONS  USING XEN HYPERVISORLOAD BALANCING OF APPLICATIONS  USING XEN HYPERVISOR
LOAD BALANCING OF APPLICATIONS USING XEN HYPERVISOR
Vanika Kapoor
 
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu ServerForget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server
aaroncouch
 
Small Python Tools for Software Release Engineering
Small Python Tools for Software Release EngineeringSmall Python Tools for Software Release Engineering
Small Python Tools for Software Release Engineering
pycontw
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabricandymccurdy
 

Similar to using Virtualbox NAT and shared folder (20)

OVN 設定サンプル | OVN config example 2015/12/27
OVN 設定サンプル | OVN config example 2015/12/27OVN 設定サンプル | OVN config example 2015/12/27
OVN 設定サンプル | OVN config example 2015/12/27
 
VM.ppt
VM.pptVM.ppt
VM.ppt
 
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
當專案漸趕,當遷移也不再那麼難 (Ship Your Projects with Docker EcoSystem)
 
Introduction to vSphere APIs Using pyVmomi
Introduction to vSphere APIs Using pyVmomiIntroduction to vSphere APIs Using pyVmomi
Introduction to vSphere APIs Using pyVmomi
 
NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin
 
Linux Containers From Scratch: Makfile MicroVPS
Linux Containers From Scratch: Makfile MicroVPSLinux Containers From Scratch: Makfile MicroVPS
Linux Containers From Scratch: Makfile MicroVPS
 
5. hands on - building local development environment with Open Mano
5. hands on - building local development environment with Open Mano5. hands on - building local development environment with Open Mano
5. hands on - building local development environment with Open Mano
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environment
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for real
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with Vagrant
 
Minicurso de Vagrant
Minicurso de VagrantMinicurso de Vagrant
Minicurso de Vagrant
 
VMWare VSphere4 Documentation Notes
VMWare VSphere4 Documentation NotesVMWare VSphere4 Documentation Notes
VMWare VSphere4 Documentation Notes
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: Introduction
 
Pythonic Deployment with Fabric 0.9
Pythonic Deployment with Fabric 0.9Pythonic Deployment with Fabric 0.9
Pythonic Deployment with Fabric 0.9
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
LOAD BALANCING OF APPLICATIONS USING XEN HYPERVISOR
LOAD BALANCING OF APPLICATIONS  USING XEN HYPERVISORLOAD BALANCING OF APPLICATIONS  USING XEN HYPERVISOR
LOAD BALANCING OF APPLICATIONS USING XEN HYPERVISOR
 
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu ServerForget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server
 
Small Python Tools for Software Release Engineering
Small Python Tools for Software Release EngineeringSmall Python Tools for Software Release Engineering
Small Python Tools for Software Release Engineering
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 

using Virtualbox NAT and shared folder

  • 1. 如何透過 NAT 連線到 guest OS 如何使用分享資料夾 Ying-Shiuan Pan   Ying­Shiuan Pan
  • 2. 如何透過 NAT 連線到 guest OS  Where is the VM profile?  open­ssh server  What is NAT?  Add port forwarding rule  Try to connect to guest Os  疑難排解  Reference   Ying­Shiuan Pan
  • 3. Where is the VM profile?  Windows XP  C:Documents and Settings???.VirtualBox  Linux  /home/???/.VirtualBox  each VM's profile in   .VirtualBox/Machines/VM_name  VM_name.xml   Ying­Shiuan Pan
  • 4. ssh server  安裝  $ sudo apt-get install openssh- server  啟動 ssh server ( 也許需要 )  $ sudo /etc/init.d/ssh restart  測試  $ ssh localhost   Ying­Shiuan Pan
  • 6. Check your NIC type   Ying­Shiuan Pan
  • 7. Plan your port forwarding rule  What is the name of your guest OS?  eg. Ubuntu 904  Which port in host OS?  eg. 32790  Which port in guest OS?  eg. 22   Ying­Shiuan Pan
  • 8. add port forwarding rule  Windows:  開始 → 執行 → cmd  cd "Program FilessunVirtualBox"  Linux  應用程式 → 附屬應用程式 → 終端機 (cht)  Applications → Accessories → Terminal (eng)    Ying­Shiuan Pan
  • 9. add port forwarding rule  $ VBoxManage setextradata "VM_name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ guestssh/Protocol" TCP  $ VBoxManage setextradata "VM_name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ guestssh/GuestPort" 22  $ VBoxManage setextradata "VM_name" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ guestssh/HostPort" 32790   Ying­Shiuan Pan
  • 10. add port forwarding rule  "VM_name"  the name of the virtual machine  pcnet  the NIC type  Intel PRO... (82540em)  → e1000  PCnet­FAST (Am79c973)  → pcnet  guestssh  the name of the rule  TCP, 22, 32790  protocol, guest OS port, host OS port   Ying­Shiuan Pan
  • 11. add port forwarding rule   Ying­Shiuan Pan
  • 12. Try to connect to guest OS (1)   Ying­Shiuan Pan
  • 13. Try to connect to guest OS (2)   Ying­Shiuan Pan
  • 14.   Ying­Shiuan Pan
  • 15. 疑難排解  從 guest OS 無法連到自己的 ssh  確認 guest OS 的 ssh 是否打開  從 guest OS 連線到自己試試看  從 host 無法連線到 guest  確認 port forwarding rule 是否正確  查看該 VM 的 profile (.xml)  檢查 guest OS 的防火牆是否被打開了  關掉他   Ying­Shiuan Pan
  • 16. 疑難排解  從其他電腦無法連線到 guest OS  是否使用 IP 分享器  外界電腦連入需要作 IP 分享器的 port forwarding 設定  是否 host OS 的防火牆擋住了外面連線  視不同的防火牆作設定   Ying­Shiuan Pan
  • 17. Reference  http://log­keep.blogspot.com/2007/09/virtualbox­ nat­port­forwarding.html  http://blog.yam.com/flyzc/article/15137400  http://koukaipan.pixnet.net/blog/post/23993776   Ying­Shiuan Pan
  • 18. 如何使用分享資料夾  Install VirtualBox Guest Addiction first  Plan your shared folder  Add your shared folder  Mount your shared folder   Ying­Shiuan Pan
  • 19. Plan your shared folder  Directory in host OS  /data/vbox_shared (a)  Directory in guest OS  /mnt/vbox_shared (b)  The name of the shred directory  vbox_shared (c)   Ying­Shiuan Pan
  • 20. Add your shared folder (a) (c)   Ying­Shiuan Pan
  • 21. Mount the shared folder  Create mount point (b)  $ sudo mkdir /mnt/vbox_shared  Do mount  $ sudo mount -t vboxsf (c) vbox_shared /mnt/vbox_shared (b)  test  $ cd /mnt/vbox_shared (b)  $ ls   Ying­Shiuan Pan
  • 22. screenshot   Ying­Shiuan Pan