fundave3
Goto Top

Virt MAnager VM eigene IP

Guten Abend zusammen.

Ich habe einen Ubuntu Host mit Virt Manager drauf.
Host hat eine IP.
Die VM soll nun auch eine bekommen.
Die frage ist wie stelle ich das an ?
Stelle ich unter netzwerkadapter die Bridge zu eth0 ein, so bricht mir die Verbindung weg und ich habe kurze zeit später nur noch eine IP unter Bridge1 . Alles schön und gut.
Soweit ich weiß brauche ich dann noch ür die VM eine IP , eine hbae ich ja noch.
Diese dann einfach auf br1 und der VM vergeben ? Statisch?
Geht das ?

Content-Key: 318984

Url: https://administrator.de/contentid/318984

Printed on: April 19, 2024 at 02:04 o'clock

Member: IrunGoldstein
Solution IrunGoldstein Oct 24, 2016 at 17:47:41 (UTC)
Goto Top
Hi denndsd,

hast du denn im Host auch eine bridge ins Netzwerk angelegt?

Falls dem nicht so ist hier sind relativ gute Erklärungen zu dem Netzwerk Thema mit KVM:


Es gibt mehrere Möglichkeiten, später die virtuelle Maschine mit ein realen Netzwerk / Internet zu verbinden. Per Voreinstellung setzt VMM ein virtuelles Netzwerk im Adressraum 192.168.122.0/24 ein, dass per NAT mit der realen Netzwerkkarte verbunden ist. Mit dieser Konfiguration kann jede virtuelle Maschine ins Internet, es sind keine weiteren Schritte notwendig.

Grundsätzlich besteht auch die Möglichkeit, dass die virtuelle Maschine sich per Bridge direkt in das reale Netzwerk einklinkt. Dazu muss aber zuerst die Bridge eingerichtet werden, was etwas Handarbeit erfordert. Quelle


Net-Brücke erstellen/anlegen:

Define the bridge interface

Edit the file /etc/network/interfaces, which on an Ubuntu or Debian system contains information for configuration of the network interface. This is what the file looked like before editing:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.0.101
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 192.168.0.4
        dns-search mydomain.net

We edit the file, so it gets the following content:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto br0
iface br0 inet static
        address 192.168.0.101
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        bridge_ports eth0
        bridge_stp off
        bridge_maxwait 5
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 192.168.0.4
        dns-search mydomain.net

We see that the internet address of octopus is now assigned to the br0 interface, and the original eth0 is defined tied to the bridge via the bridge_prots keyword. If your primary network interface is eth1, for example, you need to use that name.

Bring Up Bridge

Either reboot, or cycle the interfaces if the machine is local:

sudo ifup br0

Check the host

Once the server comes back up, you should test that it still has proper network connections, on both sides of the gateway, f.ex. using ping.

Now, check the network interfaces using the ip addr command. Notice in the following listing, that eth0 no longer has an associated IP address, while the new bridge device br0 has taken over the IP address.

octopus# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:1c:c4:5e:18:5e brd ff:ff:ff:ff:ff:ff
    inet6 fe80::21c:c4ff:fe5e:185e/64 scope link 
       valid_lft forever preferred_lft forever
3: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:1c:c4:5e:18:5e brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.101/24 brd 192.168.0.255 scope global eth0
    inet6 fe80::21c:c4ff:fe5e:185e/64 scope link 
       valid_lft forever preferred_lft forever
libvirt Guest Configuration

In virt-manager, a "bridge" configuration is now selectable when creating a new VM. To modify existing VMs, you can change the XML definition (in /etc/libvirt/qemu for the network interface, adjusting the mac address as desired:
    <interface type='bridge'>  
      <mac address='00:11:22:33:44:55'/>  
      <source bridge='br0'/>  
    </interface>
Finally, restart libvirtd (make sure your VMs are shutdown):

sudo /etc/init.d/libvirtd restart

Quelle: wiki.ubuntu.com/KvmWithBridge/

Daten natürlich an deine Umgebung anpassen!

Falls dies erledigt ist und es noch weitere fragen gibt nur zu face-smile

Grüße
Member: fundave3
fundave3 Oct 24, 2016 at 18:19:50 (UTC)
Goto Top
Ahja also ist es normal das eth0 dann keine IP mehr besitzt weil die br0/1 diese dann hat,
Okay Ich denke damit kann ich was anfangen.
Danke Ich Probiers
Member: IrunGoldstein
Solution IrunGoldstein Oct 24, 2016 at 18:25:21 (UTC)
Goto Top
Ja das ist vollkommen korrekt.

Ganz grob gesagt legst du eine neue Schnittstelle an welche dann den Zugang über die Physische Schnittstelle eth0 bekommt, um mit dem Netzwerk zu kommunizieren.
Member: fundave3
fundave3 Oct 24, 2016 at 19:49:59 (UTC)
Goto Top
Ahhhhhhh Okay.
PErfekt.
Gut, dann ist ja alles klar.
Danke dir.