OS/Linux

Virtual Box Port Forwarding

아르비스 2010. 10. 19. 09:33
* Port Forwarding 설정
$ VBoxManage modifyvm "ubuntu" --natpf1 "guesthttp,tcp,,8000,,8000"

"ubuntu"  : Virtual Image 이름

"guesthttp" : Port Forwarding name

"tcp" : 전송방식  (tcp/udp)

host ip = , host port = 8000, guest ip = , guest port = 8000

virtualBox image를 unload 한뒤에 실행 함.


* Port Forwarding 해제
$ VBoxManage modifyvm "VM name" --natpf1 delete "guesthttp"

"VM name" : setting한 Virtual image name

"guesthttp" : 위에서 설정한 name


* 설정된 Port Forwarding을 확인하는 방법
$ VBoxManage showvminfo "WinXP"

"WinXP" : Virtual image name

IDE Controller (0, 0): /home1/redmine/.VirtualBox/HardDisks/WinXP_for_Redmine.vdi (UUID: dbd8f67f-4c80-49ca-b6d7-f9553c0e793f)
IDE Controller (1, 0): Empty
NIC 1:           MAC: 080027B77C98, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: Am79C973, Reported speed: 0 Mbps, Boot priority: 0
NIC 1 Settings:  MTU: 0, Socket( send: 64, receive: 64), TCP Window( send:64, receive: 64)
NIC 1 Rule(0):   name = guestmy, protocol = tcp, host ip = , host port = 3366, guest ip = , guest port = 3306
NIC 1 Rule(1):   name = guestmysql, protocol = tcp, host ip = , host port = 3366, guest ip = , guest port = 3306
NIC 1 Rule(2):   name = guestmysql1, protocol = tcp, host ip = , host port = 3366, guest ip = , guest port = 3306
NIC 1 Rule(3):   name = guestsmtp, protocol = tcp, host ip = , host port = 25, guest ip = , guest port = 25
NIC 1 Rule(4):   name = guestsql, protocol = tcp, host ip = , host port = 3366, guest ip = , guest port = 3306
NIC 1 Rule(5):   name = guestsql1, protocol = tcp, host ip = , host port = 3366, guest ip = , guest port = 3306
NIC 1 Rule(6):   name = guestsql2, protocol = tcp, host ip = , host port = 3366, guest ip = , guest port = 3306
NIC 1 Rule(7):   name = guestsqlmy, protocol = tcp, host ip = , host port = 5306, guest ip = , guest port = 3306
NIC 1 Rule(8):   name = guestssh, protocol = tcp, host ip = , host port = 8088, guest ip = , guest port = 80
NIC 1 Rule(9):   name = guesttempsql, protocol = tcp, host ip = , host port = 8306, guest ip = , guest port = 3306
NIC 1 Rule(10):   name = guestter, protocol = tcp, host ip = , host port = 3389, guest ip = , guest port = 3389
NIC 1 Rule(11):   name = guestter1, protocol = udp, host ip = , host port = 3389, guest ip = , guest port = 3389
NIC 1 Rule(12):   name = guestvnc, protocol = tcp, host ip = , host port = 5800, guest ip = , guest port = 5800
NIC 1 Rule(13):   name = guestvnc1, protocol = tcp, host ip = , host port = 5900, guest ip = , guest port = 5900
NIC 2:           disabled
NIC 3:           disabled


위와 같이 설정했던 port forwarding name을 확인 할 수 있음.

* Virtual machine (image)를 확인하는 방법
$ VBoxManage list vms

"ubuntu" {7b6c0b84-9070-4e64-9bc1-af659c1f5efb}
"WinXP" {42d7216a-1b7c-4376-a46c-719f9363c212}
"new_lab_backend" {edf1e2ee-1c8a-4f5d-957f-3adda9e25e6b} 

위와 같은 형태로 machine image를 보여줌.