Hi everybody
I managed to set-up my VPN an everything is great. The only "problem" is that the client source the packets with the IP address got from the local LAN DHCP (i.e.10.222.x.x) and not from the tunnel ip int 10.8.x.x. Is there any way to tell the client to have just one default route (through the tunnel) and to use tunnel interface as source?
//---SERVER LOG--//
Mon Sep 19 12:54:02 2016 us=271366 MULTI: Learn: 10.222.101.4 -> client1/77.89.191.179:44077
Mon Sep 19 12:54:07 2016 us=198222 MULTI: Learn: 10.222.101.3 -> client1/77.89.191.179:44077
//--Client IP Config--//
enp0s31f6 Link encap:Ethernet HWaddr 28:f1:0e:24:ba:bb
inet addr:10.222.1.28 Bcast:10.222.1.255 Mask:255.255.255.0
inet6 addr: fe80::2af1:eff:fe24:babb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:34514 errors:0 dropped:0 overruns:0 frame:0
TX packets:33880 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26966292 (26.9 MB) TX bytes:7756096 (7.7 MB)
Interrupt:16 Memory:e1200000-e1220000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:1426 errors:0 dropped:0 overruns:0 frame:0
TX packets:1426 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:239275 (239.2 KB) TX bytes:239275 (239.2 KB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.6 P-t-P:10.8.0.5 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:195 errors:0 dropped:0 overruns:0 frame:0
TX packets:388 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:76542 (76.5 KB) TX bytes:58165 (58.1 KB)
wlp1s0 Link encap:Ethernet HWaddr e4:a4:71:42:75:ac
inet addr:172.31.255.206 Bcast:172.31.255.255 Mask:255.255.255.0
inet6 addr: fe80::7083:c07e:8828:2f96/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1934 errors:0 dropped:0 overruns:0 frame:0
TX packets:448 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:305925 (305.9 KB) TX bytes:103580 (103.5 KB)
federico@federico:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.8.0.5 128.0.0.0 UG 0 0 0 tun0
0.0.0.0 10.222.1.1 0.0.0.0 UG 100 0 0 enp0s31f6
0.0.0.0 172.31.255.1 0.0.0.0 UG 600 0 0 wlp1s0
2.25.60.99 10.222.1.1 255.255.255.255 UGH 0 0 0 enp0s31f6
10.8.0.1 10.8.0.5 255.255.255.255 UGH 0 0 0 tun0
10.8.0.5 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
10.222.1.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s31f6
10.222.101.10 10.222.1.1 255.255.255.255 UGH 100 0 0 enp0s31f6
128.0.0.0 10.8.0.5 128.0.0.0 UG 0 0 0 tun0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s31f6
172.16.0.0 10.8.0.5 255.255.255.0 UG 0 0 0 tun0
172.31.0.0 10.8.0.5 255.255.0.0 UG 0 0 0 tun0
172.31.255.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp1s0
//--SERVER CONFIG--//
root@iPig:/etc/openvpn# cat server.conf
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
server 10.8.0.0 255.255.255.240
ifconfig-pool-persist ipp.txt
push "route 172.16.0.0 255.255.255.0"
push "route 172.31.0.0 255.255.0.0"
client-config-dir ccd
route 10.0.0.0 255.0.0.0
route 100.64.0.0 255.192.0.0
route 172.16.0.0 255.240.0.0
route 192.168.0.0 255.255.0.0
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 172.16.0.3"
push "dhcp-option NTP 172.16.0.3"
keepalive 10 120
tls-auth ta.key 0
comp-lzo
max-clients 4
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
log-append openvpn.log
verb 4