📃
Anggi's Notes
  • Tentang Penulis
  • Preambule
  • Tutorial Red Team Area (General)
    • Tutorial Setup VirtualBox
    • Tutorial Setup Kali Linux pada VirtualBox
    • Network Adapter Type pada Virtual Box
    • Tutorial Port Forwarding Pada Virtual Box
    • Mempercepat update/upgrade/install Kali Linux
    • Networking in a Nutshell
    • Linux in A Nutshell
    • Linux Command Intro
    • VA-PT Cheatsheet
    • Penetration Testing Guide & Checklist
    • Pentesting Web checklist
    • NMAP Cheatsheet
    • Bind vs Reverse Shell Concept
    • Reverse Shell Cheatsheet
    • Linux TTY Shell Cheat Sheet
    • Menaikkan Common Shell ke Meterpreter
    • Metasploit Cheatsheet
      • msfvenom
      • searchploit
    • Metasploitable-2
    • Metasploitable-3
    • Linux Privilege Escalation
      • Linux Privilege Escalation with Misconfigured /etc/passwd
      • Linux Privilege Escalation with SUID
      • Linux Privilege Escalation with Misconfigured Sudo
      • Linux Privilege Escalation with MSF
    • DVWA
      • Brute Force
        • Low
        • Medium
        • High
      • Command Injection
        • Low
        • Medium
        • High
      • Local File Inclusion
        • Low
        • Medium
        • High
      • File Upload Vulnerability
        • Low
        • Medium
        • High
      • Cross Site Scripting (XSS)
        • Reflected
          • Low
          • Medium
          • High
        • Stored
          • Low
          • Medium
          • High
        • DOM
          • Low
          • Medium
          • High
      • SQL Injection
        • Non Blind
          • Low
          • Medium
          • High
        • Blind
          • Low
          • Medium
          • High
      • CSRF
        • Low
        • Medium
        • High
    • Pentesting Report Sample
    • Tutorial Penggunaan ZAP
    • Windows VA/Audit
      • DetExploit
      • HardeningKitty
      • Tutorial Installasi OWASP ZAP pada Windows OS
    • Linux VA/Audit dengan Lynis
    • Mobile Security Framework (MobSF) Windows Docker
  • Tutorial Red Team Area (Teknik Windows Attack )
    • Reconnaissance Techniques
    • Windows Red Team Exploitation Techniques
    • Windows Red Team Defense Evasion Techniques
  • Tutorial Blue Team Area
    • Merancang SOC
    • IR Playbook
    • Blue Team Opensource Online Tools
    • Wireshark Query Cheatsheet
  • Temuan Celah Keamanan
    • LFI (Directory Traversal) di redacted.co.id
    • Kredensial Database dan Azure Leaks pada redacted.com
    • HTML Injection di Tokopedia
    • 🤪4300$ Bounty from Opensource automate recon tools, why not?
    • I hacked Mastercard 4 times? But How?
    • LFI dan RCE di aset redacted.com
    • FTPd DOS di aset redacted.co.id
    • Gitlab SSRF di redacted.com
    • Firebase Android database Takeover
    • RCE di 11 Subdomain Dell
    • SSRF di redacted.com
    • Reflected XSS di CelticPipes
    • Git Disclosure di redacted.co.id
    • Open Redirection+XSS pada Private Program Bugcrowd
    • Rails Debug Mode Enabled pada redacted.com
Powered by GitBook
On this page
  • Using the Forwarded Port
  • Other Ports to Forward
  • An Alternate Solution: Setting up a Bridged Adapter

Was this helpful?

  1. Tutorial Red Team Area (General)

Tutorial Port Forwarding Pada Virtual Box

Sumber: https://travishorn.com

PreviousNetwork Adapter Type pada Virtual BoxNextMempercepat update/upgrade/install Kali Linux

Last updated 7 months ago

Was this helpful?

By default, virtual machines running inside VirtualBox use a virtual network adapter attached to NAT. This means that the machine is not accessible on your host network, but rather a virtual network inside of the host computer. Any time you need to connect to your virtual machine remotely (whether by SSH, HTTP, or another protocol), you'll need to make sure the appropriate port is forwarded from your host machine. Here's how to do that.

Open Oracle VM VirtualBox Manager on the host machine.

Click to select the virtual machine from the list on the left.

Click the Settings button.

Click Network from the pane on the left.

Under the Adapter 1 tab, click Advanced.

Click Port Forwarding.

Click the Adds new port forwarding rule. button. It's on the right side.

In the table on the left, double-click Rule 1. This will allow you to edit the name of the rule. Type in the name of the service. For example, SSH.

Under Host Port, enter the port number you want the host machine to listen on. This can be anything, but for simplicity, I recommend using the same as the guest port. For SSH, use port 22.

If you have multiple virtual machines which you will be SSHing into, or you already have an SSH server running on the host machine itself, you may want to enter a different Host Port. In that case, choose any number you like between 1024 and 49152. Just make sure it is not in use by any other service.

Under Guest Port, enter the port number that your virtual machine is listening on. For SSH, use port 22.

Leave everything else blank.

Click OK.

Click OK again.

Using the Forwarded Port

Now, if you want to SSH into the virtual machine from the host machine, you can use something like this:

ssh username@localhost

Make sure to change username to the actual username that is set up on your virtual machine.

If you want to connect to the virtual machine from some other machine than the host, try something like this:

ssh username@host_ip_address

Change username to the actual username and change host_ip_address to the host's actual IP address. On Windows, you can determine this from the ipconfig command.

Other Ports to Forward

Some common ports you may consider forwarding are...

  • Port 21 for FTP

  • Port 22 for SSH

  • Port 80 for HTTP traffic

  • Port 443 for HTTPS traffic

  • Port 3000 which is a common development port for things like Node.js

  • Port 3306 for MySQL/MariaDB access

An Alternate Solution: Setting up a Bridged Adapter

If you want to access the virtual machine but don't want to forward any ports, you could attach the virtual network adapter to a bridged adapter. This places the virtual machine directly on the network with your other devices. It will receive its own IP address via DHCP.

Open Oracle VM VirtualBox Manager on the host machine.

Click to select the virtual machine from the list on the left.

Click the Settings button.

Click Network from the pane on the left.

Select Bridged Adapter from the Attached to dropdown menu.

Click OK.

Using a Bridged Adapter

First, you need to determine what IP address the virtual machine received via DHCP. This can most easily be done on the virtual machine.

On Linux, you can use ip addr show.

Now you can connect (via SSH, for example) to the machine using the virtual machine's IP address you just discovered.

ssh username@vm_ip_address

By unraveling the mysteries of port forwarding in VirtualBox, we have taken a significant stride toward optimizing our virtualization endeavors. We now understand how to seamlessly connect our virtual machines to the outside world. Through the step-by-step configuration process, we have simplified the process of port forwarding, making it accessible to users of all levels. We also explored some common ports, discovering which services can benefit from port forwarding, and even ventured into the realm of bridged adapters as an alternative solution.