Opened 6 years ago
#18495 new defect
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
- 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)
- 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
- 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
- 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.
- Boot the VM, selecting default options for everything.
- 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'
- 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.
- 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
- 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 thehostname -f
command.
After running both
nc
commands, any text entered on the guest should appear on the host and vice versa.
- 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
- 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
.
- Close the guest console window, select Save the machine state, and click OK.
- On host, switch the VM to
--nataliasmode1=sameports
:
VBoxManage modifyvm archlinux-2019.03.01-x86_64 --nataliasmode1=sameports
- In VirtualBox, click Start to restore the VM.
- 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 (2)
Change History (2)
by , 6 years ago
Attachment: | archlinux-2019.03.01-x86_64-2019-03-14-12-28-34.log added |
---|
by , 6 years ago
Attachment: | archlinux-2019.03.01-x86_64-2019-03-14-13-10-53.log added |
---|
Success case log file for host OS macOS Mojave Version 10.14.3
Failure case log file for host OS 64-bit Ubuntu Xenial Xerus 16.04.6 LTS