VirtualBox

Ticket #18495 (new defect)

Opened 17 months ago

VirtualBox NAT alias option use-same-ports (--nataliasmode1=sameports) has no effect on Ubuntu 16.04 host OS

Reported by: interfrastic Owned by:
Component: network/NAT Version: VirtualBox 6.0.4
Keywords: nat nataliasmode sameports linux Cc:
Guest type: Linux Host type: Linux

Description

Steps to reproduce

  1. Create a VirtualBox VM as follows, accepting default values for anything not listed here:
  • Name: archlinux-2019.03.01-x86_64
  • Type: Linux
  • Version: Arch Linux (64-bit)
  1. Download archlinux-2019.03.01-x86_64.iso into the VM directory:
cd 'VirtualBox VMs'/archlinux-2019.03.01-x86_64
curl -O http://mirrors.acm.wpi.edu/archlinux/iso/2019.03.01/archlinux-2019.03.01-x86_64.iso
  1. Confirm the MD5 checksum. First, display the expected checksum:
curl http://mirrors.acm.wpi.edu/archlinux/iso/2019.03.01/md5sums.txt

Verify on Linux:

md5sum archlinux-2019.03.01-x86_64.iso

Verify on macOS:

md5 archlinux-2019.03.01-x86_64.iso
  1. Start the VM in VirtualBox, click Choose a virtual optical disk file (represented by a folder icon with an upward-pointing green arrow), and select the archlinux-2019.03.01-x86_64.iso file downloaded in Step 2.
  1. Boot the VM, selecting default options for everything.
  1. On the host (64-bit Ubuntu Xenial Xerus 16.04.6 LTS), find two unused privileged (port number less than 1024) ports; for example, the following command will return nothing if both ports 1022 and 1023 are free:
netstat -Wa | grep -E '1022|1023'
  1. On the guest (64-bit Arch Linux 2019.03.01), confirm that the first free port from Step 6 is also free on the guest:
netstat -Wa | grep 1022

If this command returns any output, repeat Steps 6 and 7 until you have found two free ports.

  1. On the host (64-bit Ubuntu Xenial Xerus 16.04.6 LTS), start listening on the second free port, the receiving port:
sudo nc -l 1023
  1. On the guest (64-bit Arch Linux 2019.03.01), open a connection to the receiving port on the host, originating the connection from the first free port, the sending port:
nc -p 1022 ala-michaelk-lx1.corp.ad.wrs.com 1023

Replace ala-michaelk-lx1.corp.ad.wrs.com with the fully qualified domain name (FQDN) of the host, as returned by the hostname -f command.

After running both nc commands, any text entered on the guest should appear on the host and vice versa.

  1. In another shell on host, look for connections to the receiving port:
netstat -W | grep 1023

Initially observe that network address translation (NAT) has replaced the sending port (1022) with a random port (48946), as expected for --nataliasmode1=default:

$ netstat -W | grep 1023
tcp        0      0 ala-michaelk-lx1.corp.ad.wrs.com:1023 ala-michaelk-lx1.corp.ad.wrs.com:48946 ESTABLISHED
tcp        0      0 ala-michaelk-lx1.corp.ad.wrs.com:48946 ala-michaelk-lx1.corp.ad.wrs.com:1023 ESTABLISHED
  1. On the host (64-bit Ubuntu Xenial Xerus 16.04.6 LTS), close the connection by pressing Ctrl-D (EOF) in the shell running nc.
  1. Close the guest console window, select Save the machine state, and click OK.
  1. On host, switch the VM to --nataliasmode1=sameports:
VBoxManage modifyvm archlinux-2019.03.01-x86_64 --nataliasmode1=sameports
  1. In VirtualBox, click Start to restore the VM.
  1. Repeat Steps 8–11.

Expected

The port number for the sending port (1022) is preserved, as seen on host macOS Mojave Version 10.14.3:

inu:~ michael$ netstat -W | grep 1023
tcp4       0      0  inu.corp.ad.wrs.com.1023  inu.corp.ad.wrs.com.1022  ESTABLISHED
tcp4       0      0  inu.corp.ad.wrs.com.exp2  inu.corp.ad.wrs.com.1023  ESTABLISHED

Observed

The port number for the sending port (1022) is replaced with a random port number, as seen on host 64-bit Ubuntu Xenial Xerus 16.04.6 LTS:

$ netstat -W | grep 1023
tcp        0      0 ala-michaelk-lx1.corp.ad.wrs.com:48972 ala-michaelk-lx1.corp.ad.wrs.com:1023 ESTABLISHED
tcp        0      0 ala-michaelk-lx1.corp.ad.wrs.com:1023 ala-michaelk-lx1.corp.ad.wrs.com:48972 ESTABLISHED

Attachments

archlinux-2019.03.01-x86_64-2019-03-14-12-28-34.log Download (71.6 KB) - added by interfrastic 17 months ago.
Failure case log file for host OS 64-bit Ubuntu Xenial Xerus 16.04.6 LTS
archlinux-2019.03.01-x86_64-2019-03-14-13-10-53.log Download (78.1 KB) - added by interfrastic 17 months ago.
Success case log file for host OS macOS Mojave Version 10.14.3

Change History

Changed 17 months ago by interfrastic

Failure case log file for host OS 64-bit Ubuntu Xenial Xerus 16.04.6 LTS

Changed 17 months ago by interfrastic

Success case log file for host OS macOS Mojave Version 10.14.3

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use