-- StefanHegger - 02 Aug 2021

brctl show:

zeigt die vorhandenen Bridges an. Bridges können nur virtuelle Interfaces haben, als auch physikalische. Beim Anlegen von KVM wird eine virbr0 angelegt. Die Konfiguration findet man in

/etc/libvirt/qemu/networks/default.xml
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
 virsh net-edit default
or other application using the libvirt API.
-->
<network>
 <name>default</name>
 <uuid>9e29760a-d6bb-4765-afad-9078d9ea54db</uuid>
 <forward mode='nat'/>
 <bridge name='virbr0' stp='on' delay='0'/>
 <mac address='52:54:00:30:19:14'/>
 <ip address='192.168.122.1' netmask='255.255.255.0'>
 <dhcp>
 <range start='192.168.122.2' end='192.168.122.254'/>
 </dhcp>
 </ip>
</network>
diese Konfiguration beinhaltet DHCP und Natting. Also die VM hat eine IP aus dem Bereich 192.168.122.0/24.

Möchte man das ändern so kann man ein einfaches neues Profil anlegen:
!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
 virsh net-edit netbox
or other application using the libvirt API.
-->
<network>
 <name>netbox</name>
 <uuid>4fc58af1-f545-4656-9e08-353cb9028600</uuid>
 <bridge name='netboxbr' stp='on' delay='0'/>
 <mac address='52:54:00:46:af:07'/>
 <domain name='netboxnet'/>
</network>
dieses Profil benhaltet kein NAT und keinen DHCP. Die VM muss also eine IP Adresse zugewiesen bekommen (statisch) und diese muss auch rebootfest konfiguriert werden. In der Datei /etc/libvirt/qemu/>vm name> kann man das netwerk festlegen
<source network='netbox'/>

oder aber mit virsch edit <vm name> ändern.

desweiteren ist wichtig die fwrules zu kontrollieren.

dort wird über das postrouting das Natting gemacht
Chain POSTROUTING (policy ACCEPT 31 packets, 2500 bytes)
num pkts bytes target prot opt in out source destination 
1 0 0 RETURN all -- any any 192.168.122.0/24 224.0.0.0/24 
2 0 0 RETURN all -- any any 192.168.122.0/24 255.255.255.255 
3 165 9900 MASQUERADE tcp -- any any 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
4 28 2128 MASQUERADE udp -- any any 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
5 5 420 MASQUERADE all -- any any 192.168.122.0/24 !192.168.122.0/24

In der Forward rule ist zu checken was rejected wird.
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination 
1 0 0 ACCEPT all -- any virbr0 anywhere 192.168.122.0/24 ctstate RELATED,ESTABLISHED
2 0 0 ACCEPT all -- virbr0 any 192.168.122.0/24 anywhere 
3 0 0 ACCEPT all -- virbr0 virbr0 anywhere anywhere 
4 0 0 REJECT all -- any virbr0 anywhere anywhere reject-with icmp-port-unreachable
5 0 0 REJECT all -- virbr0 any anywhere anywhere reject-with icmp-port-unreachable
6 0 0 ACCEPT all -- netboxbr netboxbr anywhere anywhere

This topic: Main > WebHome > WikiUsers > StefanHegger > BridgesLinux
Topic revision: 02 Aug 2021, StefanHegger
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Milan? Send feedback