Rede com pontes Linux

1

Estou tentando entender a rede e as pontes do Linux, configurando uma rede usando pontes. Eu tenho duas VMs com interfaces eth0

VM A - > 10.0.1.7 (eth0)

VM B - > 10.0.1.8 (eth0)

Roteador (10.0.1.1), que é confiurado com rotas adicionais abaixo

destino: 10.1.7.0/24, nexthop = 10.0.1.7

destino: 10.1.8.0/24, nexthop = 10.0.1.8

Eu adicionei uma ponte Linux com os seguintes comandos

ip link add br0 type bridge
ip addr add 10.1.7.1/24 dev br0
ip link set br0 up

[root@test-1 centos]# ip addr
1: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether fa:16:3e:d9:59:5b brd ff:ff:ff:ff:ff:ff
inet 10.0.1.7/24 brd 10.0.1.255 scope global dynamic eth0
   valid_lft 507sec preferred_lft 507sec
inet6 fe80::f816:3eff:fed9:595b/64 scope link
   valid_lft forever preferred_lft forever
2: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1000
link/ether 46:d0:ca:31:fa:b2 brd ff:ff:ff:ff:ff:ff
inet 10.1.7.1/24 scope global br0
   valid_lft forever preferred_lft forever
inet6 fe80::44d0:caff:fe31:fab2/64 scope link
   valid_lft forever preferred_lft forever

[root@test-1 centos]# ip route
default via 10.0.1.1 dev eth0
10.0.0.0/24 dev eth0  proto static  scope link
10.0.1.0/24 dev eth0  proto kernel  scope link  src 10.0.1.7
10.1.7.0/24 dev br0  proto kernel  scope link  src 10.1.7.1
169.254.169.254 via 10.0.1.1 dev eth0  proto static
172.16.60.0/24 dev eth0  proto static  scope link

Solicitação de ping da VM A para a VM A na interface eth0

[root@test-1 centos]# ping 10.1.7.1 -c 1
 PING 10.1.7.1 (10.1.7.1) 56(84) bytes of data.
 64 bytes from 10.1.7.1: icmp_seq=1 ttl=64 time=0.065 ms
 --- 10.1.7.1 ping statistics ---
 1 packets transmitted, 1 received, 0% packet loss, time 0ms
 rtt min/avg/max/mdev = 0.065/0.065/0.065/0.000 ms

A solicitação de ping da VM A para a VM A na interface br0 está falhando

[root@test-1 centos]# ping -I br0 10.1.7.1 -c 1
PING 10.1.7.1 (10.1.7.1) from 10.1.7.1 br0: 56(84) bytes of data.

--- 10.1.7.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

Agora, quando tentar executar o ping em 10.1.7.1 a partir da VM B, a VM A está enviando a resposta de eco, mas a VM b não a está recebendo.

[root@test-2 centos]# ping 10.1.7.1 -c 2
PING 10.1.7.1 (10.1.7.1) 56(84) bytes of data.
--- 10.1.7.1 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 999ms

ambos os iptables das VMs são Flushed e tcpdump está abaixo

VM A

[root@test-1 centos]# tcpdump -i eth0 -nn -t -vv icmp
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
IP (tos 0x0, ttl 63, id 16561, offset 0, flags [DF], proto ICMP (1), length 84)
    10.0.1.8 > 10.1.7.1: ICMP echo request, id 2660, seq 1, length 64
IP (tos 0x0, ttl 64, id 11195, offset 0, flags [none], proto ICMP (1), length 84)
    10.1.7.1 > 10.0.1.8: ICMP echo reply, id 2660, seq 1, length 64   
IP (tos 0x0, ttl 63, id 17282, offset 0, flags [DF], proto ICMP (1), length 84)
    10.0.1.8 > 10.1.7.1: ICMP echo request, id 2660, seq 2, length 64
IP (tos 0x0, ttl 64, id 11473, offset 0, flags [none], proto ICMP (1), length 84)
    10.1.7.1 > 10.0.1.8: ICMP echo reply, id 2660, seq 2, length 64 

VM B

[root@test-2 centos]# tcpdump -i eth0 -t -nn -vv icmp
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
IP (tos 0x0, ttl 64, id 16561, offset 0, flags [DF], proto ICMP (1), length 84)
    10.0.1.8 > 10.1.7.1: ICMP echo request, id 2660, seq 1, length 64
IP (tos 0x0, ttl 64, id 17282, offset 0, flags [DF], proto ICMP (1), length 84)
    10.0.1.8 > 10.1.7.1: ICMP echo request, id 2660, seq 2, length 64

E se eu pegar um tcpdump da interface br0 (tcpdump -i br0 icmp), não vejo nenhum pacote - por quê? 10.1.7.1 está ligado a br0.

Qualquer configuração do iptables é necessária?

E eu tentei anexar eth0 a br0, (brctl addif br0 eth0) eu perco minha conectividade vm e não sou capaz de ssh ou pingar VM. Existe outra maneira pela qual a interface eth0 encaminha os pacotes para br0? Eu não sei sobre a interface veth ou tuntap; é essa a maneira de fazer isso?

    
por lava 04.07.2017 / 04:33

0 respostas