r/pihole•
hRob

Getting VM a valid IP address

Hi Folks,

I recently came across a podcast with the author of pi-hole and immediately fell in love with the idea. I have been trying to get a VM setup to do this. However, I am having troubles setting the VM up so that it is accessible from my home network.

I initially had the network config as default so the VM got an IP (something like 10.0.0.x~). I then changed the adapater to "bridge" which gave it a more sensible looking IP (192.168.0.xx). I was successfully able to ping this IP from my host machine (and other machines on the network). However, the VM itself doesn't have internet now.

Is there a guide to setting up a VM so that it is ssh'able from the host machine while still having internet from the VM?

(Apologies if this is orthogonal to the sub's interests; Mods please feel free to delete if so)


EDIT: More details on the virtualization

- Host is Windows 10

- VM is running Ubuntu 18.04 LTS (guest addons installed)

- VirtualBox 6.1.0

- Network1: Connected to "Bridged Adapter"; ifconfig -a returns a valid IP  (192.168.0.xx); IP is pingable from host; nothing is pingable (google.com) from VM

- Network2: Connected to "NAT Network (VirtualBox Host-Only Ethernet)"; ifconfig -a returns same IP; IP is *not* pingable from host; everything is pingable (google.com) from VM

Posted Jan 7, 2020, 3:05 PM UTC · edited

1010
-Steets-•

Mind sharing what virtualization software you're using? I should be able to help you out here.

5
hRobOP•

Hi streets, thanks for the reply. I am running an Ubuntu 18.04 on VirtualBox. Host is windows 10.

Edit: 18.04, not 19.04

1
drangry•

Is the VM getting an address via DHCP on your network? Do you have any (potential) firewall rules that might be preventing the machine from getting out? Are you able to ping out to the Internet on an IP-level (e.g. testing ping to 4.2.2.1), or have you been trying by host name (if you're trying by host name, what kind of error are you getting)?

Sorry for the barrage of questions, but I feel that getting some more of this information could help us guide you in the right direction.

2
hRobOP•

Thanks for trying to help :)

Host is Windows 10

VM is running Ubuntu 18.04 LTS (guest addons installed)

VirtualBox 6.1.0

Network1: Connected to "Bridged Adapter"; ifconfig -a returns a valid IP (192.168.0.xx); IP is pingable from host; nothing is pingable (google.com) from VM

Network2: Connected to "NAT Network (VirtualBox Host-Only Ethernet)"; ifconfig -a returns same IP; IP is not pingable from host; everything is pingable (google.com) from VM

Hi u/drangry, I have added more details to the OP. I'll answer some of your additional queries here:

Do you have any (potential) firewall rules that might be preventing the machine from getting out?

No, I have checked the outbound rules and there is nothing extra

Are you able to ping out to the Internet on an IP-level (e.g. testing ping to 4.2.2.1), or have you been trying by host name (if you're trying by host name, what kind of error are you getting)?

I have been trying to ping to google.com which fails with "Name or service not known" - so most likely a name resolution failure

Tried pinging 8.8.8.8 - fails with "Destination host unreachable" error

1
drangry•

Thanks for the additional info!

One of the other things I forgot to ask... While the VM is bridged, can any other nodes on your network (aside from your Win10 host) ping the VM or make a successful query of 'pi.hole' to it? I'm just trying to figure out if there's a possible issue with the bridge or the gateway config on the VM itself (though I'm doubting the latter).

1
Sneak_Stealth•

I'd try reconfiguring the VM from pihole. Use the command line comand pihole -r

at the reconfiguration screen either set it DHCP or set the static IP as 192.168.0.xyz set the default gateway for your routers address, and subnet mask is likely going to be 255.255.255.0 (/24) https://discourse.pi-hole.net/t/change-ip-adress/3837

It may also help to know what virtualization software you're using. Sometimes they can have different access levels that will prevent internet, or local network access depending on settings.

1
MentalHydration•

What is your host computers IP?

You’re going to want the adapter to be bridged. On that note is your network actually 192.168.0.x? Is there a chance it’s IP is being set from the os and not the network? If that’s the case then it would make sense that you can’t ping out.

1
cevinxf•

Can you share the podcast ? Would be interested. Thank you :)

1
[deleted]•

[deleted]

-1
hRobOP•

I understand that the problem is with virtualization and is orthogonal to this sub, but thought this would be the best place to ask seeing as it is distinctly related to how pihole works.

go get help with that.

I'd be happy to if you could point me in the right direction.

2
[deleted]•

[deleted]

-1
hRobOP•

You are neither being helpful, nor being clear. I am going to stop responding to you now

2
[deleted]•

[deleted]

1