openvpn configuration - kann keine Verbindung zu Servern in aws vpc herstellen

697
codelinx

Ich habe ein Problem, wenn ich mich außerhalb einer Whitelist-IP verbinde:

  1. Die VPN-Verbindung verbindet sich erfolgreich
  2. Die IP des Geräts ändert sich nicht
  3. das internet funktioniert
  4. kann nicht direkt auf Instanzen zugreifen, während eine Verbindung zum VPN besteht

Im Folgenden finden Sie meine openvpn-Konfiguration in einer AWS EC2-Instanz in einem vpc:

EC2->

Ubuntu 16.04 LTS openvpn easyrsa ufw Has elastic ip (let's call this 26.3.4.5 for this config file) 

Die AWS Security-Gruppe wird einfach wie folgt eingerichtet:

INBOUND-> Ports Protocol Source openvpn 22 tcp PrivateIP/0 ✔ 443 tcp 0.0.0.0/0 ✔  OUTBOUND-> All traffic All All 0.0.0.0/0 

openvpn Konfiguration->

port PORTFORTRAFFIC dev tun  **# All these are in the root directory of openvpn i.e. /etc/openvpn/*.crt or /etc/openvpn/*.key**   ca ca.crt cert vpnserver.crt key vpnserver.key dh dh2048.pem # VPN Subnet server 10.8.0.0 255.255.255.0 # DNS push "dhcp-option DNS 208.67.222.222"  push "dhcp-option DNS 208.67.220.220"  push "route 172.30.0.0 255.255.0.0" # AWS EC2 Private IPs 172.x.x.x  keepalive 10 120  tls-auth ta.key 0 # This file is secret key-direction 0  cipher AES-128-CBC # AES auth SHA256  comp-lzo # enabled for client setup as well user nobody group nogroup  persist-key persist-tun status openvpn-status.log verb 6 # DEBUGGING currently but its set to 3 normally log-append openvpn.log 

Hab die iptables mit dieser Zeile im Terminal gemacht und zu /etc/rc.local hinzugefügt:

# iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE 

Firewall-Sachen:

# ufw allow PORTFORTRAFFIC/tcp  # ufw allow OpenSSH  # ufw app list Available applications: OpenSSH 

Dies wurde zu "/etc/sysctl.conf" hinzugefügt, um Persistenz zu gewährleisten:

net.ipv4.conf.default.rp_filter=1 net.ipv4.conf.all.rp_filter=1 net.ipv4.ip_forward=1 net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.all.send_redirects = 0  # cat /proc/sys/net/ipv4/ip_forward 

Gibt 1 zurück

0
Ist Ihr OpenVPN-Server in der VPC oder in Classic? Haben Sie Ihre ACL auf die Subnetze überprüft? Haben Sie der SecurityGroup Ihres OpenVPN-Servers Zugriff auf Ihre Absichten gewährt? Algeriassic vor 6 Jahren 0

1 Antwort auf die Frage

0
Algeriassic

Sie müssen Ihre Route ändern in:

push "route route 172.30.0.0 255.255.0.0 vpn_gateway"