Virtualbox networking
-
Upload
chatchai-jantaraprim -
Category
Documents
-
view
1.232 -
download
1
Transcript of Virtualbox networking
![Page 1: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/1.jpg)
PSU-LUG/Sysadmin
VirtualBox Networking
Chatchai J2013-02-28
![Page 2: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/2.jpg)
VirtualBox Networking
● เนอหาทงหมด เรยบเรยงจาก
http://www.virtualbox.org/manual/ch06.htmlChapter 6: Virtual Networking
VirtualBox Manual
![Page 3: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/3.jpg)
Virtual Networking Hardware
● อปกรณ เลยนแบบการทำางานของ hardware
– AMD PCNet PCI II (Am79C970A)
– AMD PCNet FAST III (Am79C973, the default)
– Intel PRO/1000 MT Desktop (82540EM)
– Intel PRO/1000 T Server (82543GC)
– Intel PRO/1000 MT Server (82545EM)
● ใชงานไดกบ OS ทม driver สำาหรบ hardware
จรงๆ เหลาน (แทบทก OS) – DOS?, Mac OSX?
![Page 4: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/4.jpg)
Virtual Networking Hardware (cont)
● และ– Paravirtualized network adapter (virtio-net).
● สำาหรบ OS ทรองรบการทำางานเปนแบบ Virtualized
– รองรบทง Linux, Windows รนใหม (ใชงานในปจจบน)
– Win2K ,XP ,Vista ม driver ให Download
● http://www.linux-kvm.org/page/WindowsGuestDrivers
![Page 5: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/5.jpg)
Virtual Networking Hardware (cont)
● ขอด– ไมตอง emulate การทำางานของ hardware ทไมจำาเปน
● แนะนำาใหใช virtio สำาหรบ Virtual Network Device ถา Guest OS support
– ไมจำากดวาจะตองเปน VirtualBox
● ถาตองเลอก– virtio > Intel Pro > AMD PCI
![Page 6: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/6.jpg)
Networking Mode
● Not attached● Network Address Translation (NAT)● Bridged networking● Internal networking● Host-only networking● Generic networking
![Page 7: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/7.jpg)
Networking Mode (cont)
![Page 8: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/8.jpg)
Networking Mode (cont)
● Not attached
– ม NIC แตไมตอกบเครอขายใดๆ
![Page 9: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/9.jpg)
Networking Mode (cont)
● Network Address Translation (NAT)
– default (ใช VirtualBox NAT engine)
– NIC1 => 10.0.2.0/24, NIC2 => 10.0.3.0/24● guest IP 10.0.X.15● host IP 10.0.X.2
– Gateway– DHCP Server– using host's DNS (/etc/resolv.conf)
![Page 10: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/10.jpg)
Networking Mode (cont)
● Network Address Translation (NAT)
– Network ของแตละ VM แยกเปนอสระจากกน
![Page 11: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/11.jpg)
Networking Mode (cont)
● Network Address Translation (NAT)
– การใหบรการโดย guest กบ host ภายนอก จะตองใช port forwarding
$ VBoxManage modifyvm "VM name" \ natpf1 "guestssh,tcp,,2222,,22"
– สำาหรบ ssh connection เขาไปท guest$ ssh p 2222 host
![Page 12: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/12.jpg)
Networking Mode (cont)
● Network Address Translation (NAT)– SomeLimitation
● ICMP packet● UDP Broadcast● Support mainly TCP & UDP● Forward port on host < 1024
![Page 13: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/13.jpg)
Networking Mode
● Bridged networking
– ใช host interface driver สำาหรบ filter data สงใหกบ VM interface
– การ config จะตองเลอกวา จะ bridge กบ interface ใหนของ host
![Page 14: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/14.jpg)
Networking Mode (cont)
● Bridged networking
![Page 15: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/15.jpg)
Networking Mode (cont)
![Page 16: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/16.jpg)
Bridge Networking (cont)
![Page 17: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/17.jpg)
Bridge Networking (cont)
![Page 18: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/18.jpg)
Bridge Networking (cont)
● bridge กบ wired interface บน Virtualbox จะใชวธการตางกบ wireless interface
– ถามปญหา ลองเปลยนจาก wireless → wired
● สำาหรบ Linux
– Bridge บน wireless support เฉพาะ IPv4
– Bridge อาจจะมปญหากบ VLAN (ขนอยกบ hardware ทใช)
![Page 19: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/19.jpg)
Networking Mode (cont)
● Internal networking
– implement แบบเดยวกบ bridge
– แตไมเชอมตอกบ network ภายนอก– ใชเปน “internal network” ระหวาง guest VM ดวยกน
(Virtual Switch)
– ถาตองการตอออกภายนอก อาจใช VM ทตออยกบ internal
network น เพอทำาหนาทเปน router/gateway
– ระบ network ดวยชอ
![Page 20: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/20.jpg)
Internal networking
![Page 21: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/21.jpg)
Internal networking (cont)
![Page 22: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/22.jpg)
Internal networking (cont)
![Page 23: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/23.jpg)
Internal networking (cont)
![Page 24: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/24.jpg)
Internal networking (cont)
● โดยทวไปจะใช network config แบบ static สำาหรบ guest
● หรอ setup guest ตวนง ใหเปน DHCP Server
● ถาจะใช internal dhcp server จะตองใช VboxManage
$ VBoxManage dhcpserver add netname <network_name>
![Page 25: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/25.jpg)
Networking Mode (cont)
● Host-only networking
– คลาย internal network
– สำาหรบ guest VM ทตอ host-only network เดยวกนสอสารดวยกน– เพม virtual interface ทตว host ซงตอกบ host-only network
– จะตองสราง host-only network interface ขนมากอน
![Page 26: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/26.jpg)
Host-only networking
● สราง host-only network interface
● VirtualBox Manager → Preference
→Network→Add host-only network (INS)
● vboxnet0 (สรางโดย default)
● vboxnet1
● บน host
$ /sbin/ifconfig a
![Page 27: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/27.jpg)
Host-only networking (cont)
![Page 28: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/28.jpg)
Host-only networking (cont)
![Page 29: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/29.jpg)
Host-only networking (cont)
cj@nilanont64:~$ ifconfig a
...
vboxnet0 Link encap:Ethernet HWaddr 0a:00:27:00:00:00 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
![Page 30: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/30.jpg)
Host-only networking (cont)
![Page 31: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/31.jpg)
Host-only networking (cont)
![Page 32: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/32.jpg)
Host-only networking (cont)
● host-only สามารถ กำาหนด ip address
(สำาหรบ vboxnetX interface) หรอ enable
DHCP Server (สำาหรบ vboxnetX virtual
network) ได โดยใชEdit host-only network (space)
![Page 33: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/33.jpg)
host-only networking (cont)
![Page 34: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/34.jpg)
Networking Mode (cont)
● Generic networking
– สำาหรบ Advanced Networking
● ผมกยงไมเคยใช – เลยไมรจะแนะนำายงไง (ฮา)
![Page 35: Virtualbox networking](https://reader036.fdocument.pub/reader036/viewer/2022082309/5566a6e8d8b42a643c8b4bf6/html5/thumbnails/35.jpg)
VirtualBox Networking
คำาถาม?