LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-20-2016, 07:16 AM   #1
Troix
LQ Newbie
 
Registered: Nov 2016
Posts: 7

Rep: Reputation: Disabled
Question Destination host unreachable, solution?


Hello there

There are two Debian VMs in my Oracle VM Virtual Box.
I would like to set up a network in order to make them "pingable" among themselves. Webpages such as google.com should be "pingable" too.
How do I have to set up the network environment?

Here are two screenshots:

Screenshot1
Screenshot2

I have tried to bridge the wifi and the VirtualBox Host-Only Ethernet Adapter. ping google.com delivers a unknown host and ping vm delivers a Destination Host Unreachable.

Anyone help please?

Thx,
Troix
 
Old 11-21-2016, 09:32 AM   #2
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Hi there,

Welcome to LQ!

I don't have a Debian insstall handy, but am guessing the screenshots are from the network config inside the VMs? If so, why is the bridge required - why not just configure the IPs directly onto the "wired" (virtual ethernet) interfaces?

What does the VirtualBox network settings look like? There are various network modes (see https://www.virtualbox.org/manual/ch06.html). The default is NAT, but what you probably want is Bridged networking. This will bridge the adapter in the VM to an adapter in the guest OS, and allow access to other VMs as well as the outside world. NAT, on the other hand, allows access to the outside, but not to other VMs.

One problem with your config might be the IP addresses. The two VMs seem to be on different subnets. Unless you have specific routing table entries to deal with this, they would not know how to reach each other, and will try to route traffic out onto the internet instead if only a default gateway is configured. Assuming you have an external DHCP server running (likely on your router), in Bridged mode the VMs should pick up IPs and other settings (gateway, DNS) from there, and end up on the same subnet as the host, which will solve your routing problem as well as the DNS problem which is most likely causing the "unknown host" error.

Good luck!
 
1 members found this post helpful.
Old 11-21-2016, 09:55 AM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
your bridge cannot be connecting properly. this is a photo of VirtualBox and my client pinging to google with bridge connection to my wifi on my laptop.

Make sure you are selecting the proper connection to your box. I don't know if you did or not. But it usually defaults to the right one.

There is another showing Solaris 11.3 pining my Void Linux, they both are VM clients.

if you have a wifi and a Network card installed. it maybe choosing the wrong one, and like @cliffordw said your Default route for both clients are different.

your VM setup for bridge looks different then mine too. what up with that?
what version are you running? Just wondering. Mine is ver 5.
Attached Thumbnails
Click image for larger version

Name:	Screenshot_PING-in-VM-2016-11-21_09-53-28.png
Views:	433
Size:	130.3 KB
ID:	23590   Click image for larger version

Name:	Screenshot_Solaris-Pinging-VoidVM-client-2016-11-21_10-02-38.jpg
Views:	346
Size:	147.9 KB
ID:	23591  

Last edited by BW-userx; 11-21-2016 at 10:25 AM.
 
1 members found this post helpful.
Old 11-22-2016, 05:06 AM   #4
Troix
LQ Newbie
 
Registered: Nov 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thx for your help!

So how do I set up two vms as hosts and one vm as a router?

vm a:
eth1: 192.168.0.44/24
default gateway: 192.168.0.100/24

vm b:
eth1: 172.20.20.44/24
default gateway: 172.20.30.100/24

vm c:
eth1:192.168.0.100/24
eth2: 172.20.30.100/24

Thx in advance,
Troix
 
Old 11-22-2016, 05:15 AM   #5
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Hi Troix,

You're a little vague on details. I'll make some assumptions, though, namely:

1. The networks in VirtualBox are set up to allow this traffic flow, and
2. VM C has a route to the destination (internet??)
3. There's no firewall rules on VM C that will block the traffic

The IP config on VMs A and B seems fine.
On VM C, if you want to route only between these VMs, you need to enable IP forwarding ("echo 1 > /proc/sys/net/ipv4/conf/all/forwarding"). If you want to route to other subnets or to public IP addresses (the internet) via VM C, you will need to either run NAT on that VM, or ensure your router knows the route back to the source addresses (on VM A & B).

I hope this helps.
 
1 members found this post helpful.
Old 11-22-2016, 06:35 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
I agree not information on how you want your VMs configured. What operating systems are running on the VMs?

It looks like VM A network is configured as a bridge instead of host only and your host only network for VM b and c is not on the same subnet (172.20.20. and 172.20.30.).

You also need to add firewall rules for VM c to be a NAT for the other two.
 
1 members found this post helpful.
Old 11-22-2016, 06:35 AM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
take this what you wrote
Quote:
how do I set up two vms as hosts and one vm as a router
then go to youtube and paste that into the search bar, I got numerous hits on how tos
that might help you out, so you can see what they are doing as well.


What Is A Oracle VM VirtualBox Host-Only Network Adapter?

Quote:
Do you want your virtual machines to be able to talk to one another and the host machine but not other machines on the network? Are you running a lab environment where you want students to be able to set up servers or small networks. If so, the host-only adapter for Oracle VM VirtualBox may be your answer. This video from Tutorial Techie explains the host-only adapter in Oracle VM Virtual Box and how to set one up.

How to Setup Nat Network and Port Forwarding Virtualbox


How to configure internal network in VirtualBox

Last edited by BW-userx; 11-22-2016 at 06:41 AM.
 
1 members found this post helpful.
Old 11-22-2016, 09:24 AM   #8
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829

Rep: Reputation: 229Reputation: 229Reputation: 229
Edit: nevermind.

Last edited by erik2282; 11-22-2016 at 09:26 AM.
 
1 members found this post helpful.
Old 11-25-2016, 09:55 AM   #9
Troix
LQ Newbie
 
Registered: Nov 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled
how to activate two interfaces

hello again!

Thank you for your kind help.
Another question: When using nmtui I can activate eth0 or eth1 but not both.
How do I activate both?

Thx,
Troix
 
Old 11-25-2016, 10:10 AM   #10
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Troix View Post
hello again!

Thank you for your kind help.
Another question: When using nmtui I can activate eth0 or eth1 but not both.
How do I activate both?

Thx,
Troix
my vbox has tabs in network to do more then one... try that .??
 
1 members found this post helpful.
Old 11-25-2016, 12:09 PM   #11
Troix
LQ Newbie
 
Registered: Nov 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled
Destination Host Unreachable

Okay, so I have added a second adapter.
I can ping vm1 to vm3 and vice versa.
I am not able to ping vm2 and vm3 and vice versa.
In both directions I get a DHU.
I have activated both Ethernet Connection 1 and 2.

The screenshots are as follows:
vm1 = debian1
vm2 = debian2
vm3 settings for vm1 = debian31
vm3 settings for vm2 = debian32

thx,
troix
Attached Thumbnails
Click image for larger version

Name:	debian1.PNG
Views:	143
Size:	30.0 KB
ID:	23623   Click image for larger version

Name:	debian2.PNG
Views:	78
Size:	30.0 KB
ID:	23624   Click image for larger version

Name:	debian31.PNG
Views:	66
Size:	32.6 KB
ID:	23625   Click image for larger version

Name:	debian32.PNG
Views:	62
Size:	33.3 KB
ID:	23626  
 
Old 11-26-2016, 07:36 AM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
That is an alias not a second adapter. I've never tried using an alias with a virtual adapter yet. The two adapters on vm3 are on the same subnet and vm1 and vm 2 are still on different subnets.

How are the network adapters configured in virtualbox manager? bridged, NAT, etc.

Lets clarify your requirements again. To be pingable among themselves and still ping the outside world can be configured in several ways. Each VM has two virtual adapters i.e 1 as NAT and 2 as host only.

With VM 3 as a router mode so it has 2 virtual adpaters with vm 1 as bridged and vm 2 as host only. The other two as host only. You then configure VM 3's firewall to forward from host only port to bridged.

Lets try the first option. Go back and configure the VMs for DHCP. Configure the two virtual adapters in VBox manager as NAT and host only.
 
1 members found this post helpful.
Old 11-26-2016, 08:40 AM   #13
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
This might help you a little bit there ye'.

how to configure linux vm as router which communicate between two subnets


this person is using a Debian set up to explain how to do this to that asker, dude in that post.
 
1 members found this post helpful.
Old 11-29-2016, 04:26 AM   #14
Troix
LQ Newbie
 
Registered: Nov 2016
Posts: 7

Original Poster
Rep: Reputation: Disabled
vmb and vmc

hello again

I have followed the instructions from the link I have received:
http://serverfault.com/questions/613...en-two-subnets

In all three VMs I have added the information according to the content of the webpage.

Pinging between VM c and VM a works fine.
Pinging between VM c and VM b doesn't work.

I have cloned VM a to VM b and changed the ip and gateway.

Unfortunately pinging doesn't work (pinging the outside world works fine).

rc.local:

modprobe ipt_conntrack
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
modprobe ip_conntrack_irc
modprobe ip_nat_irc
modprobe ip_nat_snmp_basic


iptables -t nat -A POSTROUTING -o eth5 -j SNAT --to-source 192.168.0.100
iptables -t nat -A POSTROUTING -o eth6 -j SNAT --to-source 172.20.30.100




Thx,
Troix

Last edited by Troix; 11-29-2016 at 04:34 AM.
 
Old 11-29-2016, 06:59 AM   #15
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Troix View Post
hello again

I have followed the instructions from the link I have received:
http://serverfault.com/questions/613...en-two-subnets

In all three VMs I have added the information according to the content of the webpage.

Pinging between VM c and VM a works fine.
Pinging between VM c and VM b doesn't work.

I have cloned VM a to VM b and changed the ip and gateway.

Unfortunately pinging doesn't work (pinging the outside world works fine).

rc.local:

modprobe ipt_conntrack
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
modprobe ip_conntrack_irc
modprobe ip_nat_irc
modprobe ip_nat_snmp_basic


iptables -t nat -A POSTROUTING -o eth5 -j SNAT --to-source 192.168.0.100
iptables -t nat -A POSTROUTING -o eth6 -j SNAT --to-source 172.20.30.100




Thx,
Troix
How is, or why is your gateways all becoming different? that is what I remember seeing .. and is causing the problem. Even though you say you've changed them. Hum..

If I get some time .. I'll try to set up the same thing in my VBox with completely different Linux OS's and maybe try to use my Solaris I already have installed on it.

but you are using Debian for everyone of them yes?
So Maybe I'll use (cough,cough) Debian for everything and toss in Solairs for good measure.

then if I go to that link you provide and use that then see what I see. then post back (if I get time to do this) I will.

what is your two Debian and Oracle VM Virtual Box Versions for each SO I can try to imitate everything you have. my Hardware should not matter because the others are being simulated via VBox (VM). My VM version is 5.x. the kernel ver should not matter either. so that is a no big deal.

just versions of Debain and VM you are using so I can download the Debain iso's

I only have wifi at my disposal so that may be a hindrance.

Last edited by BW-userx; 11-29-2016 at 07:09 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ping to Honeyd virtual host replying Destination Host Unreachable Doejohn Linux - Networking 2 12-22-2023 10:43 AM
Destination host unreachable, solution? Troix Linux - Networking 1 11-21-2016 12:09 PM
iptables - Reply Forwarding Error / Destination unreachable (Host unreachable) keflex87 Linux - Networking 1 05-12-2015 12:03 AM
Network is Unreachable/Unknown host/Destination Host Unreachable [Debian] denv Linux - Networking 4 03-27-2014 02:58 PM
Destination Host Unreachable Linux Newbee Linux - Networking 8 07-28-2008 09:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration