logo elektroda
logo elektroda
X
logo elektroda
REKLAMA
REKLAMA
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

[Rozwiązano] Konfiguracja OpenVPN - brak dostępu do internetu z publicznego IP serwera

Tomy@ 15 Sie 2019 19:19 3525 25
REKLAMA
  • #1 18117136
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Witam
    Postawiłem serwer VPN, połączenie jest nawiązane poprawnie, tylko mam problem z dostępem do internetu z publicznego adresu IP serwera

    Blokując linię w pliku serwer.conf
    ;push "redirect-gateway def1 bypass-dhcp"
    internet po stronie klientów działa z tym, że nie pod pub. IP serwera tylko pod ISP. Moja sieć to PLAY
    Dodałem regułę w iptables aby na kliencie był dostęp do internetu oraz zapisujemy konfigurację:
    iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
    service iptables save

    Następnie edytowałem plik /etc/sysctl.conf
    w którym dodajemy linijkę, która odpowiada za przekazywanie adresów IP
    net.ipv4.ip_forward = 1

    Bardzo proszę o pomoc :)

    plik serwer.conf
    Spoiler:

    #################################################
    # Sample OpenVPN 2.0 config file for            #
    # multi-client server.                          #
    #                                               #
    # This file is for the server side              #
    # of a many-clients <-> one-server              #
    # OpenVPN configuration.                        #
    #                                               #
    # OpenVPN also supports                         #
    # single-machine <-> single-machine             #
    # configurations (See the Examples page         #
    # on the web site for more info).               #
    #                                               #
    # This config should work on Windows            #
    # or Linux/BSD systems.  Remember on            #
    # Windows to quote pathnames and use            #
    # double backslashes, e.g.:                     #
    # "C:\Program Files\OpenVPN\config\foo.key" #
    #                                               #
    # Comments are preceded with ''#'' or '';''         #
    #################################################
    
    # Which local IP address should OpenVPN
    # listen on? (optional)
    ;local a.b.c.d
    
    # Which TCP/UDP port should OpenVPN listen on?
    # If you want to run multiple OpenVPN instances
    # on the same machine, use a different port
    # number for each one.  You will need to
    # open up this port on your firewall.
    port 1107
    
    # TCP or UDP server?
    ;proto tcp
    proto udp
    
    # "dev tun" will create a routed IP tunnel,
    # "dev tap" will create an ethernet tunnel.
    # Use "dev tap0" if you are ethernet bridging
    # and have precreated a tap0 virtual interface
    # and bridged it with your ethernet interface.
    # If you want to control access policies
    # over the VPN, you must create firewall
    # rules for the the TUN/TAP interface.
    # On non-Windows systems, you can give
    # an explicit unit number, such as tun0.
    # On Windows, use "dev-node" for this.
    # On most systems, the VPN will not function
    # unless you partially or fully disable
    # the firewall for the TUN/TAP interface.
    ;dev tap
    dev tun
    
    # Windows needs the TAP-Win32 adapter name
    # from the Network Connections panel if you
    # have more than one.  On XP SP2 or higher,
    # you may need to selectively disable the
    # Windows firewall for the TAP adapter.
    # Non-Windows systems usually don''t need this.
    ;dev-node MyTap
    
    # SSL/TLS root certificate (ca), certificate
    # (cert), and private key (key).  Each client
    # and the server must have their own cert and
    # key file.  The server and all clients will
    # use the same ca file.
    #
    # See the "easy-rsa" directory for a series
    # of scripts for generating RSA certificates
    # and private keys.  Remember to use
    # a unique Common Name for the server
    # and each of the client certificates.
    #
    # Any X509 key management system can be used.
    # OpenVPN can also use a PKCS #12 formatted key file
    # (see "pkcs12" directive in man page).
    ca ca.crt
    cert server.crt
    key server.key  # This file should be kept secret
    
    # Diffie hellman parameters.
    # Generate your own with:
    #   openssl dhparam -out dh2048.pem 2048
    dh dh2048.pem
    
    # Network topology
    # Should be subnet (addressing via IP)
    # unless Windows clients v2.0.9 and lower have to
    # be supported (then net30, i.e. a /30 per client)
    # Defaults to net30 (not recommended)
    ;topology subnet
    
    # Configure server mode and supply a VPN subnet
    # for OpenVPN to draw client addresses from.
    # The server will take 10.8.0.1 for itself,
    # the rest will be made available to clients.
    # Each client will be able to reach the server
    # on 10.8.0.1. Comment this line out if you are
    # ethernet bridging. See the man page for more info.
    server 10.8.0.0 255.255.255.0
    
    # Maintain a record of client <-> virtual IP address
    # associations in this file.  If OpenVPN goes down or
    # is restarted, reconnecting clients can be assigned
    # the same virtual IP address from the pool that was
    # previously assigned.
    ifconfig-pool-persist ipp.txt
    
    # Configure server mode for ethernet bridging.
    # You must first use your OS''s bridging capability
    # to bridge the TAP interface with the ethernet
    # NIC interface.  Then you must manually set the
    # IP/netmask on the bridge interface, here we
    # assume 10.8.0.4/255.255.255.0.  Finally we
    # must set aside an IP range in this subnet
    # (start=10.8.0.50 end=10.8.0.100) to allocate
    # to connecting clients.  Leave this line commented
    # out unless you are ethernet bridging.
    ;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100
    
    # Configure server mode for ethernet bridging
    # using a DHCP-proxy, where clients talk
    # to the OpenVPN server-side DHCP server
    # to receive their IP address allocation
    # and DNS server addresses.  You must first use
    # your OS''s bridging capability to bridge the TAP
    # interface with the ethernet NIC interface.
    # Note: this mode only works on clients (such as
    # Windows), where the client-side TAP adapter is
    # bound to a DHCP client.
    ;server-bridge
    
    # Push routes to the client to allow it
    # to reach other private subnets behind
    # the server.  Remember that these
    # private subnets will also need
    # to know to route the OpenVPN client
    # address pool (10.8.0.0/255.255.255.0)
    # back to the OpenVPN server.
    ;push "route 192.168.10.0 255.255.255.0"
    ;push "route 192.168.20.0 255.255.255.0"
    
    # To assign specific IP addresses to specific
    # clients or if a connecting client has a private
    # subnet behind it that should also have VPN access,
    # use the subdirectory "ccd" for client-specific
    # configuration files (see man page for more info).
    
    # EXAMPLE: Suppose the client
    # having the certificate common name "Thelonious"
    # also has a small subnet behind his connecting
    # machine, such as 192.168.40.128/255.255.255.248.
    # First, uncomment out these lines:
    ;client-config-dir ccd
    ;route 192.168.40.128 255.255.255.248
    # Then create a file ccd/Thelonious with this line:
    #   iroute 192.168.40.128 255.255.255.248
    # This will allow Thelonious'' private subnet to
    # access the VPN.  This example will only work
    # if you are routing, not bridging, i.e. you are
    # using "dev tun" and "server" directives.
    
    # EXAMPLE: Suppose you want to give
    # Thelonious a fixed VPN IP address of 10.9.0.1.
    # First uncomment out these lines:
    ;client-config-dir ccd
    ;route 10.9.0.0 255.255.255.252
    # Then add this line to ccd/Thelonious:
    #   ifconfig-push 10.9.0.1 10.9.0.2
    
    # Suppose that you want to enable different
    # firewall access policies for different groups
    # of clients.  There are two methods:
    # (1) Run multiple OpenVPN daemons, one for each
    #     group, and firewall the TUN/TAP interface
    #     for each group/daemon appropriately.
    # (2) (Advanced) Create a script to dynamically
    #     modify the firewall in response to access
    #     from different clients.  See man
    #     page for more info on learn-address script.
    ;learn-address ./script
    
    # If enabled, this directive will configure
    # all clients to redirect their default
    # network gateway through the VPN, causing
    # all IP traffic such as web browsing and
    # and DNS lookups to go through the VPN
    # (The OpenVPN server machine may need to NAT
    # or bridge the TUN/TAP interface to the internet
    # in order for this to work properly).
    ;push "redirect-gateway def1 bypass-dhcp"
    
    # Certain Windows-specific network settings
    # can be pushed to clients, such as DNS
    # or WINS server addresses.  CAVEAT:
    # http://openvpn.net/faq.html#dhcpcaveats
    # The addresses below refer to the public
    # DNS servers provided by opendns.com.
    push "dhcp-option DNS 208.67.222.222"
    push "dhcp-option DNS 208.67.220.220"
    
    # Uncomment this directive to allow different
    # clients to be able to "see" each other.
    # By default, clients will only see the server.
    # To force clients to only see the server, you
    # will also need to appropriately firewall the
    # server''s TUN/TAP interface.
    ;client-to-client
    
    # Uncomment this directive if multiple clients
    # might connect with the same certificate/key
    # files or common names.  This is recommended
    # only for testing purposes.  For production use,
    # each client should have its own certificate/key
    # pair.
    #
    # IF YOU HAVE NOT GENERATED INDIVIDUAL
    # CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
    # EACH HAVING ITS OWN UNIQUE "COMMON NAME",
    # UNCOMMENT THIS LINE OUT.
    ;duplicate-cn
    
    # The keepalive directive causes ping-like
    # messages to be sent back and forth over
    # the link so that each side knows when
    # the other side has gone down.
    # Ping every 10 seconds, assume that remote
    # peer is down if no ping received during
    # a 120 second time period.
    keepalive 10 120
    
    # For extra security beyond that provided
    # by SSL/TLS, create an "HMAC firewall"
    # to help block DoS attacks and UDP port flooding.
    #
    # Generate with:
    #   openvpn --genkey --secret ta.key
    #
    # The server and each client must have
    # a copy of this key.
    # The second parameter should be ''0''
    # on the server and ''1'' on the clients.
    ;tls-auth ta.key 0 # This file is secret
    
    # Select a cryptographic cipher.
    # This config item must be copied to
    # the client config file as well.
    # Note that v2.4 client/server will automatically
    # negotiate AES-256-GCM in TLS mode.
    # See also the ncp-cipher option in the manpage
    cipher AES-256-CBC
    
    # Enable compression on the VPN link and push the
    # option to the client (v2.4+ only, for earlier
    # versions see below)
    ;compress lz4-v2
    ;push "compress lz4-v2"
    
    # For compression compatible with older clients use comp-lzo
    # If you enable it here, you must also
    # enable it in the client config file.
    ;comp-lzo
    
    # The maximum number of concurrently connected
    # clients we want to allow.
    ;max-clients 100
    
    # It''s a good idea to reduce the OpenVPN
    # daemon''s privileges after initialization.
    #
    # You can uncomment this out on
    # non-Windows systems.
    user nobody
    group nobody
    
    # The persist options will try to avoid
    # accessing certain resources on restart
    # that may no longer be accessible because
    # of the privilege downgrade.
    persist-key
    persist-tun
    
    # Output a short status file showing
    # current connections, truncated
    # and rewritten every minute.
    status openvpn-status.log
    
    # By default, log messages will go to the syslog (or
    # on Windows, if running as a service, they will go to
    # the "Program FilesOpenVPNlog" directory).
    # Use log or log-append to override this default.
    # "log" will truncate the log file on OpenVPN startup,
    # while "log-append" will append to it.  Use one
    # or the other (but not both).
    ;log         openvpn.log
    log-append  openvpn.log
    
    # Set the appropriate level of log
    # file verbosity.
    #
    # 0 is silent, except for fatal errors
    # 4 is reasonable for general usage
    # 5 and 6 can help to debug connection problems
    # 9 is extremely verbose
    verb 3
    
    # Silence repeating messages.  At most 20
    # sequential messages of the same message
    # category will be output to the log.
    ;mute 20
    
    # Notify the client that when the server restarts so it
    # can automatically reconnect.
    ;explicit-exit-notify 1


    Plik klienta:
    client
    port 1107
    remote 77.55.235.93
    cipher AES-256-CBC
    dev tun
    proto udp
    nobind
    auth-nocache
    persist-key
    persist-tun
    verb 2
    key-direction 1
    remote-cert-tls server
    


    Reguły Iptables
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination
    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:1107
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:1107
    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
    ACCEPT     icmp --  anywhere             anywhere
    ACCEPT     all  --  anywhere             anywhere
    ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh
    REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:1107 state NEW
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:1107 state NEW
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination
    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
    ACCEPT     all  --  anywhere             anywhere
    REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited
    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
    ACCEPT     all  --  dedicated-ajb0.rev.nazwa.pl/24  anywhere
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    ACCEPT     all  --  anywhere             anywhere
    ACCEPT     udp  --  anywhere             dedicated-ajb93.rev.nazwa.pl  udp dpt:11107
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:1107 state NEW
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:1107 state NEW
    


    Logi połączenia klienta z serwerem
    Spoiler:

    Thu Aug 15 18:15:18 2019 OpenVPN 2.4.7 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Feb 21 2019
    Thu Aug 15 18:15:18 2019 Windows version 6.2 (Windows 8 or greater) 64bit
    Thu Aug 15 18:15:18 2019 library versions: OpenSSL 1.1.0j  20 Nov 2018, LZO 2.10
    Enter Management Password:
    Thu Aug 15 18:15:19 2019 TCP/UDP: Preserving recently used remote address: [AF_INET]77.55.235.93:1107
    Thu Aug 15 18:15:19 2019 UDP link local: (not bound)
    Thu Aug 15 18:15:19 2019 UDP link remote: [AF_INET]77.55.235.93:1107
    Thu Aug 15 18:15:19 2019 VERIFY OK: depth=1, C=US, ST=CA, L=SanFrancisco, O=Fort-Funston, OU=changeme, CN=changeme, name=server, emailAddress=mail@host.domain
    Thu Aug 15 18:15:19 2019 VERIFY KU OK
    Thu Aug 15 18:15:19 2019 Validating certificate extended key usage
    Thu Aug 15 18:15:19 2019 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
    Thu Aug 15 18:15:19 2019 VERIFY EKU OK
    Thu Aug 15 18:15:19 2019 VERIFY OK: depth=0, C=US, ST=CA, L=SanFrancisco, O=Fort-Funston, OU=changeme, CN=server, name=server, emailAddress=mail@host.domain
    Thu Aug 15 18:15:19 2019 Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
    Thu Aug 15 18:15:19 2019 [server] Peer Connection Initiated with [AF_INET]77.55.235.93:1107
    Thu Aug 15 18:15:20 2019 Data Channel: using negotiated cipher ''AES-256-GCM''
    Thu Aug 15 18:15:20 2019 Outgoing Data Channel: Cipher ''AES-256-GCM'' initialized with 256 bit key
    Thu Aug 15 18:15:20 2019 Incoming Data Channel: Cipher ''AES-256-GCM'' initialized with 256 bit key
    Thu Aug 15 18:15:20 2019 open_tun
    Thu Aug 15 18:15:20 2019 TAP-WIN32 device [Ethernet 2] opened: \.Global{A4B140E0-F162-41E4-87B6-6FE3B6051F15}.tap
    Thu Aug 15 18:15:20 2019 Notified TAP-Windows driver to set a DHCP IP/netmask of 10.8.0.6/255.255.255.252 on interface {A4B140E0-F162-41E4-87B6-6FE3B6051F15} [DHCP-serv: 10.8.0.5, lease-time: 31536000]
    Thu Aug 15 18:15:20 2019 Successful ARP Flush on interface [22] {A4B140E0-F162-41E4-87B6-6FE3B6051F15}
    Thu Aug 15 18:15:25 2019 Initialization Sequence Completed
  • REKLAMA
  • #2 18117266
    WMichał
    Poziom 32  
    Posty: 1629
    Pomógł: 172
    Ocena: 135
    Tomy@ napisał:
    ;push "redirect-gateway def1 bypass-dhcp"

    Musisz mieć odkomentowane jak chcesz wychodzić na świat z ip serwera.
    Pokaż service openvpn status w przypadku debiana chyba że inny system.
    Tomy@ napisał:
    ;log         openvpn.log

    Odkomentuj sprawdź czy w logach nie ma problemów.

    Pokaż: iptables -t nat -L
  • REKLAMA
  • #3 18117460
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    dzięki za zainteresowanie :-)

    Odkomentowałem
    push "redirect-gateway def1 bypass-dhcp"


    service openvpn status
    OpenVPN CLIENT LIST
    Updated,Thu Aug 15 21:35:44 2019
    Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since
    pcdom,94.254.152.129:12713,39998,13898,Thu Aug 15 21:34:10 2019
    ROUTING TABLE
    Virtual Address,Common Name,Real Address,Last Ref
    10.8.0.6,pcdom,94.254.152.129:12713,Thu Aug 15 21:35:42 2019
    GLOBAL STATS
    Max bcast/mcast queue length,0
    END
    


    lub

    Redirecting to /bin/systemctl status openvpn.service
    Unit openvpn.service could not be found.
    [root@server043195 ~]# systemctl status openvpn@server.service
    ÔŚĆ openvpn@server.service - OpenVPN Robust And Highly Flexible Tunneling Applic
    ation On server
       Loaded: loaded (/usr/lib/systemd/system/openvpn@.service; enabled; vendor pre
    set: disabled)
       Active: active (running) since Thu 2019-08-15 21:22:29 CEST; 34min ago
     Main PID: 909 (openvpn)
       Status: "Initialization Sequence Completed"
       CGroup: /system.slice/system-openvpn.slice/openvpn@server.service
               ÔööÔöÇ909 /usr/sbin/openvpn --cd /etc/openvpn/ --config server.conf
    
    Aug 15 21:22:29 server043195.nazwa.pl systemd[1]: Starting OpenVPN Robust And...
    Aug 15 21:22:29 server043195.nazwa.pl systemd[1]: Started OpenVPN Robust And ...
    Hint: Some lines were ellipsized, use -l to show in full.


    openvpn.log
    Spoiler:
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 peer info: IV_VER=2.4.7
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 peer info: IV_PLAT=win
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 peer info: IV_PROTO=2
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 peer info: IV_NCP=2
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 peer info: IV_LZ4=1
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 peer info: IV_LZ4v2=1
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 peer info: IV_LZO=1
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 peer info: IV_COMP_STUB=1
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 peer info: IV_COMP_STUBv2=1
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 peer info: IV_TCPNL=1
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 peer info: IV_GUI_VER=OpenVPN_GUI_
    11
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 Control Channel: TLSv1.2, cipher T
    LSv1/SSLv3 ECDHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
    Thu Aug 15 21:24:18 2019 94.254.152.129:12715 [pcdom] Peer Connection Initiated
    with [AF_INET]94.254.152.129:12715
    Thu Aug 15 21:24:18 2019 pcdom/94.254.152.129:12715 MULTI_sva: pool returned IPv
    4=10.8.0.6, IPv6=(Not enabled)
    Thu Aug 15 21:24:18 2019 pcdom/94.254.152.129:12715 MULTI: Learn: 10.8.0.6 -> pc
    dom/94.254.152.129:12715
    Thu Aug 15 21:24:18 2019 pcdom/94.254.152.129:12715 MULTI: primary virtual IP fo
    r pcdom/94.254.152.129:12715: 10.8.0.6
    Thu Aug 15 21:24:20 2019 pcdom/94.254.152.129:12715 PUSH: Received control messa
    ge: 'PUSH_REQUEST'
    Thu Aug 15 21:24:20 2019 pcdom/94.254.152.129:12715 SENT CONTROL [pcdom]: 'PUSH_
    REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 208.67.222.222,dhcp-opti
    on DNS 208.67.220.220,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifc
    onfig 10.8.0.6 10.8.0.5,peer-id 0,cipher AES-256-GCM' (status=1)
    Thu Aug 15 21:24:20 2019 pcdom/94.254.152.129:12715 Data Channel: using negotiat
    ed cipher 'AES-256-GCM'
    Thu Aug 15 21:24:20 2019 pcdom/94.254.152.129:12715 Outgoing Data Channel: Ciphe
    r 'AES-256-GCM' initialized with 256 bit key
    Thu Aug 15 21:24:20 2019 pcdom/94.254.152.129:12715 Incoming Data Channel: Ciphe
    r 'AES-256-GCM' initialized with 256 bit key
    Thu Aug 15 21:25:58 2019 94.254.152.129:12709 TLS: Initial packet from [AF_INET]
    94.254.152.129:12709, sid=f73f069b 21d18f8e
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 VERIFY OK: depth=1, C=US, ST=CA, L
    =SanFrancisco, O=Fort-Funston, OU=changeme, CN=changeme, name=server, emailAddre
    ss=mail@host.domain
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 VERIFY OK: depth=0, C=US, ST=CA, L
    =SanFrancisco, O=Fort-Funston, OU=changeme, CN=pcdom, name=server, emailAddress=
    mail@host.domain
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 peer info: IV_VER=2.4.7
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 peer info: IV_PLAT=win
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 peer info: IV_PROTO=2
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 peer info: IV_NCP=2
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 peer info: IV_LZ4=1
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 peer info: IV_LZ4v2=1
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 peer info: IV_LZO=1
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 peer info: IV_COMP_STUB=1
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 peer info: IV_COMP_STUBv2=1
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 peer info: IV_TCPNL=1
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 peer info: IV_GUI_VER=OpenVPN_GUI_
    11
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 Control Channel: TLSv1.2, cipher T
    LSv1/SSLv3 ECDHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
    Thu Aug 15 21:26:01 2019 94.254.152.129:12709 [pcdom] Peer Connection Initiated
    with [AF_INET]94.254.152.129:12709
    Thu Aug 15 21:26:01 2019 MULTI: new connection by client 'pcdom' will cause prev
    ious active sessions by this client to be dropped.  Remember to use the --duplic
    ate-cn option if you want multiple clients using the same certificate or usernam
    e to concurrently connect.
    Thu Aug 15 21:26:01 2019 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabl
    ed)
    Thu Aug 15 21:26:01 2019 MULTI: Learn: 10.8.0.6 -> pcdom/94.254.152.129:12709
    Thu Aug 15 21:26:01 2019 MULTI: primary virtual IP for pcdom/94.254.152.129:1270
    9: 10.8.0.6
    Thu Aug 15 21:26:02 2019 pcdom/94.254.152.129:12709 PUSH: Received control messa
    ge: 'PUSH_REQUEST'
    Thu Aug 15 21:26:02 2019 pcdom/94.254.152.129:12709 SENT CONTROL [pcdom]: 'PUSH_
    REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 208.67.222.222,dhcp-opti
    on DNS 208.67.220.220,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifc
    onfig 10.8.0.6 10.8.0.5,peer-id 1,cipher AES-256-GCM' (status=1)
    Thu Aug 15 21:26:02 2019 pcdom/94.254.152.129:12709 Data Channel: using negotiat
    ed cipher 'AES-256-GCM'
    Thu Aug 15 21:26:02 2019 pcdom/94.254.152.129:12709 Outgoing Data Channel: Ciphe
    r 'AES-256-GCM' initialized with 256 bit key
    Thu Aug 15 21:26:02 2019 pcdom/94.254.152.129:12709 Incoming Data Channel: Ciphe
    r 'AES-256-GCM' initialized with 256 bit key
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 TLS: Initial packet from [AF_INET]
    94.254.152.129:12713, sid=fa0f52b0 bc07ed4f
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 VERIFY OK: depth=1, C=US, ST=CA, L
    =SanFrancisco, O=Fort-Funston, OU=changeme, CN=changeme, name=server, emailAddre
    ss=mail@host.domain
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 VERIFY OK: depth=0, C=US, ST=CA, L
    =SanFrancisco, O=Fort-Funston, OU=changeme, CN=pcdom, name=server, emailAddress=
    mail@host.domain
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 peer info: IV_VER=2.4.7
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 peer info: IV_PLAT=win
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 peer info: IV_PROTO=2
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 peer info: IV_NCP=2
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 peer info: IV_LZ4=1
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 peer info: IV_LZ4v2=1
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 peer info: IV_LZO=1
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 peer info: IV_COMP_STUB=1
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 peer info: IV_COMP_STUBv2=1
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 peer info: IV_TCPNL=1
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 peer info: IV_GUI_VER=OpenVPN_GUI_
    11
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 Control Channel: TLSv1.2, cipher T
    LSv1/SSLv3 ECDHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
    Thu Aug 15 21:34:10 2019 94.254.152.129:12713 [pcdom] Peer Connection Initiated
    with [AF_INET]94.254.152.129:12713
    Thu Aug 15 21:34:10 2019 MULTI: new connection by client 'pcdom' will cause prev
    ious active sessions by this client to be dropped.  Remember to use the --duplic
    ate-cn option if you want multiple clients using the same certificate or usernam
    e to concurrently connect.
    Thu Aug 15 21:34:10 2019 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabl
    ed)
    Thu Aug 15 21:34:10 2019 MULTI: Learn: 10.8.0.6 -> pcdom/94.254.152.129:12713
    Thu Aug 15 21:34:10 2019 MULTI: primary virtual IP for pcdom/94.254.152.129:1271
    3: 10.8.0.6
    Thu Aug 15 21:34:11 2019 pcdom/94.254.152.129:12713 PUSH: Received control messa
    ge: 'PUSH_REQUEST'
    Thu Aug 15 21:34:11 2019 pcdom/94.254.152.129:12713 SENT CONTROL [pcdom]: 'PUSH_
    REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 208.67.222.222,dhcp-opti
    on DNS 208.67.220.220,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifc
    onfig 10.8.0.6 10.8.0.5,peer-id 0,cipher AES-256-GCM' (status=1)
    Thu Aug 15 21:34:11 2019 pcdom/94.254.152.129:12713 Data Channel: using negotiat
    ed cipher 'AES-256-GCM'
    Thu Aug 15 21:34:11 2019 pcdom/94.254.152.129:12713 Outgoing Data Channel: Ciphe
    r 'AES-256-GCM' initialized with 256 bit key
    Thu Aug 15 21:34:11 2019 pcdom/94.254.152.129:12713 Incoming Data Channel: Ciphe
    r 'AES-256-GCM' initialized with 256 bit key


    iptables -t nat -L
    Chain PREROUTING (policy ACCEPT)
    target     prot opt source               destination
    
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    
    Chain POSTROUTING (policy ACCEPT)
    target     prot opt source               destination
    MASQUERADE  all  --  10.8.0.0/24          anywhere
    MASQUERADE  all  --  10.8.0.0/24          anywhere
    MASQUERADE  all  --  10.8.0.0/24          anywhere
  • #4 18117483
    WMichał
    Poziom 32  
    Posty: 1629
    Pomógł: 172
    Ocena: 135
    Pokaż log po stronie klienta.
  • #5 18117627
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Logi po stronie klienta
    Thu Aug 15 23:05:10 2019 OpenVPN 2.4.7 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Feb 21 2019
    Thu Aug 15 23:05:10 2019 Windows version 6.2 (Windows 8 or greater) 64bit
    Thu Aug 15 23:05:10 2019 library versions: OpenSSL 1.1.0j  20 Nov 2018, LZO 2.10
    Enter Management Password:
    Thu Aug 15 23:05:11 2019 TCP/UDP: Preserving recently used remote address: [AF_INET]77.55.235.93:11107
    Thu Aug 15 23:05:11 2019 UDP link local: (not bound)
    Thu Aug 15 23:05:11 2019 UDP link remote: [AF_INET]77.55.235.93:11107
    Thu Aug 15 23:05:11 2019 VERIFY OK: depth=1, C=US, ST=CA, L=SanFrancisco, O=Fort-Funston, OU=changeme, CN=changeme, name=server, emailAddress=mail@host.domain
    Thu Aug 15 23:05:11 2019 VERIFY KU OK
    Thu Aug 15 23:05:11 2019 Validating certificate extended key usage
    Thu Aug 15 23:05:11 2019 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
    Thu Aug 15 23:05:11 2019 VERIFY EKU OK
    Thu Aug 15 23:05:11 2019 VERIFY OK: depth=0, C=US, ST=CA, L=SanFrancisco, O=Fort-Funston, OU=changeme, CN=server, name=server, emailAddress=mail@host.domain
    Thu Aug 15 23:05:11 2019 Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
    Thu Aug 15 23:05:11 2019 [server] Peer Connection Initiated with [AF_INET]77.55.235.93:11107
    Thu Aug 15 23:05:12 2019 Data Channel: using negotiated cipher 'AES-256-GCM'
    Thu Aug 15 23:05:12 2019 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
    Thu Aug 15 23:05:12 2019 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
    Thu Aug 15 23:05:12 2019 open_tun
    Thu Aug 15 23:05:12 2019 TAP-WIN32 device [Ethernet 2] opened: \\.\Global\{A4B140E0-F162-41E4-87B6-6FE3B6051F15}.tap
    Thu Aug 15 23:05:12 2019 Notified TAP-Windows driver to set a DHCP IP/netmask of 10.8.0.6/255.255.255.252 on interface {A4B140E0-F162-41E4-87B6-6FE3B6051F15} [DHCP-serv: 10.8.0.5, lease-time: 31536000]
    Thu Aug 15 23:05:12 2019 Successful ARP Flush on interface [22] {A4B140E0-F162-41E4-87B6-6FE3B6051F15}
    Thu Aug 15 23:05:17 2019 Initialization Sequence Completed
  • REKLAMA
  • #6 18119138
    WMichał
    Poziom 32  
    Posty: 1629
    Pomógł: 172
    Ocena: 135
    Wygląda ok.
    I nie działa internet w tej konfiguracji?
  • #7 18119293
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Właśnie nie działa internet, połączenie jest ok.
    Nie wiem co może być przyczyną.
  • #8 18121392
    WMichał
    Poziom 32  
    Posty: 1629
    Pomógł: 172
    Ocena: 135
    Pokaż: ipconfig /all na kliencie
  • #9 18122054
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Proszę Michale
    Windows IP Configuration
    
       Host Name . . . . . . . . . . . . : DESKTOP-TH3G63V
       Primary Dns Suffix  . . . . . . . :
       Node Type . . . . . . . . . . . . : Hybrid
       IP Routing Enabled. . . . . . . . : No
       WINS Proxy Enabled. . . . . . . . : No
       DNS Suffix Search List. . . . . . : homerouter.cpe
    
    Wireless LAN adapter Wi-Fi:
    
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . : homerouter.cpe
       Description . . . . . . . . . . . : Qualcomm Atheros AR9285 Wireless Network Adapter
       Physical Address. . . . . . . . . : E0-B9-A5-5F-A5-8E
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
    
    Wireless LAN adapter Połączenie lokalne* 2:
    
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
       Physical Address. . . . . . . . . : 12-B9-A5-5F-A5-8E
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
    
    Wireless LAN adapter Połączenie lokalne* 12:
    
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2
       Physical Address. . . . . . . . . : 22-B9-A5-5F-A5-8E
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
    
    Ethernet adapter Ethernet:
    
       Connection-specific DNS Suffix  . : homerouter.cpe
       Description . . . . . . . . . . . : JMicron PCI Express Gigabit Ethernet Adapter
       Physical Address. . . . . . . . . : F4-6D-04-B6-11-F8
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::48e8:f970:c32:8292%7(Preferred)
       IPv4 Address. . . . . . . . . . . : 192.168.1.103(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Lease Obtained. . . . . . . . . . : sobota, 17 sierpnia 2019 20:22:22
       Lease Expires . . . . . . . . . . : poniedziałek, 19 sierpnia 2019 17:38:03
       Default Gateway . . . . . . . . . : fe80::be25:e0ff:fef4:52e3%7
                                           192.168.1.10
       DHCP Server . . . . . . . . . . . : 192.168.1.10
       DHCPv6 IAID . . . . . . . . . . . : 66350340
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-22-2B-91-EF-F4-6D-04-B6-11-F8
       DNS Servers . . . . . . . . . . . : fe80::be25:e0ff:fef4:52e3%7
                                           192.168.1.10
                                           192.168.1.10
       NetBIOS over Tcpip. . . . . . . . : Enabled
    
    Ethernet adapter Ethernet 2:
    
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : TAP-Windows Adapter V9
       Physical Address. . . . . . . . . : 00-FF-A4-B1-40-E0
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::c9a1:1c32:2769:6fe1%22(Preferred)
       IPv4 Address. . . . . . . . . . . : 10.8.0.6(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.255.252
       Lease Obtained. . . . . . . . . . : niedziela, 18 sierpnia 2019 17:54:15
       Lease Expires . . . . . . . . . . : poniedziałek, 17 sierpnia 2020 17:54:15
       Default Gateway . . . . . . . . . :
       DHCP Server . . . . . . . . . . . : 10.8.0.5
       DHCPv6 IAID . . . . . . . . . . . : 201392036
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-22-2B-91-EF-F4-6D-04-B6-11-F8
       DNS Servers . . . . . . . . . . . : 208.67.222.222
                                           208.67.220.220
       NetBIOS over Tcpip. . . . . . . . : Enabled
    
  • #10 18122469
    WMichał
    Poziom 32  
    Posty: 1629
    Pomógł: 172
    Ocena: 135
    Połączenie się zestawia.
    Ping 8.8.8.8 działa?
    Sprawdź jeszcze status openvpna i log czy coś nowego się nie pojawiło.
    Pokaż:
    cat /etc/sysctl.conf | grep forward
    ifconfig
  • #11 18122562
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Ping z klienta
    Pinging 8.8.8.8 with 32 bytes of data:
    Reply from 10.8.0.1: Destination host unreachable.
    Reply from 10.8.0.1: Destination host unreachable.
    Request timed out.
    Reply from 10.8.0.1: Destination host unreachable.
    
    Ping statistics for 8.8.8.8:
        Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
    


    grep forward
    [root@server043195 ~]# cat /etc/sysctl.conf | grep forward
    net.ipv4.ip_forward = 1


    ifconfig
    [root@server043195 ~]# ifconfig
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 77.55.xx  netmask 255.255.240.0  broadcast 77.55.xx
            inet6 fe80::f816:3eff:fe24:a026  prefixlen 64  scopeid 0x20<link>
            ether fa:16:3e:24:a0:26  txqueuelen 1000  (Ethernet)
            RX packets 3304  bytes 488209 (476.7 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 2322  bytes 262622 (256.4 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            inet6 ::1  prefixlen 128  scopeid 0x10<host>
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 18  bytes 1728 (1.6 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 18  bytes 1728 (1.6 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
            inet 10.8.0.1  netmask 255.255.255.255  destination 10.8.0.2
            inet6 fe80::8e4b:7517:c389:5de7  prefixlen 64  scopeid 0x20<link>
            unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 100
    (UNSPEC)
            RX packets 938  bytes 49004 (47.8 KiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 214  bytes 17769 (17.3 KiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


    OpenVPN status service
    [root@server043195 ~]# systemctl status openvpn@server.service
    ÔŚĆ openvpn@server.service - OpenVPN Robust And Highly Flexible Tunneling Applic
    ation On server
       Loaded: loaded (/usr/lib/systemd/system/openvpn@.service; enabled; vendor pre
    set: disabled)
       Active: active (running) since Sun 2019-08-18 19:04:53 CEST; 2h 52min ago
     Main PID: 925 (openvpn)
       Status: "Initialization Sequence Completed"
       CGroup: /system.slice/system-openvpn.slice/openvpn@server.service
               ÔööÔöÇ925 /usr/sbin/openvpn --cd /etc/openvpn/ --config server.conf
    
    Aug 18 19:04:53 server043195.nasystemd[1]: Starting OpenVPN Robust And...
    Aug 18 19:04:53 server043195.systemd[1]: Started OpenVPN Robust And ...
    Hint: Some lines were ellipsized, use -l to show in full.


    openvpn.log
    Spoiler:

    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 peer info: IV_PLAT=win
    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 peer info: IV_PROTO=2
    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 peer info: IV_NCP=2
    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 peer info: IV_LZ4=1
    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 peer info: IV_LZ4v2=1
    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 peer info: IV_LZO=1
    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 peer info: IV_COMP_STUB=1
    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 peer info: IV_COMP_STUBv2=1
    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 peer info: IV_TCPNL=1
    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 peer info: IV_GUI_VER=OpenVPN_GUI_
    11
    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 Control Channel: TLSv1.2, cipher T
    LSv1/SSLv3 ECDHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
    Sun Aug 18 19:05:13 2019 94.254.152.129:12706 [pcdom] Peer Connection Initiated
    with [AF_INET]94.254.152.129:12706
    Sun Aug 18 19:05:13 2019 pcdom/94.254.152.129:12706 MULTI_sva: pool returned IPv
    4=10.8.0.6, IPv6=(Not enabled)
    Sun Aug 18 19:05:13 2019 pcdom/94.254.152.129:12706 MULTI: Learn: 10.8.0.6 -> pc
    dom/94.254.152.129:12706
    Sun Aug 18 19:05:13 2019 pcdom/94.254.152.129:12706 MULTI: primary virtual IP fo
    r pcdom/94.254.152.129:12706: 10.8.0.6
    Sun Aug 18 19:05:14 2019 pcdom/94.254.152.129:12706 PUSH: Received control messa
    ge: ''''PUSH_REQUEST''''
    Sun Aug 18 19:05:14 2019 pcdom/94.254.152.129:12706 SENT CONTROL [pcdom]: ''''PUSH_
    REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 208.67.222.222,dhcp-opti
    on DNS 208.67.220.220,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifc
    onfig 10.8.0.6 10.8.0.5,peer-id 0,cipher AES-256-GCM'''' (status=1)
    Sun Aug 18 19:05:14 2019 pcdom/94.254.152.129:12706 Data Channel: using negotiat
    ed cipher ''''AES-256-GCM''''
    Sun Aug 18 19:05:14 2019 pcdom/94.254.152.129:12706 Outgoing Data Channel: Ciphe
    r ''''AES-256-GCM'''' initialized with 256 bit key
    Sun Aug 18 19:05:14 2019 pcdom/94.254.152.129:12706 Incoming Data Channel: Ciphe
    r ''''AES-256-GCM'''' initialized with 256 bit key
    Sun Aug 18 19:10:18 2019 pcdom/94.254.152.129:12706 [pcdom] Inactivity timeout (
    --ping-restart), restarting
    Sun Aug 18 19:10:18 2019 pcdom/94.254.152.129:12706 SIGUSR1[soft,ping-restart] r
    eceived, client-instance restarting
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 TLS: Initial packet from [AF_INET]
    94.254.152.129:12709, sid=f2bda407 4b9da79b
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 VERIFY OK: depth=1, C=US, ST=CA, L
    =SanFrancisco, O=Fort-Funston, OU=changeme, CN=changeme, name=server, emailAddre
    ss=mail@host.domain
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 VERIFY OK: depth=0, C=US, ST=CA, L
    =SanFrancisco, O=Fort-Funston, OU=changeme, CN=pcdom, name=server, emailAddress=
    mail@host.domain
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 peer info: IV_VER=2.4.7
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 peer info: IV_PLAT=win
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 peer info: IV_PROTO=2
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 peer info: IV_NCP=2
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 peer info: IV_LZ4=1
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 peer info: IV_LZ4v2=1
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 peer info: IV_LZO=1
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 peer info: IV_COMP_STUB=1
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 peer info: IV_COMP_STUBv2=1
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 peer info: IV_TCPNL=1
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 peer info: IV_GUI_VER=OpenVPN_GUI_
    11
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 Control Channel: TLSv1.2, cipher T
    LSv1/SSLv3 ECDHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
    Sun Aug 18 21:44:22 2019 94.254.152.129:12709 [pcdom] Peer Connection Initiated
    with [AF_INET]94.254.152.129:12709
    Sun Aug 18 21:44:22 2019 pcdom/94.254.152.129:12709 MULTI_sva: pool returned IPv
    4=10.8.0.6, IPv6=(Not enabled)
    Sun Aug 18 21:44:22 2019 pcdom/94.254.152.129:12709 MULTI: Learn: 10.8.0.6 -> pc
    dom/94.254.152.129:12709
    Sun Aug 18 21:44:22 2019 pcdom/94.254.152.129:12709 MULTI: primary virtual IP fo
    r pcdom/94.254.152.129:12709: 10.8.0.6
    Sun Aug 18 21:44:24 2019 pcdom/94.254.152.129:12709 PUSH: Received control messa
    ge: ''''PUSH_REQUEST''''
    Sun Aug 18 21:44:24 2019 pcdom/94.254.152.129:12709 SENT CONTROL [pcdom]: ''''PUSH_
    REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 208.67.222.222,dhcp-opti
    on DNS 208.67.220.220,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifc
    onfig 10.8.0.6 10.8.0.5,peer-id 0,cipher AES-256-GCM'''' (status=1)
    Sun Aug 18 21:44:24 2019 pcdom/94.254.152.129:12709 Data Channel: using negotiat
    ed cipher ''''AES-256-GCM''''
    Sun Aug 18 21:44:24 2019 pcdom/94.254.152.129:12709 Outgoing Data Channel: Ciphe
    r ''''AES-256-GCM'''' initialized with 256 bit key
    Sun Aug 18 21:44:24 2019 pcdom/94.254.152.129:12709 Incoming Data Channel: Ciphe
    r ''''AES-256-GCM'''' initialized with 256 bit key
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 TLS: Initial packet from [AF_INET]
    94.254.152.129:12708, sid=648430c7 3ee10038
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 VERIFY OK: depth=1, C=US, ST=CA, L
    =SanFrancisco, O=Fort-Funston, OU=changeme, CN=changeme, name=server, emailAddre
    ss=mail@host.domain
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 VERIFY OK: depth=0, C=US, ST=CA, L
    =SanFrancisco, O=Fort-Funston, OU=changeme, CN=pcdom, name=server, emailAddress=
    mail@host.domain
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 peer info: IV_VER=2.4.7
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 peer info: IV_PLAT=win
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 peer info: IV_PROTO=2
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 peer info: IV_NCP=2
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 peer info: IV_LZ4=1
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 peer info: IV_LZ4v2=1
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 peer info: IV_LZO=1
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 peer info: IV_COMP_STUB=1
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 peer info: IV_COMP_STUBv2=1
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 peer info: IV_TCPNL=1
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 peer info: IV_GUI_VER=OpenVPN_GUI_
    11
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 Control Channel: TLSv1.2, cipher T
    LSv1/SSLv3 ECDHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
    Sun Aug 18 21:49:36 2019 94.254.152.129:12708 [pcdom] Peer Connection Initiated
    with [AF_INET]94.254.152.129:12708
    Sun Aug 18 21:49:36 2019 MULTI: new connection by client ''''pcdom'''' will cause prev
    ious active sessions by this client to be dropped.  Remember to use the --duplic
    ate-cn option if you want multiple clients using the same certificate or usernam
    e to concurrently connect.
    Sun Aug 18 21:49:36 2019 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabl
    ed)
    Sun Aug 18 21:49:36 2019 MULTI: Learn: 10.8.0.6 -> pcdom/94.254.152.129:12708
    Sun Aug 18 21:49:36 2019 MULTI: primary virtual IP for pcdom/94.254.152.129:1270
    8: 10.8.0.6
    Sun Aug 18 21:49:37 2019 pcdom/94.254.152.129:12708 PUSH: Received control messa
    ge: ''''PUSH_REQUEST''''
    Sun Aug 18 21:49:37 2019 pcdom/94.254.152.129:12708 SENT CONTROL [pcdom]: ''''PUSH_
    REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS 208.67.222.222,dhcp-opti
    on DNS 208.67.220.220,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifc
    onfig 10.8.0.6 10.8.0.5,peer-id 1,cipher AES-256-GCM'''' (status=1)
    Sun Aug 18 21:49:37 2019 pcdom/94.254.152.129:12708 Data Channel: using negotiat
    ed cipher ''''AES-256-GCM''''
    Sun Aug 18 21:49:37 2019 pcdom/94.254.152.129:12708 Outgoing Data Channel: Ciphe
    r ''''AES-256-GCM'''' initialized with 256 bit key
    Sun Aug 18 21:49:37 2019 pcdom/94.254.152.129:12708 Incoming Data Channel: Ciphe
    r ''''AES-256-GCM'''' initialized with 256 bit key
  • #12 18122585
    WMichał
    Poziom 32  
    Posty: 1629
    Pomógł: 172
    Ocena: 135
    Dopisz do konfiga klienta: resolv-retry infinite
  • #13 18124632
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Mimo dodania tego polecenia nadal internet nie chce działać ;-(
    Najciekawsze jest to, że GG działa.
  • REKLAMA
  • #14 18125423
    WMichał
    Poziom 32  
    Posty: 1629
    Pomógł: 172
    Ocena: 135
    Wykonaj i sprawdź: iptables -P FORWARD ACCEPT
  • #15 18126634
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Wykonałem komende
    iptables -P FORWARD ACCEPT

    Internetu nadal brak

    Reguły IP tables
    Spoiler:
    [root@server043195 ~]# iptables -L
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination
    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTA
    BLISHED
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:11107
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:11107
    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTA
    BLISHED
    ACCEPT     icmp --  anywhere             anywhere
    ACCEPT     all  --  anywhere             anywhere
    ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:
    ssh
    REJECT     all  --  anywhere             anywhere             reject-with icmp-h
    ost-prohibited
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:11107 stat
    e NEW
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:11107 stat
    e NEW
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination
    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTA
    BLISHED
    ACCEPT     all  --  anywhere             anywhere
    REJECT     all  --  anywhere             anywhere             reject-with icmp-h
    ost-prohibited
    ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTA
    BLISHED
    ACCEPT     all  --  dedicated-ajb0.rev.nazwa.pl/24  anywhere
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:11107
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    ACCEPT     all  --  anywhere             anywhere
    ACCEPT     udp  --  anywhere             dedicated-ajb93.rev.nazwa.pl  udp dpt:1
    1107
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:11107 stat
    e NEW
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:11107 stat
    e NEW
  • #16 18126783
    WMichał
    Poziom 32  
    Posty: 1629
    Pomógł: 172
    Ocena: 135
    Zobacz czy masz zainstalowane ufw.
    Jeśli nie zainstaluj.
    W /etc/ufw/before.rules dodaj
    #
    # rules.before
    #
    # Rules that should be run before the ufw command line added rules. Custom
    # rules should be added to one of these chains:
    #   ufw-before-input
    #   ufw-before-output
    #   ufw-before-forward
    #
    
    [b]# START OPENVPN RULES
    # NAT table rules
    *nat
    :POSTROUTING ACCEPT [0:0] 
    # Allow traffic from OpenVPN client to eth0 (change to the interface you discovered!)
    -A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE
    COMMIT
    # END OPENVPN RULES[/b]
    
    # Don't delete these required lines, otherwise there will be errors
    *filter


    Późniejw /etc/default/ufw
    DEFAULT_FORWARD_POLICY="DROP" zmień DROP na ACCEPT

    Wykonaj:
    ufw allow 1194/udp
    ufw allow ufw allow OpenSSH
    ufw disable
    ufw enable
  • #17 18128558
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Niestety powyższa procedura też nie pomaga.
    [root@server043195 ~]# ufw status
    Status: active
    
    To                         Action      From
    --                         ------      ----
    SSH                        ALLOW       Anywhere
    224.0.0.251 mDNS           ALLOW       Anywhere
    1194/udp                   ALLOW       Anywhere
    1107/udp                  ALLOW       Anywhere
    SSH (v6)                   ALLOW       Anywhere (v6)
    ff02::fb mDNS              ALLOW       Anywhere (v6)
    1194/udp (v6)              ALLOW       Anywhere (v6)
    1107/udp (v6)             ALLOW       Anywhere (v6) 


    Problem mam z wykonaniem polecenia
    [root@server043195 ~]# ufw allow OpenSSH
    ERROR: Could not find a profile matching 'OpenSSH'
    [root@server043195 ~]#
  • Pomocny post
    #18 18130139
    WMichał
    Poziom 32  
    Posty: 1629
    Pomógł: 172
    Ocena: 135
    Po statusie widze że SSh działa a to co się nie udało chodziło żeby był dostęp przez ssh.
    Pokaż: cat /dev/net/tun

    Kończą mi się już pomysły.

    Pokaż według jakiego poradnika robiłeś?

    Dodano po 21 [minuty]:

    Przetestuj moje konfiguracje:
    
    client
    dev tun
    proto udp
    remote xxx.xxx.xxx.xxx 1194
    resolv-retry infinite
    nobind
    user nobody
    group nogroup
    persist-key
    persist-tun
    #ca ca.crt
    #cert client.crt
    #key client.key
    remote-cert-tls server
    cipher AES-256-CBC
    auth SHA256
    key-direction 1
    verb 3
    <ca>
    -----BEGIN CERTIFICATE-----
    certyfikat tutaj
    -----END CERTIFICATE-----
    </ca>
    <cert>
    -----BEGIN CERTIFICATE-----
    tutaj
    -----END CERTIFICATE-----
    </cert>
    <key>
    -----BEGIN PRIVATE KEY-----
    tutaj
    -----END PRIVATE KEY-----
    </key>
    <tls-auth>
    #
    # 2048 bit OpenVPN static key
    #
    -----BEGIN OpenVPN Static key V1-----
    tutaj
    -----END OpenVPN Static key V1-----
    </tls-auth>
    


    
    port 1194
    proto udp
    dev tun
    ca ca.crt
    cert server.crt
    key server.key  # This file should be kept secret
    dh dh.pem
    server 10.8.0.0 255.255.255.0
    ifconfig-pool-persist ipp.txt
    push "redirect-gateway def1 bypass-dhcp"
    push "dhcp-option DNS 208.67.222.222"
    push "dhcp-option DNS 208.67.220.220"
    keepalive 10 120
    tls-auth ta.key 0 # This file is secret
    key-direction 0
    cipher AES-256-CBC
    auth SHA256
    user nobody
    group nogroup
    persist-key
    persist-tun
    status openvpn-status.log
    log         openvpn.log
    verb 3
    explicit-exit-notify 1
    
  • #19 18134009
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    [root@server043195 ~]# cat /dev/net/tun
    cat: /dev/net/tun: File descriptor in bad state
    - czyli z tego co czytam jest ok.
    Robiłem według tych poradników
    Poradnik1
    Poradnik2

    Oba poradniki są praktycznie identyczne, z niewielkimi szczegółami. Konfigurowałem VPN-a na serwerach Aruby i wszystko było ok.
    Czy możliwe jest, że to jakaś blokada ze strony usługodawcy ?
  • Pomocny post
    #20 18134028
    WMichał
    Poziom 32  
    Posty: 1629
    Pomógł: 172
    Ocena: 135
    Na arubie działa to bezproblemowo sam mam dwa w dwóch różnych lokalizacjach.
    tun ok.
    Jak dla centosa spróbuj jeszcze z poradnika: https://www.digitalocean.com/community/tutori...p-and-configure-an-openvpn-server-on-centos-7
    Sprawdzałeś moje konfigi?

    To robiłeś tak i działało na arubie a teraz nie działa jak robisz na innym?
  • #21 18134320
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Dokładnie, z tymi poradnikami wszystko działało na Arubie.
    Co do tych Twoich konfigów nic nie zmieniło. Coś jest przyblokowane i nie puszcza neta, jakby jakaś zapora lub nie wiem co...
  • Pomocny post
    #22 18134693
    Makxio
    Poziom 20  
    Posty: 532
    Pomógł: 35
    Ocena: 79
    Tomy,

    Pokaz tablice routingu klienta VPN przed i po zapięciu tunelu (Windows :route print, linux : w zależności od platformy może działać netstat -r)

    Daj również ipconfig/all

    Czy jesteś pewien, ze pula przypisywana przez DHCP dla klientów VPN (pula 10-tek) podlega również pod NAT ?


    M.
  • #23 18134776
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Panowie
    Wyczyściłem wszystkie reguły IPtables poleceniem
    Internet ruszył i wychodzi na świat z pub.IP serwera.
    Wykaz reguł obecnie jest czysty
    [root@server043195 ~]# iptables -L
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination 


    Nie bardzo to rozumiem teraz. Nie ma zezwoleń w iptables czyli wszytkie porty są otwarte ? // netstat wskazuje, że nie.
    Mam jeszcze zainstalowanego firewalla UFW , to co iptables można wyłączyć ? Włączyłem UFW i dodałem reguły które mnie interesują.
    Pomożecie mi to jakoś pozabezpieczać i zrobić porządek.
  • Pomocny post
    #24 18134867
    WMichał
    Poziom 32  
    Posty: 1629
    Pomógł: 172
    Ocena: 135
    A ufw status co pokazuje?
  • #25 18134875
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Status: active
    Logging: on (low)
    Default: deny (incoming), allow (outgoing), allow (rou
    New profiles: skip
    
    To                         Action      From
    --                         ------      ----
    22/tcp (SSH)               ALLOW IN    Anywhere
    224.0.0.251 5353/udp (mDNS) ALLOW IN    Anywhere
    1107/udp                  ALLOW IN    Anywhere
    2222                       ALLOW IN    Anywhere
    22/tcp (SSH (v6))          ALLOW IN    Anywhere (v6)
    ff02::fb 5353/udp (mDNS)   ALLOW IN    Anywhere (v6)
    1194/udp (v6)              ALLOW IN    Anywhere (v6)
    1107/udp (v6)             ALLOW IN    Anywhere (v6)
    2222 (v6)                  ALLOW IN    Anywhere (v6)
  • #26 18138288
    Tomy@
    Poziom 9  
    Posty: 64
    Ocena: 11
    Zmiana firewall z iptables na ufw

Podsumowanie tematu

✨ Użytkownik skonfigurował serwer OpenVPN, jednak napotkał problem z dostępem do internetu z publicznego adresu IP serwera. Połączenie VPN nawiązuje się poprawnie, ale klienci nie mają dostępu do internetu. Użytkownik próbował różnych rozwiązań, w tym edycji pliku konfiguracyjnego serwera, dodania reguł w iptables oraz włączenia przekazywania IP w sysctl.conf. Po wielu próbach, w tym dodaniu reguły do ufw, użytkownik ostatecznie wyczyścił reguły iptables, co pozwoliło na uzyskanie dostępu do internetu. Użytkownik zadał pytanie o możliwość blokady ze strony dostawcy usług internetowych oraz o to, jak zabezpieczyć nową konfigurację.
Wygenerowane przez model językowy.
REKLAMA