M
M
Max Payne2017-12-16 17:31:53
linux
Max Payne, 2017-12-16 17:31:53

Redirecting all OpenVPN requests?

An OpenVPN server has been raised on the VPS (configured for UDP), there is a connection to it on the local server, how to organize a complete transfer of all data coming to the VPS to the local server and return responses? Including HTTP/HTTPS/FTP/SSH and so on.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Max Payne, 2017-12-29
@YardalGedal

I found a solution for myself: I did
all the manipulations on the VPS
1. First, I cleared iptables so that outdated rules would not affect future work in any way
2. Then I installed nginx
3. And in its config I set the settings to use it as a proxy server with redirection to the local server without static ip

user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
        worker_connections 768;
        multi_accept on;
}
http {
        sendfile on;
        keepalive_timeout 15;
        proxy_buffers 8 64k;
        proxy_intercept_errors on;
        proxy_connect_timeout 1s;
        proxy_read_timeout 3s;
        proxy_send_timeout 3s;
        server {
            listen 80;
            server_name a.ru b.ru;
            access_log /var/log/nginx/1.access_log;
            error_log /var/log/nginx/1.error_log warn;
            charset utf-8;
            ssi on;
            ssi_value_length 1024;
            location / {
                proxy_pass http://10.8.0.6:9000;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_intercept_errors off;
                proxy_read_timeout 5s;
                proxy_send_timeout 3s;
                gzip on;
                gzip_min_length 1024;
                gzip_proxied expired no-cache no-store private auth;
                gzip_types text/plain application/xml;
            }
        }
}

A
Alexander Lipatov, 2017-12-16
@quality

Use iptables on both sides if you need routing, if you need Internet via OpenVPN, then add the line push "redirect-gateway def1" in the OpenVPN server config and clients will go to the Internet through your purchased vps. And OpenVPN should work in tun mode.
And please, put the question more precisely and for what tasks the OpenVPN server was raised on the VPS ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question