Page 1 of 1

connect iphone to localhost

Posted: 17. Jun 2022, 20:17
by rsail
I have looked over the forum but haven't found explicit instructions on how to do this. I a running virtualbox on a windows host creating a ubunto virtualbox. My windows machine is also running norton 360. Can someone provide step by step instructions on how to connect to the localserver on the ubunto virtualbox from an iphone? I am running xamp on the VM.

here's my *.vbox file:

** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->
<VirtualBox xmlns="http://www.virtualbox.org/" version="1.16-windows">
<Machine uuid="{50e10e2e-1052-4ee6-96bb-9d5ee932731d}" name="VBMINT3" OSType="Ubuntu_64" snapshotFolder="Snapshots" lastStateChange="2022-06-14T18:47:56Z">
<MediaRegistry>
<HardDisks>
<HardDisk uuid="{944f1a36-10e0-4a69-a4b9-1c8804cd5df9}" location="VBMINT3.vdi" format="VDI" type="Normal"/>
</HardDisks>
<DVDImages>
<Image uuid="{09392927-b689-41d3-bb5d-dde3581e6033}" location="D:/Program Files/oracle/virtualbox/VBoxGuestAdditions.iso"/>
</DVDImages>
</MediaRegistry>
<ExtraData>
<ExtraDataItem name="CustomVideoMode1" value="1200x1900x24"/>
<ExtraDataItem name="GUI/AutoresizeGuest" value="false"/>
<ExtraDataItem name="GUI/LastCloseAction" value="Shutdown"/>
<ExtraDataItem name="GUI/LastGuestSizeHint" value="1920,1080"/>
<ExtraDataItem name="GUI/LastGuestSizeHint1" value="1152,864"/>
<ExtraDataItem name="GUI/LastNormalWindowPosition" value="0,23,640,480,max"/>
<ExtraDataItem name="GUI/LastNormalWindowPosition1" value="-1175,692,1152,906"/>
<ExtraDataItem name="GUI/LastNormalWindowPosition2" value="640,340,640,480"/>
<ExtraDataItem name="GUI/LastScaleWindowPosition" value="274,108,1458,903"/>
<ExtraDataItem name="GUI/LastScaleWindowPosition1" value="640,340,640,480"/>
<ExtraDataItem name="GUI/LastVisibilityStatusForGuestScreen1" value="true"/>
<ExtraDataItem name="GUI/MiniToolBarAlignment" value="Top"/>
<ExtraDataItem name="GUI/MiniToolBarAutoHide" value="false"/>
<ExtraDataItem name="GUI/RestrictedRuntimeMachineMenuActions" value="PowerOff"/>
<ExtraDataItem name="GUI/ScaleFactor" value="1"/>
<ExtraDataItem name="GUI/VirtualScreenToHostScreen0" value="0"/>
<ExtraDataItem name="GUI/VirtualScreenToHostScreen1" value="0"/>
</ExtraData>
<Hardware>
<CPU count="12">
<PAE enabled="false"/>
<LongMode enabled="true"/>
<X2APIC enabled="true"/>
<HardwareVirtExLargePages enabled="true"/>
</CPU>
<Memory RAMSize="8192"/>
<HID Pointing="USBTablet"/>
<Display controller="VMSVGA" VRAMSize="128" monitorCount="2" accelerate3D="true"/>
<VideoCapture screens="3" file="." fps="25"/>
<BIOS>
<IOAPIC enabled="true"/>
<SmbiosUuidLittleEndian enabled="true"/>
</BIOS>
<USB>
<Controllers>
<Controller name="OHCI" type="OHCI"/>
</Controllers>
<DeviceFilters>
<DeviceFilter name="Apple Inc. iPhone [1201]" active="true" vendorId="05ac" productId="12a8" revision="1201" manufacturer="Apple Inc." product="iPhone" serialNumber="00008030000574C63487802E" remote="0"/>
</DeviceFilters>
</USB>
<Network>
<Adapter slot="0" enabled="true" MACAddress="0800276C7AB9" type="82540EM">
<NAT>
<Forwarding name="SSH" proto="1" hostip="127.0.0.1" hostport="22" guestport="22"/>
</NAT>
</Adapter>
</Network>
<AudioAdapter codec="AD1980" driver="DirectSound" enabled="true" enabledIn="false"/>
<RTC localOrUTC="UTC"/>
<Clipboard mode="Bidirectional"/>
<DragAndDrop mode="Bidirectional"/>
<GuestProperties>
<GuestProperty name="/VirtualBox/GuestAdd/HostVerLastChecked" value="6.1.34" timestamp="1655227886719646500" flags=""/>
<GuestProperty name="/VirtualBox/GuestAdd/Revision" value="150636" timestamp="1655228163134948305" flags=""/>
<GuestProperty name="/VirtualBox/GuestAdd/Version" value="6.1.34" timestamp="1655228163134948303" flags=""/>
<GuestProperty name="/VirtualBox/GuestAdd/VersionExt" value="6.1.34" timestamp="1655228163134948304" flags=""/>
<GuestProperty name="/VirtualBox/GuestInfo/OS/Product" value="Linux" timestamp="1655228163133972800" flags=""/>
<GuestProperty name="/VirtualBox/GuestInfo/OS/Release" value="5.4.0-99-generic" timestamp="1655228163134948300" flags=""/>
<GuestProperty name="/VirtualBox/GuestInfo/OS/Version" value="#112-Ubuntu SMP Thu Feb 3 13:50:55 UTC 2022" timestamp="1655228163134948301" flags=""/>
<GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="en_US" timestamp="1655232476567383100" flags=""/>
</GuestProperties>
</Hardware>
<StorageControllers>
<StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
<AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0"/>
</StorageController>
<StorageController name="SATA" type="AHCI" PortCount="1" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
<AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
<Image uuid="{944f1a36-10e0-4a69-a4b9-1c8804cd5df9}"/>
</AttachedDevice>
</StorageController>
</StorageControllers>
</Machine>
</VirtualBox>


When I run ifconfig on the vm I get:

saltydog@VBMINT3:~$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::2cb0:baff:6893:b9b4 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:6c:7a:b9 txqueuelen 1000 (Ethernet)
RX packets 160656 bytes 207723977 (207.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 33163 bytes 3413385 (3.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

enx2269809257ce: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 22:69:80:92:57:ce txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 3597 bytes 1810187 (1.8 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3597 bytes 1810187 (1.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

when I run ipconfig on windows host I get:

C:\Users\Robert>ipconfig

Windows IP Configuration


Ethernet adapter Ethernet:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :

Ethernet adapter Ethernet 2:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :

Ethernet adapter VirtualBox Host-Only Network:

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::2964:96e4:ca04:d9ed%36
IPv4 Address. . . . . . . . . . . : 192.168.56.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :

Wireless LAN adapter Local Area Connection* 13:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :

Wireless LAN adapter Local Area Connection* 14:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :

Ethernet adapter HMA! Pro VPN:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :

Wireless LAN adapter Wi-Fi 2:

Connection-specific DNS Suffix . : home
Link-local IPv6 Address . . . . . : fe80::5ce5:801b:629a:e968%21
IPv4 Address. . . . . . . . . . . : 192.168.1.17
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1

open ports on VM

sudo lsof -i -P -n | grep LISTEN
[sudo] password for saltydog:
systemd-r 621 systemd-resolve 13u IPv4 18942 0t0 TCP 127.0.0.53:53 (LISTEN)
cupsd 651 root 6u IPv6 20038 0t0 TCP [::1]:631 (LISTEN)
cupsd 651 root 7u IPv4 20039 0t0 TCP 127.0.0.1:631 (LISTEN)
sshd 846 root 3u IPv4 28771 0t0 TCP *:22 (LISTEN)
sshd 846 root 4u IPv6 28773 0t0 TCP *:22 (LISTEN)
mysqld 3001 mysql 19u IPv6 42577 0t0 TCP *:3306 (LISTEN)
/opt/lamp 3087 root 4u IPv6 39637 0t0 TCP *:80 (LISTEN)
/opt/lamp 3087 root 6u IPv6 39645 0t0 TCP *:443 (LISTEN)
/opt/lamp 3091 daemon 4u IPv6 39637 0t0 TCP *:80 (LISTEN)
/opt/lamp 3091 daemon 6u IPv6 39645 0t0 TCP *:443 (LISTEN)
/opt/lamp 3092 daemon 4u IPv6 39637 0t0 TCP *:80 (LISTEN)
/opt/lamp 3092 daemon 6u IPv6 39645 0t0 TCP *:443 (LISTEN)
/opt/lamp 3094 daemon 4u IPv6 39637 0t0 TCP *:80 (LISTEN)
/opt/lamp 3094 daemon 6u IPv6 39645 0t0 TCP *:443 (LISTEN)
/opt/lamp 3095 daemon 4u IPv6 39637 0t0 TCP *:80 (LISTEN)
/opt/lamp 3095 daemon 6u IPv6 39645 0t0 TCP *:443 (LISTEN)
/opt/lamp 3620 daemon 4u IPv6 39637 0t0 TCP *:80 (LISTEN)
/opt/lamp 3620 daemon 6u IPv6 39645 0t0 TCP *:443 (LISTEN)
/opt/lamp 3903 daemon 4u IPv6 39637 0t0 TCP *:80 (LISTEN)
/opt/lamp 3903 daemon 6u IPv6 39645 0t0 TCP *:443 (LISTEN)
/opt/lamp 3914 daemon 4u IPv6 39637 0t0 TCP *:80 (LISTEN)
/opt/lamp 3914 daemon 6u IPv6 39645 0t0 TCP *:443 (LISTEN)
/opt/lamp 4856 daemon 4u IPv6 39637 0t0 TCP *:80 (LISTEN)
/opt/lamp 4856 daemon 6u IPv6 39645 0t0 TCP *:443 (LISTEN)
/opt/lamp 6569 daemon 4u IPv6 39637 0t0 TCP *:80 (LISTEN)
/opt/lamp 6569 daemon 6u IPv6 39645 0t0 TCP *:443 (LISTEN)
/opt/lamp 6695 daemon 4u IPv6 39637 0t0 TCP *:80 (LISTEN)
/opt/lamp 6695 daemon 6u IPv6 39645 0t0 TCP *:443 (LISTEN)

sudo usermod -aG vboxusers saltydog
[sudo] password for saltydog:
usermod: group 'vboxusers' does not exist

Re: connect iphone to localhost

Posted: 17. Jun 2022, 21:00
by scottgus1
There could be two ways:
  • Pass the iphone USB connection directly to the VM using USB basics and troubleshooting
  • Connect the VM to the LAN using Bridged (works best when the host is connected via wired Ethernet) or by Host-Only.
    For Bridged, the iphone might find the VM at its LAN IP address received from the LAN router.
    For Host-Only, the iphone might find the VM at the Host-Only IP address the VM receives from Virtualbox.
These are all guesses, though. To my knowledge there is no specific tutorial for this on the forum. Also, "localhost" often refers to the "loopback" IP address 127.0.0.1, which is only accessible by clients running directly in the VM OS itself, not by other devices by the network.

You may also get a tutorial by web-searching.

Re: connect iphone to localhost

Posted: 17. Jun 2022, 21:14
by rsail
thanks for the reply but none of your post is helping. Totally confused

Re: connect iphone to localhost

Posted: 17. Jun 2022, 21:22
by scottgus1
I should have given you a link to a forum network tutorial Virtualbox Networks: In Pictures to understand Bridged and Host-Only.

We'll leave this open, of course, to see if a Virtualbox user has done what you want to do.

Edit: it's better to put new data in a new post instead of editing an earlier post. I missed your VM and host data. Your VM is set to NAT, which adds extra complication to the project.