Kvm: probleme reseau

Bonjour,

La configuration des paramètres IP (adresse, masque de sous-réseau, nom de domaine, serveur DNS) se fait manuellement ou automatiquement. Sans les paramètres IPs, la VM pourra difficilement télécharger ce qu’il lui faut pour finir l’installation.

Pour mettre en place un service DHCP pour que la configuration IP se fasse automatiquement, il faut installer le paquet dnsmasq sur l’hôte de virtualisation, modifier le fichier [mono]/etc/dnsmasq.conf[/mono] puis relancer le service dnsmasq.
Relancer le service dnsmasq se fait avec [mono]service dnsmasq restart[/mono] si l’on n’utilise pas Systemd (cas de Debian Wheezy) et probablement avec la commande [mono]systemctl restart dnsmasq[/mono] si Systemd (cas de Debian Jessie).

Proposition de configuration pour [mono]/etc/dnsmasq.conf[/mono] :

[quote]# Configuration file for dnsmasq.

Format is one option per line, legal options are the same

as the long options legal on the command line. See

“/usr/sbin/dnsmasq --help” or “man 8 dnsmasq” for details.

The following two options make you a better netizen, since they

tell dnsmasq to filter out queries which the public DNS cannot

answer, and which load the servers (especially the root servers)

uneccessarily. If you have a dial-on-demand link they also stop

these requests from bringing up the link uneccessarily.

Never forward plain names (without a dot or domain part)

domain-needed

Never forward addresses in the non-routed address spaces.

bogus-priv

If you don’t want dnsmasq to read /etc/resolv.conf or any other

file, getting its servers from this file instead (see below), then

uncomment this.

no-resolv

Add other name servers here, with domain specs if they are for

non-public domains.

server=8.8.8.8
server=8.8.4.4

If you want dnsmasq to listen for DHCP and DNS requests only on

specified interfaces (and the loopback) give the name of the

interface (eg eth0) here.

Repeat the line for more than one interface.

interface=br1

Or you can specify which interface not to listen on

#except-interface=

Or which to listen on by address (remember to include 127.0.0.1 if

you use this.)

#listen-address=

If you want dnsmasq to provide only DNS service on an interface,

configure it as shown above, and then use the following line to

disable DHCP on it.

#no-dhcp-interface=

On systems which support it, dnsmasq binds the wildcard address,

even when it is listening on only some interfaces. It then discards

requests that it shouldn’t reply to. This has the advantage of

working even when interfaces come and go and change address. If you

want dnsmasq to really bind only the interfaces it is listening on,

uncomment this option. About the only time you may need this is when

running another nameserver on the same machine.

#bind-interfaces

Uncomment this to enable the integrated DHCP server, you need

to supply the range of addresses available for lease and optionally

a lease time. If you have more than one network, you will need to

repeat this for each network on which you want to supply DHCP

service.

dhcp-range=192.168.1.2,192.168.1.254,1h

Set the NTP time server address to be the same machine as

is running dnsmasq

dhcp-option=option:ntp-server,0.0.0.0

Send microsoft-specific option to tell windows to release the DHCP lease

when it shuts down. Note the “i” flag, to tell dnsmasq to send the

value as a four-byte integer - that’s what microsoft wants. See

msdn.microsoft.com/en-us/library/cc227278.aspx

#dhcp-option=vendor:MSFT,2,1i

The DHCP server needs somewhere on disk to keep its lease database.

This defaults to a sane location, but if you want to change it, use

the line below.

#dhcp-leasefile=/var/lib/misc/dnsmasq.leases

Set the DHCP server to authoritative mode. In this mode it will barge in

and take over the lease for any client which broadcasts on the network,

whether it has a record of the lease or not. This avoids long timeouts

when a machine wakes up on a new network. DO NOT enable this if there’s

the slighest chance that you might end up accidentally configuring a DHCP

server for your campus/company accidentally. The ISC server uses

the same option, and this URL provides more information:

isc.org/index.pl?/sw/dhcp/authoritative.php

#dhcp-authoritative

Run an executable when a DHCP lease is created or destroyed.

The arguments sent to the script are “add” or “del”,

then the MAC address, the IP address and finally the hostname

if there is one.

#dhcp-script=/bin/echo

For debugging purposes, log each DNS query as it passes through

dnsmasq.

#log-queries

Log lots of extra information about DHCP transactions.

#log-dhcp

Include a another lot of configuration options.

#conf-file=/etc/dnsmasq.more.conf
#conf-dir=/etc/dnsmasq.d[/quote]Avec en rouge les options importantes, dont il faut impérativement comprendre l’utilité. Et qu’il faut éventuellement modifier.

Précisons que dnsmasq n’est pas uniquement un serveur DHCP mais également un relais/resolver DNS. Ces deux fonctions peuvent être remplies par des logiciels séparés.

Tu noteras l’option pour configurer un serveur NTP. Il est/était important d’installer un serveur NTP sur les serveurs de virtualisation pour éviter les éventuels problèmes d’horloge liés à la virtualisation.
Et ce n’est pas trop compliqué à faire.


AnonymousCoward

bonjour,

désolé pour le temps de réponse.

Merci beaucoup, après avoir testé avec le service DHCP, les vm arrivent a finaliser l’installation de l’OS sans rencontrer de problème.
Merci beaucoup pour toutes l’aide que vous m’avez apporter, me reste plus que a me pencher sur l’automatisation de l’installation d’un OS avec un script bash :slightly_smiling: pour finaliser mon projet de virtualisation.