como configurar o roteador linux no meu ambiente? [fechadas]

1

Gostaria de fazer o roteador de teste da seguinte forma:

test11 - host:

 eth0: 100.0.10.23/24     
 eth1: 111.1.1.11/24 -- to testR

testR - roteador linux:

 eth0: 100.0.10.26/24
 eth1: 111.1.1.12/24 -- to test11      
 eth2: 111.3.3.14/24 -- to test33

test33 - host:

 eth0: 100.0.10.25/24    
 eth1: 111.3.3.15/24  -- to testR       

comentários de status:

  • todas as máquinas são do Ubuntu 14.04.
  • A interface eth0 de cada máquina é apenas para gerenciamento.
  • test33 inicia o ping para test11
  • ping de test33 para testR eth2 está ok.
  • ping do test11 para testR eth1 está ok.
  • , mas o ping do test33 para o test11 está sempre com falha
    (esta é a coisa certa tudo que eu quero realizar !!)

Eu tenho algumas informações sobre o roteador linux no link , mas ele não funciona.  por favor, me ensine em quais configurações tem problemas.

tabela de roteamento test11:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface      
0.0.0.0         100.0.10.1      0.0.0.0         UG    0      0        0 eth0      
100.0.10.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0      
111.1.1.0       0.0.0.0         255.255.255.0   U     0      0        0 eth1      
111.3.3.0       111.1.1.12      255.255.255.0   UG    0      0        0 eth1      

tabela de roteamento test33:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface      
0.0.0.0         100.0.10.1      0.0.0.0         UG    0      0        0 eth0      
100.0.10.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0      
111.1.1.0       111.3.3.14      255.255.255.0   UG    0      0        0 eth1      
111.3.3.0       0.0.0.0         255.255.255.0   U     0      0        0 eth1      

tabela de roteamento testR:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface      
0.0.0.0         100.0.10.1      0.0.0.0         UG    0      0        0 eth0      
100.0.10.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0      
111.1.1.0       0.0.0.0         255.255.255.0   U     0      0        0 eth1      
111.3.3.0       0.0.0.0         255.255.255.0   U     0      0        0 eth2      

testR iptables-save :

Generated by iptables-save v1.4.21 on Tue Jun 13 06:55:19 2017      
*nat      
:PREROUTING ACCEPT [96:7992]      
:INPUT ACCEPT [4:264]      
:OUTPUT ACCEPT [52:3744]      
:POSTROUTING ACCEPT [52:3744]      
-A POSTROUTING -o eth1 -j MASQUERADE      
COMMIT      
Completed on Tue Jun 13 06:55:19 2017      
Generated by iptables-save v1.4.21 on Tue Jun 13 06:55:19 2017      
*filter      
:INPUT ACCEPT [3587:239788]      
:FORWARD ACCEPT [0:0]      
:OUTPUT ACCEPT [3378:375728]      
-A FORWARD -i eth1 -o eth2 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT      
-A FORWARD -i eth2 -o eth1 -j ACCEPT      
COMMIT      
Completed on Tue Jun 13 06:55:19 2017      

root@testR:~# sysctl -p      
net.ipv4.ip_forward = 1      

Em testR, tcpdumps:

no testR, todos os pedidos e respostas icmp fluem bem

root@testR:~# tcpdump -i eth2 -P in -p icmp      
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode      
listening on eth2, link-type EN10MB (Ethernet), capture size 65535 bytes      
06:57:08.358945 IP 111.3.3.15 > 111.1.1.11: ICMP echo request, id 2116, seq 21, length 64      

root@testR:~# tcpdump -i eth1 -P out -p icmp      
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode      
listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes      
06:57:21.462999 IP 111.1.1.12 > 111.1.1.11: ICMP echo request, id 2116, seq 34, length 64      

root@testR:~# tcpdump -i eth1 -P in -p icmp      
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode      
listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes      
06:57:34.567038 IP 111.1.1.11 > 111.1.1.12: ICMP echo reply, id 2116, seq 47, length 64      

root@testR:~# tcpdump -i eth2 -P out -p icmp      
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode      
listening on eth2, link-type EN10MB (Ethernet), capture size 65535 bytes      
06:57:44.647228 IP 111.1.1.11 > 111.3.3.15: ICMP echo reply, id 2116, seq 57, length 64      

No test11, tcpdumps

no teste11, pings do test33 foram recebidos e responderam com sucesso

root@test11:~# tcpdump -i eth1 -p icmp      
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode      
listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes      
06:58:01.765672 IP 111.1.1.12 > 111.1.1.11: ICMP echo request, id 2116, seq 73, length 64      
06:58:01.765681 IP 111.1.1.11 > 111.1.1.12: ICMP echo reply, id 2116, seq 73, length 64      
...      

Em test33 ping para test11:

isso é realmente o que você quer alcançar !!!

ubuntu@testcolor-3:~$ ping -I eth1 test11      
PING test11 (111.1.1.11) from 111.3.3.15 eth1: 56(84) bytes of data.      
^C      
--- test11 ping statistics ---      
 **247 packets transmitted, 0 received, 100% packet loss, time 247966ms**      

mas .. sem problemas ping entre interfaces adjacentes

root@test11:~# ping 111.1.1.12 -c1    
PING 111.1.1.12 (111.1.1.12) 56(84) bytes of data.    
64 bytes from 111.1.1.12: icmp_seq=1 ttl=64 time=0.321 ms    

root@testR:~# ping -c1 111.3.3.15    
PING 111.3.3.15 (111.3.3.15) 56(84) bytes of data.    
64 bytes from 111.3.3.15: icmp_seq=1 ttl=64 time=0.356 ms    

root@testR:~# ping 111.1.1.11 -c1    
PING 111.1.1.11 (111.1.1.11) 56(84) bytes of data.    
64 bytes from 111.1.1.11: icmp_seq=1 ttl=64 time=0.492 ms    

ubuntu@test33:~$ ping -c1 111.3.3.14    
PING 111.3.3.14 (111.3.3.14) 56(84) bytes of data.    
64 bytes from 111.3.3.14: icmp_seq=1 ttl=64 time=0.541 ms    
    
por Joseph Park 13.06.2017 / 09:31

0 respostas