Probleme reseau

Bonsoir a tous,
Etant nouveau dans l’environnement linux j’ai installer quelques machines virtuelles (Redhat 7.6) pour mes pour test et le problème est que, après toutes mes configuration réseau je n’arrive pas a pinguer les noms des mes différents server quand bien meme qu’ils sont tous dans le meme réseau.

Je recois l’erreur: nom ou service inconnu

Je precise que le nom du serveur est bien renseigné dans le fichier /etc/hosts

I have translated your post via DeepL.
Could you write in english please, not all speak french here.

On what host did you install your VM’s?
What did you use to create your VM’s?

I myself could provide some help with Virtualbox. If you choosed quemu/virtmanager/etc, I’m sure others will be able to help.

By default VirtualBox uses a NAT network for VMs. Those would not be pingable from other computers on your network.

Also, and this is what is happening to you, if you try to ping by name the names won’t resolve. They aren’t registered with DNS automatically.

You could try pinging them by IP address. But that would only work if you used a Bridge network connection for the VM rather than NAT.

1 Like

Hi,
I am using vmware as a hypervisor

Hello pdecker,
I’m using the bridge connection.

OK. If you are using a bridged connection, then you should be able to ping VMs from the local network.

I don’t think VMWare would register VMs with DNS either though. You will have to try to ping by IP address and not using the name.

Of course, any firewall on the VMs will need to allow a ping response. I never used Red Hat 7 but have used CentOS 7. Ours would have used corporate firewall rules though. I’m not sure if pings would be allowed by default or not. It would be worth checking.

I favor proxmox for hosted VMs (in use by other people) and virt manager for VMs for my own private use.

Alright thanks I’ll take a look too

please i don’t understand well.

Red Hat based distros are just AWFUL at avahi / zeroconf / bonjour…

and in Francais :

Apple and Debian and Ubuntu play very well with “avahi”. I recently distrohopped around Fedora, but I can’t remember how well avahi worked on there, I think it just “worked”, which means it probably just works on Red Hat REL9. It’s still mostly “broken” on REL8.

Avahi daemons are the things that let you “ping hostname.local” - I’ve never gotten it to work on REL7 or CentOS 7 or Oracle Linux 7…

e.g. from my Pop!_OS 22.04 machine, pinging my RPi Zero 2 W, it’s not in DNS or my /etc/hosts, but I can ping it by name :

╭─x@titan ~/.ssh  
╰─➤  ping albiorix.local
PING albiorix.local (10.1.1.115) 56(84) bytes of data.
64 bytes from 10.1.1.115 (10.1.1.115): icmp_seq=1 ttl=64 time=0.430 ms

So :

  1. yes you must use bridged networking for your guests, same in VMware and Virtualbox
  2. you will probably have to use IP addresses for ping, not hostnames.

Also - because Red Hat 7 VMs are so terrible at announcing themselves (i.e. using avahi / zeroconf / bonjour) I always stick this in my /etc/issue on ALL my VMs (no matter which Linux distribution - note : ONLY works on EL7 and later, doesn’t work on EL6) :

╭─x@fuglpige ~  
╰─➤  cat /etc/issue
\S
Kernel \r on an \m

IPV4: \4{enp3s0}

fuglpige is running on hardware (Gigabyte Brix) - but it’s the same thing on a VM : \4{$NIC} where $NIC is my network device. Sometimes it will work with just \4 but - sometimes it will show the loopback (i.e. 127.0.0.1).

I also always let my VMs use my network’s DHCP (in my case my wifi / router) to get an IP address.

Here’s a CentOS 7 VM console in VirtualBox :

Here’s a Red Hat 9 aarch64 VM console in UTM (frontend for QEMU on MacOS) :

I have a VM set up with virt-manager. It uses NAT, according to the virt-manager specs
Screenshot_2023-06-14_20-28-43
I can ping it from the host with ip number

[nevj@trinity ~]$ ping 192.168.122.45
PING 192.168.122.45 (192.168.122.45) 56(84) bytes of data.
64 bytes from 192.168.122.45: icmp_seq=1 ttl=64 time=0.220 ms
64 bytes from 192.168.122.45: icmp_seq=2 ttl=64 time=0.222 ms

So is virt-manager or qemu/kvm somehow different from Vbox?
In the host it makes the virtual device

5: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:78:7c:5d brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever

which I take to be a bridge?
How can I tell if it is really using NAT? NAT is supposed to be the default.

2 Likes

THANKS
I will try that too

Hello Neville I use vmware

I’ll have to test that out to confirm with VirtualBox. I was probably thinking that if it’s behind a NAT then it wouldn’t be pingable. But it’s behind a NAT where your computer is on both networks. So it might work just fine.

Hello Charles,
Sorry I dont use VMware. I hope you get your issue answered
Regards
Neville

Yes there seems to be a bridge interface AND nat on the virtual machine.
That confused me.
There are 2 settings in virt-manager called nat and bridge… nat must mean nat + bridge and bridge must mean bridge without nat?

My computer is on 3 networks when virt-manager is running… I have a local static network as well as a dhcp modem link, then virt- manager adds a third with a virtual bridge.
From inside the VM I can ping or ssh anything on the static network. ssh
does not listen on the dhcp link, only on the static net and the VM 's net.
From the host I can ping or sdh into the VM, as long as I look at the VM console first and get its IP number. There isnt any DNS so I cant use names… maybe I could put names in the hosts file?

It might be difficult if the VM was running in a server wuth no console. How would you get its IP number then?

1 Like

I haven’t tried Avahi, but I do recall reading about it before. Maybe I’ll experiment with it a bit.

What I did do was test out my VirtualBox setup running on Pop!_OS. When I used bridged mode of course I could ping the guest from the host. When I used NAT I could not.

I couldn’t ping the guest by name using either Bridged or NAT. The name couldn’t be resolved to an IP address. If I used Avahi maybe it would. Maybe only when using Bridged or maybe both.

Here is something I found on unix.stackexchange.com.

According to this documentation, current versions of VirtualBox do not expose the internal NAT interfaces to the host machine. You may configure special port forwarding rules to reach the boxes, but even the host is not able to reach the whole interface. You should used bridged networking for that.

OK now I just tried an Ubuntu 23.04 guest running under Gnome Boxes. It acted the same way as it did under VirtualBox. Not sure if I can configure Gnome Boxes to run bridged or not. Looks like the default is NAT.

1 Like

Avahi mostly just sits there and does it’s “thang” without you even noticing, Debian / Ubuntu have it installed by default and it just works… First time I became aware of it was with Debian Jessie and Ubuntu 14.04… annoyed the hell out of me that it didn’t work in RPM based distros like REL and CentOS… I was using a BananaPi running bind (managed via WebMin) to do my internal DNS stuff, but somewhere along the way I saw a few things about $HOSTNAME.local, and realised I already had that functionality (DNS without actual “DNS” via Avahi)…

So I can ping my Raspberry Pi3 running Stretch by it’s hostname.local :

╭─x@titan ~/tmp  
╰─➤  ping telesto.local                                                                                                                                                       130 ↵
PING telesto.local (10.1.1.33) 56(84) bytes of data.
64 bytes from 10.1.1.33 (10.1.1.33): icmp_seq=1 ttl=64 time=0.413 ms
64 bytes from 10.1.1.33 (10.1.1.33): icmp_seq=2 ttl=64 time=0.410 ms
64 bytes from 10.1.1.33 (10.1.1.33): icmp_seq=3 ttl=64 time=0.393 ms

I used to go to inordinate efforts to redact / mask my IP address information… I can’t be arsed these days… I doubt anyone could use that information, good luck to them, still gotta get onto my ethernet or WiFi first…

Telesto’s my TVHeadend server for picking up digital free to air TV :

#!/usr/bin/env bash
# watch TV @ telesto
# updated to run from MacOS too : 
OS=$(uname -s)
case $OS in
	Linux)
		# /usr/bin/vlc http://telesto.local:9981/playlist/channels &
		/usr/bin/mpv http://telesto.local:9981/playlist/channels &
	;;
	Darwin)
		# MacOS
		# /Applications/VLC.app/Contents/MacOS/VLC http://telesto.local:9981/playlist/channels &
		/opt/homebrew/bin/mpv http://telesto.local:9981/playlist/channels &
	;;
	*)
		# sumthin else
		echo "don't bother trying that stuff here... exiting..."
		exit 1
	;;
esac

I’ve left the commented out entries using VLC in case MPV breaks… but it works for me (better than VLC - mpv is now my goto video player on Mac and Linux).

Well virt-manager is different. As you saw I could ping the guest in NAT mode.

I think think may be a semantic issue.
In virt-manager I think NAT mode means make a bridge in the host AND implement NAT in the guest.

I was never able to get Gnome boxes to network to anything other than the internet.
So I moved to Vbox, and had repeated trouble with guest additions,
So I moved to qemu/kvm with virt-manager. Had to work hard and get help from @Rosika to get into that, but I am finding it more usable. Can ssh in and out of it, and can mount host directories in the guest. That makes it workable for me.

1 Like

Are you saying one could use avahi to implement dns names on a local virtual network?