0

How can I assign a static IP address to my phone's hotspot?

I use the hotspot on my Samsung M31 to connect my laptop running Windows 10 to the internet.

I also have Oracle's Virtual Box VM running a few test websites on the laptop on Ubuntu Server 22.04, which need a static IP address to access.

A few days back when I ran ipconfig at the Windows command prompt, it showed my wireless IP address as 192.168.166.135. Today, it show as 192.168.35.125. Meaning, all my sites are now broken. Is there a way to stop the hotspot from changing IP addresses?

Can someone please help?

Norman
  • 149
  • 1
  • 2
  • 7
  • In my opinion this is simply a matter of configuration in VirtualBox. If you want to access the host from within a VM add a host-only network (the VM has then two network adapters). This network is then configured and maintained by VirtualBox on the host and will work even without any hotspot connected. – Robert Jun 06 '22 at 16:14
  • @Robert Thanks for pointing me to the host-only network. I checked a few articles online and have got things going, but now my VM cannot connect to the internet for updates etc. I've added NAT as a second adapter, but that too does not solve the problem. – Norman Jun 07 '22 at 06:16
  • What guest OS do you use? From my experience some Linux distribution s(e.g. Ubuntu 22.04) do not automatically configure the new interface so I had to manually configure the interface to make it work. – Robert Jun 07 '22 at 07:02
  • I'm using Ubuntu Server 22.04. – Norman Jun 07 '22 at 07:10
  • See https://android.stackexchange.com/a/213774/96277 – Firelord Jun 07 '22 at 17:29
  • You can run your webserver (that hosts websites) via docker images. Each container would be assigned a different IP (you can make it static to remember) within same or different subnets (configurable). This way, it won't really matter what public facing IP address you have. BTW, are you trying to access your websites from devices other than your laptop? – Firelord Jun 07 '22 at 17:32
  • You could ask at [su] in the form of "IP address keep varying on each connection. How do I consistently access my websites in the VM without having to keep looking for new IP address assigned to my laptop?" or something like that. – Firelord Jun 07 '22 at 17:34

0 Answers0