How to find public IP address of a virtual machine?

Discussions related to using VirtualBox on Linux hosts.
Locked
NipClip
Posts: 1
Joined: 30. May 2020, 09:57

How to find public IP address of a virtual machine?

Post by NipClip »

Hello,

I am locally hosting in my computer a blog using Debian 9 server in a virtual machine using virtual box in a Ubuntu 18 host. (Using bridged adapter)

I have also configured the machine with a static IP

Recently I have purchased an domain name from godaddy and I want to assign it to my blog. In order to do that, you need to provide the public domain name of your server, in my case the virtual machine that I have the blog in.

I am aware that there is the command

Code: Select all

ip a
but this displays the private IP address and the IPV6 address, in my case 192.168.1.27.

How can I see through the command line what is the public IP address of my virtual machine?

Any help greatly appreciated
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How to find public IP address of a virtual machine?

Post by mpack »

What is a "public IP address"? If you mean what the outside world sees, they see the IP address assigned by your Internet provider, not any of the private addresses on your home network. You'd have to be going through a VPN to change that. Oh, and the IP address from your Internet provider is almost certainly dynamic, unless you paid them to reserve a permanent IP address.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How to find public IP address of a virtual machine?

Post by scottgus1 »

fwiw, I can see my public IP address by typing 'what is my ip' in a web browser. Several responses tell me what the IP address provided by my ISP is.

My IP is dynamic, so it will change at some point, and giving it to a hoster will fail eventually, unless the hoster gives my a dynamic IP reporter tool, or as Mpack mentioned, get a static IP address. Some ISPs block hosting websites on dynamic IPs by blocking ports 80 and 443 (or all ports 1024 and below), so you might be forced into a static IP and higher bill unless Godaddy lets your traffic come in on a higher port.

Can you describe your network setup? Is it a standard house router/cable/fiber modem with multiple Ethernet ports, perhaps Wi-fi, and your PC connects into an Ethernet port or via Wi-fi? Or something more exotic?
Locked