Portál AbcLinuxu, 15. května 2025 02:28
dev tap
ifconfig 10.8.0.1 255.255.255.0
ifconfig-pool 10.8.0.5 10.8.0.100 255.255.255.0
push "route 192.168.1.0 255.255.255.0 10.8.0.1"
atd.
na strane klienta
dev tap
remote 81.27.200.49
pull
route 192.168.1.0 255.255.255.0 10.8.0.1
atd.
pri zmene na tun to jede ok
SERVER:
dev tap
mode server
ifconfig 10.0.0.1 255.255.255.0
ifconfig-pool 10.0.0.5 10.0.0.100 255.255.255.0
push "route 192.168.0.0 255.255.255.0 10.0.0.1"
tls-server
client-to-client
dh dh1024.pem
ca ca.crt
cert server.crt
key server.key
comp-lzo
keepalive 10 120
persist-tun
persist-key
verb 3
Dulezite poznamky : sit za serverem je 192.168.0.0 - proto to nastaveni routovani pro klienty .. client-to-client: je tu zase proto, aby fungoval spoj mezi klienty, jinak funguje POUZE mezi client a server, tzn, jeden klient se na druheho nedostane, ostatni je jasne.
CLIENT:
dev tap
remote 1.2.3.4 # Verejna IP serveru
pull
tls-client
dev tap
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key
comp-lzo
verb 3
No a jeto, temuto klientu bude pridelena IP 10.0.0.5 a dalsimu 10.0.0.6 , atd pak funguje kompletni komunikace mezi 10.0.0.1, 10.0.0.5 a 10.0.0.6 a siti 192.168.0.0,
dlasi klient bude uplne stejny, jen s jinymi certifikaty. Jinak TAP je kvuli bridgi a je opravdu pomalejsi, ale zase se nereri routy, nicmene tato konfigurace je funkcni a s dev tun mi to nefunguje, takto jo.
redirect-gatewayje to co hledas
route add 0.0.0.0 netmask 0.0.0.0 gateway 10.8.0.1jede vse ok
MAs VPN SERVER na PC (WAN: 1.2.3.4 LAN: 192.168.1.0 VPN: 10.0.0.1) - do nej se pripojuji klienti:
1. klient: IP (6.7.8.9) - na druhem konci republiky - 10.0.0.2
Tak takhle to mam nastavene a tohle chci. Ale jeste chci aby klient s IP (6.7.8.9) vystupoval na internetu s IP serveru(1.2.3.4). Jinak kdyz pingnu z klienta (10.0.0.2) ping 10.0.0.1 tak je spojeni ok. Spatne jsem se asi vyjadril. Snad uz je to jasne
# 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
# the TUN/TAP interface to the internet in
# order for this to work properly).
# CAVEAT: May break client's network config if
# client's local DHCP server packets get routed
# through the tunnel. Solution: make sure
# client's local DHCP server is reachable via
# a more specific route than the default route
# of 0.0.0.0/0.0.0.0.
;push "redirect-gateway"
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.