Remote access to virtualized HA

Hello. I have physical Windows server with public IP and I use Home Assistant as virtual machine via VirtualBox hosted on this server.

I’d like to get remote access from Internet to Home Assistant.

I tried to change VirtualBox settings to NAT and forward some ports but no luck.

Can anybody help me to set HA accessible from Internet correctly?

On the assumption that you’ve set HA up in bridged mode with its own IP, you shouldn’t need to do anything else on VirtualBox. Just forward from your modem/router to HA’s IP address. And pre-empting the next question, I’ve found the “NGINZ Proxy Manager” addon is the easiest way to set up SSL, particularly if you use duckdns for a domain.

I am not sure you understand it right.

All public communication is forwarded to physical windows server which has own public IP address. And i need to forward correct port from physical server to virtual HA and open it for Internet.

Maybe more information on how the Virtual machine has been setup and your use case to help us understand better as to what you are trying to achieve.

A Virtual Machine is normally treated as another server with its own IP address and is not just an IP port to access it. If you want the HA VM to be accessible on the internet, then you will need its IP address made available. One way is to have a domain name with a fixed IP address or a domain host that allows IP address updates via DDNS or something like Duckdns then you setup a port forward on your router for incoming connections on a given port (say 8080) to the IP address of the HA VM and HA port 8123.(Using a reverse proxy and SSL would be much better rather than open http).
That being said, all the usual risks of making something available to the internet applies so security should be a top concern.

I used casual setup for instalation on VirtualDub here Windows - Home Assistant

Then I use internal IP address for web and app access.

May I know why i need domain for internet access? I cannot to use https://(my_public_ip_address):8123 ?

You need to set the VB network into bridge mode:

  • it will get an IP from your DHCP (router)
  • you’ll need to forward port 8123 to that IP

If your public IP address is static and never changes then that is fine to use instead of a domain name but it will restrict the use of SSL certificates for secure access.
Access from the internet to your public IP address will get it to the router. From there you will need to port forward the external port you want to use to access HA to its internal IP address and HA port. You should also setup DHCP address reservation for your HA VM on your router’s DHCP server so that it is always allocated the same IP address for you to use on your router to forward the traffic to.

eg.
Your external IP is 111.112.113.114
Your HA server internal IP is 192.168.1.100
You want to use port 8080 to access HA, then you would use http://111.112.113.114:8080 from the internet.
You then need to add a port forward rule to your router for incoming port 8080 to forward to IP address 192.168.1.100 and port 8123