VirtualBox

Opened 5 years ago

Closed 5 years ago

#19937 closed defect (invalid)

Port Forward not working, unable to connect to guest machine from host

Reported by: Jeremy Tourville Owned by:
Component: network/NAT Version: VirtualBox 6.1.14
Keywords: port forward, nat, network Cc:
Guest type: Linux Host type: Linux

Description

I have followed the directions- https://www.virtualbox.org/manual/ch06.html#natforward

user@user-Latitude-E6430s:~$VBoxManage modifyvm Ansible --natpf1 "guestssh,tcp,,2222,10.0.2.4,22"

I try to connect to the guest machine and the request times out

user@user-Latitude-E6430s:~$ssh -p 2222 [email protected]
user@user-Latitude-E6430s:~$ss -tuln | grep 22

returns this-

tcp    LISTEN   0        10                0.0.0.0:2222           0.0.0.0:*
Environment info:

#vboxmanage -v

6.1.14r140239

Host OS

#lsb_release -a

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.5 LTS
Release:	18.04
Codename:	bionic

#vboxmanage showvminfo Ansible

Name:                        Ansible
Groups:                      /
Guest OS:                    Linux 2.6 / 3.x / 4.x (64-bit)
UUID:                        9386cd5c-0809-4e52-99be-85b3f41ab166
Config file:                 /home/user/VirtualBox VMs/Ansible/Ansible.vbox
Snapshot folder:             /home/user/VirtualBox VMs/Ansible/Snapshots
Log folder:                  /home/user/VirtualBox VMs/Ansible/Logs
Hardware UUID:               9386cd5c-0809-4e52-99be-85b3f41ab166
Memory size                  1024MB
Page Fusion:                 disabled
VRAM size:                   16MB
CPU exec cap:                100%
HPET:                        disabled
CPUProfile:                  host
Chipset:                     piix3
Firmware:                    BIOS
Number of CPUs:              1
PAE:                         enabled
Long Mode:                   enabled
Triple Fault Reset:          disabled
APIC:                        enabled
X2APIC:                      enabled
Nested VT-x/AMD-V:           disabled
CPUID Portability Level:     0
CPUID overrides:             None
Boot menu mode:              message and menu
Boot Device 1:               HardDisk
Boot Device 2:               DVD
Boot Device 3:               Not Assigned
Boot Device 4:               Not Assigned
ACPI:                        enabled
IOAPIC:                      enabled
BIOS APIC mode:              APIC
Time offset:                 0ms
RTC:                         UTC
Hardware Virtualization:     enabled
Nested Paging:               enabled
Large Pages:                 disabled
VT-x VPID:                   enabled
VT-x Unrestricted Exec.:     enabled
Paravirt. Provider:          Default
Effective Paravirt. Prov.:   KVM
State:                       running (since 2020-10-04T14:09:40.099000000)
Graphics Controller:         VMSVGA
Monitor count:               1
3D Acceleration:             disabled
2D Video Acceleration:       disabled
Teleporter Enabled:          disabled
Teleporter Port:             0
Teleporter Address:          
Teleporter Password:         
Tracing Enabled:             disabled
Allow Tracing to Access VM:  disabled
Tracing Configuration:       
Autostart Enabled:           disabled
Autostart Delay:             0
Default Frontend:            
VM process priority:         default
Storage Controller Name (0):            IDE
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
Storage Controller Name (1):            SATA
Storage Controller Type (1):            IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1):  30
Storage Controller Port Count (1):      1
Storage Controller Bootable (1):        on
IDE (1, 0): /usr/share/virtualbox/VBoxGuestAdditions.iso (UUID: 3df52614-590a-40a7-860f-6d89702941ac)
SATA (0, 0): /home/user/VirtualBox VMs/Ansible/Ansible.vdi (UUID: e964f304-a601-4e1a-ab47-1f5181d6112f)
NIC 1:                       MAC: 080027D15724, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings:  MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 1 Rule(0):   name = guestssh, protocol = tcp, host ip = , host port = 2222, guest ip = 10.0.2.4, guest port = 22
NIC 2:                       disabled
NIC 3:                       disabled
NIC 4:                       disabled
NIC 5:                       disabled
NIC 6:                       disabled
NIC 7:                       disabled
NIC 8:                       disabled
Pointing Device:             PS/2 Mouse
Keyboard Device:             PS/2 Keyboard
UART 1:                      disabled
UART 2:                      disabled
UART 3:                      disabled
UART 4:                      disabled
LPT 1:                       disabled
LPT 2:                       disabled
Audio:                       enabled (Driver: PulseAudio, Controller: AC97, Codec: AD1980)
Audio playback:              enabled
Audio capture:               disabled
Clipboard Mode:              HostToGuest
Drag and drop Mode:          disabled
Session name:                GUI/Qt
Video mode:                  800x600x32 at 0,0 enabled
VRDE:                        disabled
OHCI USB:                    enabled
EHCI USB:                    disabled
xHCI USB:                    disabled

USB Device Filters:

<none>

Available remote USB devices:

<none>

Currently Attached USB Devices:

<none>

Bandwidth groups:  <none>

Shared folders:<none>

VRDE Connection:             not active
Clients so far:              0

Capturing:                   active
Capture audio:               not active
Capture screens:             0
Capture file:                /home/user/VirtualBox VMs/Ansible/Ansible.webm
Capture dimensions:          1024x768
Capture rate:                512kbps
Capture FPS:                 25kbps
Capture options:             ac_enabled=false,vc_enabled=true,ac_profile=med

Guest:

Configured memory balloon size: 0MB
OS type:                     Linux26_64
Additions run level:         2
Additions version:           6.1.14 r140239

Guest Facilities:

Facility "VirtualBox Base Driver": active/running (last update: 2020/10/04 14:09:57 UTC)
Facility "VirtualBox System Service": active/running (last update: 2020/10/04 14:10:13 UTC)
Facility "Seamless Mode": not active (last update: 2020/10/04 14:09:57 UTC)
Facility "Graphics Mode": not active (last update: 2020/10/04 14:09:57 UTC)"


Guest OS:

#cat /etc/redhat-release

CentOS Linux release 7.7.1980 (Core)

The guest OS has the VBoxGuestAddtions running without issues and compiled properly.
#lsmod | grep vbox

vboxvideo              35867  0 
vboxguest             349038  1 
drm_kms_helper        186531  2 vmwgfx,vboxvideo
ttm                    96673  2 vmwgfx,vboxvideo
drm                   456166  5 ttm,drm_kms_helper,vmwgfx,vboxvideo

The guest OS network is configured
#ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:d1:57:24 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.4/24 brd 10.0.2.255 scope global noprefixroute dynamic enp0s3
       valid_lft 85447sec preferred_lft 85447sec
    inet6 fe80::16bd:3909:550f:e3ce/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

The guest ssh daemon is running for both ipv4 and ipv6
#ss -tuln

Netid  State      Recv-Q Send-Q Local Address:Port               Peer Address:Port              
udp    UNCONN     0      0      127.0.0.1:323                   *:*                  
udp    UNCONN     0      0         *:68                    *:*                  
udp    UNCONN     0      0         [::1]:323                [::]:*                  
tcp    LISTEN     0      128       *:22                    *:*                  
tcp    LISTEN     0      100    127.0.0.1:25                    *:*                  
tcp    LISTEN     0      128    [::]:22                 [::]:*                  
tcp    LISTEN     0      100       [::1]:25                 [::]:*    

The student id exists in the guest OS
#getent passwd

student:x:1000:1000:student user:/home/student:/bin/bash

#getent group

root:x:0:
bin:x:1:
daemon:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mem:x:8:
kmem:x:9:
wheel:x:10:student
cdrom:x:11:
mail:x:12:postfix
man:x:15:
dialout:x:18:
floppy:x:19:
games:x:20:
tape:x:33:
video:x:39:
ftp:x:50:
lock:x:54:
audio:x:63:
nobody:x:99:
users:x:100:
utmp:x:22:
utempter:x:35:
input:x:999:
systemd-journal:x:190:
systemd-network:x:192:
dbus:x:81:
polkitd:x:998:
ssh_keys:x:997:
sshd:x:74:
postdrop:x:90:
postfix:x:89:
chrony:x:996:
student:x:1000:student
devops:x:1001:
vboxsf:x:995:student
git:x:1002:              


Change History (2)

comment:1 by Jeremy Tourville, 5 years ago

Status: newawaitsfeedback

Close ticket, my error connecting to wrong IP. If I use 127.0.0.1 it works.

Last edited 5 years ago by Jeremy Tourville (previous) (diff)

comment:2 by aeichner, 5 years ago

Resolution: invalid
Status: awaitsfeedbackclosed
Note: See TracTickets for help on using tickets.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette