Ubuntu Server Guide
Simple Client Configuration
Download 1.23 Mb. Pdf ko'rish
|
ubuntu-server-guide (1)
Simple Client Configuration
There are various different OpenVPN client implementations with and without GUIs. You can read more about clients in a later section on VPN Clients. For now we use commandline/service based OpenVPN client for Ubuntu which is part of the very same package as the server. So you have to install the openvpn package again on the client machine: sudo apt i n s t a l l openvpn This time copy the client.conf sample config file to /etc/openvpn/: sudo cp / u s r / s h a r e / doc / openvpn / examples / sample−c o n f i g − f i l e s / c l i e n t . c o n f / e t c / openvpn / 217 Copy the following client keys and certificate files you created in the section above to e.g. /etc/openvpn/ and edit /etc/openvpn/client.conf to make sure the following lines are pointing to those files. If you have the files in /etc/openvpn/ you can omit the path. ca ca . c r t c e r t m y c l i e n t 1 . c r t key m y c l i e n t 1 . key t l s −auth t a . key 1 And you have to specify the OpenVPN server name or address. Make sure the keyword client is in the config. That’s what enables client mode. c l i e n t remote v p n s e r v e r . example . com 1194 Now start the OpenVPN client with the same templatized mechanism: $ sudo s y s t e m c t l s t a r t o p e n v p n @ c l i e n t You can check status as you did on the server: $ sudo s y s t e m c t l s t a t u s o p e n v p n @ c l i e n t o p e n v p n @ c l i e n t . s e r v i c e − OpenVPN c o n n e c t i o n t o c l i e n t Loaded : l o a d e d ( / l i b / systemd / system /openvpn@ . s e r v i c e ; d i s a b l e d ; vendor p r e s e t : e n a b l e d ) A c t i v e : a c t i v e ( r u n ni n g ) s i n c e Thu 2019−10−24 1 1 : 4 2 : 3 5 UTC; 6 s ago Docs : man : openvpn ( 8 ) h t t p s : / / community . openvpn . n e t / openvpn / w i k i /Openvpn24ManPage h t t p s : / / community . openvpn . n e t / openvpn / w i k i /HOWTO Main PID : 3616 ( openvpn ) S t a t u s : ” I n i t i a l i z a t i o n Sequence Completed ” Tasks : 1 ( l i m i t : 5 3 3 ) Memory : 1 . 3M CGroup : / system . s l i c e / system−openvpn . s l i c e / o p e n v p n @ c l i e n t . s e r v i c e �� 3616 / u s r / s b i n / openvpn −−daemon ovpn−c l i e n t −−s t a t u s / run / openvpn / c l i e n t . s t a t u s 10 −−cd / e t c / openvpn −−s c r i p t −s e c u r i t y 2 −−c o n f i g / e t c / openvpn / c l i e n t . c o n f −−w r i t e p i d / run / openvp Oct 24 1 1 : 4 2 : 3 6 eoan−vpn−c l i e n t ovpn−c l i e n t [ 3 6 1 6 ] : Outgoing Data Channel : Cipher ’AES−256−GCM’ i n i t i a l i z e d with 256 b i t key Oct 24 1 1 : 4 2 : 3 6 eoan−vpn−c l i e n t ovpn−c l i e n t [ 3 6 1 6 ] : Incoming Data Channel : Cipher ’AES−256−GCM’ i n i t i a l i z e d with 256 b i t key Oct 24 1 1 : 4 2 : 3 6 eoan−vpn−c l i e n t ovpn−c l i e n t [ 3 6 1 6 ] : ROUTE_GATEWAY 1 9 2 . 1 6 8 . 1 2 2 . 1 / 2 5 5 . 2 5 5 . 2 5 5 . 0 IFACE=e n s 3 HWADDR= 5 2 : 5 4 : 0 0 : 3 c : 5 a : 8 8 Oct 24 1 1 : 4 2 : 3 6 eoan−vpn−c l i e n t ovpn−c l i e n t [ 3 6 1 6 ] : TUN/TAP d e v i c e tun0 opened Oct 24 1 1 : 4 2 : 3 6 eoan−vpn−c l i e n t ovpn−c l i e n t [ 3 6 1 6 ] : TUN/TAP TX queue l e n g t h s e t t o 100 Oct 24 1 1 : 4 2 : 3 6 eoan−vpn−c l i e n t ovpn−c l i e n t [ 3 6 1 6 ] : / s b i n / i p l i n k s e t dev tun0 up mtu 1500 Oct 24 1 1 : 4 2 : 3 6 eoan−vpn−c l i e n t ovpn−c l i e n t [ 3 6 1 6 ] : / s b i n / i p addr add dev tun0 l o c a l 1 0 . 8 . 0 . 6 p e e r 1 0 . 8 . 0 . 5 Oct 24 1 1 : 4 2 : 3 6 eoan−vpn−c l i e n t ovpn−c l i e n t [ 3 6 1 6 ] : / s b i n / i p r o u t e add 1 0 . 8 . 0 . 1 / 3 2 v i a 1 0 . 8 . 0 . 5 Oct 24 1 1 : 4 2 : 3 6 eoan−vpn−c l i e n t ovpn−c l i e n t [ 3 6 1 6 ] : WARNING: t h i s c o n f i g u r a t i o n may c a c h e passwords i n memory −− u s e t h e auth−nocache o p t i o n t o p r e v e n t t h i s 218 Oct 24 1 1 : 4 2 : 3 6 eoan−vpn−c l i e n t ovpn−c l i e n t [ 3 6 1 6 ] : I n i t i a l i z a t i o n Sequence Completed On the server log an incoming connection looks like the following. You can see client name and source address as well as success/failure messages. ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 TLS : I n i t i a l p a c k e t from [ AF_INET ] 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 , s i d =5e943ab8 40 a b 9 f e d ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 VERIFY OK: depth =1, CN=Easy−RSA CA ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 VERIFY OK: depth =0, CN=m y c l i e n t 1 ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 p e e r i n f o : IV_VER= 2 . 4 . 7 ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 p e e r i n f o : IV_PLAT=l i n u x ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 p e e r i n f o : IV_PROTO=2 ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 p e e r i n f o : IV_NCP=2 ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 p e e r i n f o : IV_LZ4=1 ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 p e e r i n f o : IV_LZ4v2=1 ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 p e e r i n f o : IV_LZO=1 ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 p e e r i n f o : IV_COMP_STUB=1 ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 p e e r i n f o : IV_COMP_STUBv2=1 ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 p e e r i n f o : IV_TCPNL=1 ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 C o n t r o l Channel : TLSv1 . 3 , c i p h e r TLSv1 . 3 TLS_AES_256_GCM_SHA384, 2048 b i t RSA ovpn−myserver [ 4 8 1 8 ] : 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 [ m y c l i e n t 1 ] Peer Connection I n i t i a t e d with [ AF_INET] 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 ovpn−myserver [ 4 8 1 8 ] : m y c l i e n t 1 / 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 MULTI_sva : p o o l r e t u r n e d IPv4 = 1 0 . 8 . 0 . 6 , IPv6=(Not e n a b l e d ) ovpn−myserver [ 4 8 1 8 ] : m y c l i e n t 1 / 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 MULTI: Learn : 1 0 . 8 . 0 . 6 −> m y c l i e n t 1 / 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 ovpn−myserver [ 4 8 1 8 ] : m y c l i e n t 1 / 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 MULTI: primary v i r t u a l IP f o r m y c l i e n t 1 / 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 : 1 0 . 8 . 0 . 6 ovpn−myserver [ 4 8 1 8 ] : m y c l i e n t 1 / 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 PUSH: R e c e i v e d c o n t r o l message : ’PUSH_REQUEST’ ovpn−myserver [ 4 8 1 8 ] : m y c l i e n t 1 / 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 SENT CONTROL [ m y c l i e n t 1 ] : ’PUSH_REPLY, r o u t e 1 0 . 8 . 0 . 1 , t o p o l o g y net30 , p i n g 1 0 , ping−r e s t a r t 1 2 0 , i f c o n f i g 1 0 . 8 . 0 . 6 1 0 . 8 . 0 . 5 , peer−i d 0 , c i p h e r AES−256−GCM’ ( s t a t u s =1) ovpn−myserver [ 4 8 1 8 ] : m y c l i e n t 1 / 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 Data Channel : u s i n g n e g o t i a t e d c i p h e r ’AES−256−GCM’ ovpn−myserver [ 4 8 1 8 ] : m y c l i e n t 1 / 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 Outgoing Data Channel : Cipher ’AES−256−GCM’ i n i t i a l i z e d with 256 b i t key ovpn−myserver [ 4 8 1 8 ] : m y c l i e n t 1 / 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 : 5 5 7 3 8 Incoming Data Channel : Cipher ’AES−256−GCM’ i n i t i a l i z e d with 256 b i t key And you can check on the client if it created a tun0 interface: $ i p addr show dev tun0 4 : tun0 : mtu 1500 q d i s c f q _ c o d e l s t a t e UNKNOWN group d e f a u l t q l e n 100 l i n k / none i n e t 1 0 . 8 . 0 . 6 p e e r 1 0 . 8 . 0 . 5 / 3 2 s c o p e g l o b a l tun0 v a l i d _ l f t f o r e v e r p r e f e r r e d _ l f t f o r e v e r i n e t 6 f e 8 0 : : 5 a94 : ae12 : 8 9 0 1 : 5 a75 /64 s c o p e l i n k s t a b l e −p r i v a c y v a l i d _ l f t f o r e v e r p r e f e r r e d _ l f t f o r e v e r Check if you can ping the OpenVPN server: r o o t @ c l i e n t : / e t c / openvpn# p i n g 1 0 . 8 . 0 . 1 219 PING 1 0 . 8 . 0 . 1 ( 1 0 . 8 . 0 . 1 ) 5 6 ( 8 4 ) b y t e s o f data . 64 b y t e s from 1 0 . 8 . 0 . 1 : icmp_req=1 t t l =64 time =0.920 ms Note The OpenVPN server always uses the first usable IP address in the client network and only that IP is pingable. E.g. if you configured a /24 for the client network mask, the .1 address will be used. The P-t-P address you see in the ip addr output above is usually not answering ping requests. Check out your routes: $ i p r o u t e d e f a u l t v i a 1 9 2 . 1 6 8 . 1 2 2 . 1 dev e n s 3 p r o t o dhcp s r c 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 m e t r i c 100 1 0 . 8 . 0 . 1 v i a 1 0 . 8 . 0 . 5 dev tun0 1 0 . 8 . 0 . 5 dev tun0 p r o t o k e r n e l s c o p e l i n k s r c 1 0 . 8 . 0 . 6 1 9 2 . 1 6 8 . 1 2 2 . 0 / 2 4 dev e n s 3 p r o t o k e r n e l s c o p e l i n k s r c 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 1 9 2 . 1 6 8 . 1 2 2 . 1 dev e n s 3 p r o t o dhcp s c o p e l i n k s r c 1 9 2 . 1 6 8 . 1 2 2 . 1 1 4 m e t r i c 100 Download 1.23 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling