id summary reporter owner description type status component version resolution keywords cc guest host 18495 VirtualBox NAT alias option use-same-ports (--nataliasmode1=sameports) has no effect on Ubuntu 16.04 host OS interfrastic "== 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) 2. 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 }}} 3. 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 }}} 4. 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. 5. Boot the VM, selecting default options for everything. 6. 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' }}} 7. 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. 8. 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 }}} 9. 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. 10. 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 }}} 11. 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`. 12. Close the guest console window, select '''Save the machine state''', and click '''OK'''. 13. On host, switch the VM to `--nataliasmode1=sameports`: {{{ VBoxManage modifyvm archlinux-2019.03.01-x86_64 --nataliasmode1=sameports }}} 14. In VirtualBox, click '''Start''' to restore the VM. 15. 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 }}} " defect new network/NAT VirtualBox 6.0.4 nat nataliasmode sameports linux Linux Linux