KVM Bridge no Ubuntu Server 16.04 não funciona

0

Obrigado por ouvir.

Eu segui algumas orientações aqui e em outros lugares, acreditando que tenho a configuração correta, mas meus convidados não conseguem ver além do host (ou seja, a internet) e não consigo fazer ping em nenhuma das portas os convidados.

A menos que eu tenha entendido totalmente errado, eu pensei que era o que a ponte me daria! Esperando dar todas as informações relevantes ...

libvirt network default.xml ...

<network>
  <name>default</name>
  <uuid>64acadc1-0c41-4cf5-850e-01bcfe5ad7ba</uuid>
  <forward mode='route'/>
  <bridge name='br0' stp='on' delay='0'/>
  <mac address='52:54:00:54:b1:e4'/>
  <ip address='192.168.0.2' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.0.3' end='192.168.0.254'/>
      <host mac='52:54:00:13:3a:69' name='node1' ip='192.168.0.201'/>
      <host mac='52:54:00:92:af:91' name='node2' ip='192.168.0.202'/>
      <host mac='52:54:00:bb:4b:6d' name='node3' ip='192.168.0.203'/>
      <host mac='52:54:00:e3:4b:4a' name='node4' ip='192.168.0.204'/>
    </dhcp>
  </ip>
</network>

xml convidado ...

<interface type='bridge'>
  <mac address='52:54:00:13:3a:69'/>
  <source bridge='br0'/>
</interface>

ifconfig no host ...

br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.0.2  netmask 255.255.255.0  broadcast 192.168.0.255
    ether 52:54:00:54:b1:e4  txqueuelen 1000  (Ethernet)
    RX packets 552  bytes 41699 (41.6 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 240  bytes 26714 (26.7 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp3s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.1.13  netmask 255.255.255.0  broadcast 192.168.1.255
    inet6 fe80::2e76:8aff:fea9:7e5e  prefixlen 64  scopeid 0x20<link>
    ether 2c:76:8a:a9:7e:5e  txqueuelen 1000  (Ethernet)
    RX packets 3679  bytes 1174123 (1.1 MB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 4101  bytes 410899 (410.8 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ifconfig no convidado ...

ens3  Link encap:Ethernet  HWaddr 52:54:00:13:3a:69
      inet addr:192.168.0.201  Bcast:192.168.0.255  Mask:255.255.255.0
      inet6 addr: fe80::5054:ff:fe13:3a69/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:191 errors:0 dropped:0 overruns:0 frame:0
      TX packets:335 errors:0 dropped:0 overruns:0 carrier:0
      collisions:1605 txqueuelen:1000
      RX bytes:22402 (22.4 KB)  TX bytes:34822 (34.8 KB)

lo    Link encap:Local Loopback
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:8530 errors:0 dropped:0 overruns:0 frame:0
      TX packets:8530 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1
      RX bytes:1766049 (1.7 MB)  TX bytes:1766049 (1.7 MB)

show de brctl ...

bridge name     bridge id               STP enabled     interfaces
br0             8000.52540054b1e4       yes             br0-nic

netstat -rn ...

Kernel IP routing table
Destination   Gateway       Genmask         Flags  MSS Window  irtt Iface
0.0.0.0       192.168.1.1   0.0.0.0         UG       0 0          0 enp3s0f0
192.168.0.0   0.0.0.0       255.255.255.0   U        0 0          0 br0
192.168.1.0   0.0.0.0       255.255.255.0   U        0 0          0 enp3s0f0
192.168.1.1   0.0.0.0       255.255.255.255 UH       0 0          0 enp3s0f0

Os convidados podem fazer ping no host e eles podem pingar uns aos outros.

    
por Jus 13.12.2017 / 23:03

1 resposta

0

Atualmente, você tem sua ponte e missões em uma sub-rede diferente da sua sub-rede principal. Então, não suas missões não têm acesso à internet, porque não há caminho para o seu gateway. Coloque tudo na mesma sub-rede. Exemplos do meu computador host principal:

host principal ifconfig. Observe como o enp3s0 nem mostra um endereço IP. Isso é porque ele é ligado a br0 e ambos têm o mesmo endereço IP. Ignore lxcbr0 e virbr0, eles não fazem parte desta discussão, nem os utilizo (mostrados apenas para completude).

doug@s15:~$ ifconfig
br0       Link encap:Ethernet  HWaddr f4:6d:04:65:2d:8e
          inet addr:192.168.111.112  Bcast:192.168.111.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4574 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2604 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:509690 (509.6 KB)  TX bytes:425082 (425.0 KB)

enp3s0    Link encap:Ethernet  HWaddr f4:6d:04:65:2d:8e
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4574 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2604 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:573726 (573.7 KB)  TX bytes:426090 (426.0 KB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:174 errors:0 dropped:0 overruns:0 frame:0
          TX packets:174 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12644 (12.6 KB)  TX bytes:12644 (12.6 KB)

lxcbr0    Link encap:Ethernet  HWaddr 00:16:3e:00:00:00
          inet addr:10.0.3.1  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:21:9e:43
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Aqui está o meu arquivo de interfaces de hosts principais, onde br0 é vinculado a enp3s0:

doug@s15:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface and bridge
auto br0
iface br0 inet dhcp
#iface br0 inet static
#  address 192.168.111.112
#  network 192.168.111.0
#  netmask 255.255.255.0
#  gateway 192.168.111.1
#  broadcast 192.168.111.255
#  dns-search smythies.com
#  dns-nameservers 192.168.111.1
  bridge_ports enp3s0
  bridge_fd 9
  bridge_hello 2
  bridge_maxage 12
  bridge_stp off

E aqui está a seção de rede de um convidado típico. Eu atribuo o MAC porque eu atribuo endereços IP do meu servidor DHCP com base no MAC, e então meu material DNS funciona da maneira que eu quero.

<interface type='bridge'>
  <mac address='52:54:00:14:ff:9c'/>
  <source bridge='br0'/>
  <model type='virtio'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

E aqui está o roteamento. Tudo na minha LAN está na sub-rede 192.168.111.XXX e, portanto, há caminho para / do gateway via br0:

doug@s15:~$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.111.1   0.0.0.0         UG        0 0          0 br0
10.0.3.0        0.0.0.0         255.255.255.0   U         0 0          0 lxcbr0
192.168.111.0   0.0.0.0         255.255.255.0   U         0 0          0 br0
192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0
    
por Doug Smythies 13.12.2017 / 23:37