Estou tentando que minha instância do EC2 (OMD) se comunique com meu servidor de rede local (Raspberry Pi) por meio de outra instância do EC2 (OpenVPN), mas não consigo fazer isso funcionar.
O servidor do OMD pode executar ping no RPi, mas não pode se conectar a ele via SSH, embora as configurações do SSH sejam padrão e não haja firewall. Port 6556 está acessível embora.
Verificação de portas do servidor do OMD
[root@omd ~]# nc -zvv 192.168.16.150 6556
Connection to 192.168.16.150 6556 port [tcp/*] succeeded!
[root@omd ~]# nc -zvv 192.168.16.150 22
nc: connect to 192.168.16.150 port 22 (tcp) failed: Connection timed out
[root@omd ~]#
O RPi's 22 e 6556 estão abertos a todos, mas por que o OMD não consegue SSH?
root@rpi:~# netstat -tunlp | egrep "6556|22"
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 535/sshd
tcp 0 0 0.0.0.0:6556 0.0.0.0:* LISTEN 743/xinetd
tcp6 0 0 :::22 :::* LISTEN 535/sshd
root@rpi:~#
Veja o que eu tenho tentado alcançar. Por favor, veja este link .
- O OpenVPN e o RPi estão conectados uns com os outros por meio de conexão VPN
- O OMD não se conectará à VPN, apenas usará o servidor OpenVPN como um gateway
- O OMD se comunicará com o RPi por meio do servidor OpenVPN e vice-versa
Você poderia me ajudar com isso?
Por favor, deixe-me saber se você precisar de mais informações.
Obrigado antecipadamente, pessoal!
AWS - OMD Review
eth0: 10.0.0.4
=======================
PING
=======================
[root@omd ~]# ping -c 3 192.168.16.150
PING 192.168.16.150 (192.168.16.150) 56(84) bytes of data.
64 bytes from 192.168.16.150: icmp_seq=1 ttl=63 time=100 ms
64 bytes from 192.168.16.150: icmp_seq=2 ttl=63 time=100 ms
64 bytes from 192.168.16.150: icmp_seq=3 ttl=63 time=159 ms
--- 192.168.16.150 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2159ms
rtt min/avg/max/mdev = 100.072/119.877/159.357/27.917 ms
[root@omd ~]#
=======================
TRACEROUTE
=======================
[root@omd ~]# traceroute 192.168.16.150
traceroute to 192.168.16.150 (192.168.16.150), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
11 * * *
12 * * *
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 * * *
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
[root@omd ~]#
=======================
ROUTE TABLE
=======================
[root@omd ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.16.0 10.0.0.5 255.255.255.0 UG 0 0 0 eth0
172.17.0.0 10.0.0.5 255.255.255.0 UG 0 0 0 eth0
0.0.0.0 10.0.0.1 0.0.0.0 UG 0 0 0 eth0
[root@omd ~]#
AWS - OpenVPN
eth0: 10.0.0.5
tun0: 172.17.0.1
=======================
PING
=======================
[root@openpvn ~]# ping -c 3 10.0.0.4
PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=0.502 ms
64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=0.639 ms
64 bytes from 10.0.0.4: icmp_seq=3 ttl=64 time=0.570 ms
--- 10.0.0.4 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.502/0.570/0.639/0.059 ms
[root@openpvn ccd]# ping -c 3 192.168.16.150
PING 192.168.16.150 (192.168.16.150) 56(84) bytes of data.
64 bytes from 192.168.16.150: icmp_seq=1 ttl=64 time=173 ms
64 bytes from 192.168.16.150: icmp_seq=2 ttl=64 time=142 ms
64 bytes from 192.168.16.150: icmp_seq=3 ttl=64 time=120 ms
--- 192.168.16.150 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 120.684/145.486/173.209/21.546 ms
[root@openpvn ~]#
=======================
ROUTE
=======================
[root@openvpn ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.0.1 0.0.0.0 UG 0 0 0 eth0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.169.254 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
172.17.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
192.168.16.0 172.17.0.2 255.255.255.0 UG 0 0 0 tun0
[root@openvpn ~]#
=======================
IPTABLES
=======================
[root@openvpn ~]# cat /etc/sysconfig/iptables
*nat
:POSTROUTING ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -s 172.17.0.0/24 -d 0.0.0.0/0 -o eth0 -j MASQUERADE
COMMIT
[root@openvpn ~]#
=======================
SYSCTL
=======================
[root@openvpn ~]# grep forward /etc/sysctl.conf
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
[root@openvpn ~]#
LAN - Raspberry Pi
eth0: 192.168.16.150
tun0: 172.17.0.253
=======================
PING
=======================
root@rpi:~# ping -c 3 10.0.0.4
PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4: icmp_seq=1 ttl=63 time=128 ms
64 bytes from 10.0.0.4: icmp_seq=2 ttl=63 time=106 ms
64 bytes from 10.0.0.4: icmp_seq=3 ttl=63 time=126 ms
--- 10.0.0.4 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 106.837/120.409/128.312/9.644 ms
root@rpi:~#
=======================
TRACEROUTE
=======================
root@rpi:~# traceroute 10.0.0.4
traceroute to 10.0.0.4 (10.0.0.4), 30 hops max, 60 byte packets
1 172.17.0.1 (172.17.0.1) 177.150 ms 200.416 ms 199.949 ms
2 10.0.0.4 (10.0.0.4) 205.052 ms 216.804 ms 223.456 ms
root@rpi:~#
=======================
ROUTE TABLE
=======================
root@rpi:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.17.0.1 128.0.0.0 UG 0 0 0 tun0
0.0.0.0 192.168.8.1 0.0.0.0 UG 0 0 0 eth1
0.0.0.0 192.168.16.254 0.0.0.0 UG 202 0 0 eth0
0.0.0.0 192.168.8.1 0.0.0.0 UG 203 0 0 eth1
5X.XX.XX.XXX 192.168.8.1 255.255.255.255 UGH 0 0 0 eth1
128.0.0.0 172.17.0.1 128.0.0.0 UG 0 0 0 tun0
172.17.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
192.168.8.0 0.0.0.0 255.255.255.0 U 203 0 0 eth1
192.168.16.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
root@rpi:~#