А клиентами могут выступать шлюзы сетей а не компы в этих сетях.
Да, могут и шлюзы.
И отдельные компы тоже могут.
Можно все же ссылки на рабочие конфиги этой схемы, а то что инфы в гугле много и какой из их будет рабочий фиг знает
Покажу на примере сети своей конторы...
Узлы:
1) srv8.example.org — 10.10.28.254 — основной шлюз в центральном офисе, тут VPN-сервер
2) srv10.example.org — 10.11.28.254 — основной шлюз в удалённом филиале, на нём VPN-клиент
Сети:
1) 10.1.28.0/24, 10.10.28.0/24 — сети центрального офиса, роутинг между ними выполняет основной шлюз.
2) 10.11.28.0/24 — сеть удалённого филиала
3) 10.8.28.0/24 — VPN-сеть
Конфиг сервера:
[root@srv8 ~]# cat /etc/openvpn/server.example.org.conf
# Adapter name
dev tun0
# Port and protocol the service uses
port 1194
proto udp
# Service mode
tls-server
mode server
# SSL/TLS parameters
ca "/etc/openvpn/ca.example.org.crt"
cert "/etc/openvpn/vpn.example.org.crt"
key "/etc/openvpn/vpn.example.org.pem"
# CRL verification
crl-verify "/etc/openvpn/crl.example.org.pem"
# Diffie-Hellman parameters
dh "/etc/openvpn/vpn-dh.example.org.pem"
# Allow clients use duplicate certificates simultaneously
duplicate-cn
# The virtual endpoints
ifconfig 10.8.28.254 10.8.28.253
# Add routes
route 10.8.28.0 255.255.255.0
route 10.11.28.0 255.255.255.0
# Pool of subnets to be allocated to clients
ifconfig-pool 10.8.28.1 10.8.28.250
# Push routes to the client
push "route 10.1.28.0 255.255.255.0"
push "route 10.8.28.0 255.255.255.0"
push "route 10.10.28.0 255.255.255.0"
push "route 10.11.28.0 255.255.255.0"
# Push dhcp-options to the client
push "dhcp-option DOMAIN example.org"
push "dhcp-option DNS 10.10.28.254"
push "dhcp-option WINS 10.10.28.254"
# Client configuration directory
client-config-dir "/etc/openvpn/ccd"
# Downgrade privileges
user openvpn
group openvpn
# Additional HMAC signature for packets integrity verification
tls-auth "/etc/openvpn/vpn-ta.example.org.pem" 0
# Set HMAC message digest algorithm
auth SHA1
# Select a cryptographic cipher
cipher AES-256-CBC
# Enable compression
comp-lzo
# Try to preserve some state across restarts
persist-key
persist-tun
# Keepalive
keepalive 10 60
# Set log level
verb 3
Клиентский конфиг на сервере:
[root@srv8 ~]# cat /etc/openvpn/ccd/srv10.example.org
# Allow VPN access to client's private subnet
iroute 10.11.28.0 255.255.255.0
Имя файла конфигурации совпадает с CN из сертификата клиента.
Конфиг клиента:
[root@srv10 ~]# cat /etc/openvpn/client.example.org.conf
# Adapter name
dev tun0
# Port and protocol the service uses
port 1194
proto udp
# Do not bind specific local port number
nobind
# Service mode
tls-client
# Server hostname
remote example.org
# SSL/TLS parameters
ca "/etc/openvpn/ca.example.org.crt"
cert "/etc/openvpn/srv10.example.org.crt"
key "/etc/openvpn/srv10.example.org.pem"
# Accept options pushed by the server
pull
# Specify a metric for pulled routes
route-metric 1000
# Downgrade privileges
user openvpn
group openvpn
# Additional HMAC signature for packets integrity verification
tls-auth "/etc/openvpn/vpn-ta.example.org.pem" 1
# Set HMAC message digest algorithm
auth SHA1
# Select a cryptographic cipher
cipher AES-256-CBC
# Server certificate verification to prevent MITM attack
ns-cert-type server
# Enable compression
comp-lzo
# Try to preserve some state across restarts
persist-key
persist-tun
# Keep trying indefinitely to resolve the server hostname
resolv-retry infinite
# Keepalive
keepalive 10 60
# Set log level
verb 3