Good afternoon, this is the topology I need to put into operation and I'm having difficulties:
I made this topology with TAP interface, but now I need to provide access to this network through smartphones, so I'm changing it to the TUN interface.
Here are the server and client configuration files:
Server:
dev tun0
ifconfig 192.168.200.1 255.255.255.0
ifconfig-pool 192.168.200.200 192.168.200.254 255.255.255.0
push "route-gateway 192.168.200.1"
#Old config:
#dev tap0
#server-bridge 192.168.200.1 255.255.255.0 192.168.200.200 192.168.200.254
#routes
push "route 10.100.1.0 255.255.255.0 192.168.200.11"
push "route 10.100.2.0 255.255.255.0 192.168.200.12"
#push many others ....
topology subnet
mode server
client-to-client
tls-server
proto udp
port 1194
client-config-dir /etc/openvpn/per/config
dh /etc/openvpn/per/keys/dh2048.pem
ca /etc/openvpn/per/keys/ca.crt
cert /etc/openvpn/per/keys/per_server.crt
key /etc/openvpn/per/keys/per_server.key
log /etc/openvpn/per/logs/per.log
status /etc/openvpn/per/logs/per-status.log
keepalive 10 60
tun-mtu 1500
fragment 1300
mssfix
mute 3
compress lzo
client-config-dir files content:
ifconfig-push 192.168.200.11 255.255.255.0
Router VPN1:
proto udp
topology subnet
client
remote server123.com 1194
dev tun0
nobind
compress lzo
tun-mtu 1500
fragment 1300
mssfix
route-nopull
mute 3
resolv-retry infinite
connect-retry 15 60
ca /scripts/keys/ca.crt
cert /scripts/keys/teste.crt
key /scripts/keys/teste.key
askpass pass.txt
log openvpn.log
Result of the route command on the Client VPN:
Tabela de Roteamento IP do Kernel
Destino Roteador MáscaraGen. Opções Métrica Ref Uso Iface
default _gateway 0.0.0.0 UG 50 0 0 tun1
default per.localdomain 0.0.0.0 UG 600 0 0 wlp7s0
10.100.1.0 192.168.200.11 255.255.255.0 UG 50 0 0 tun1
link-local 0.0.0.0 255.255.0.0 U 1000 0 0 wlp7s0
cpro43149.publi per.localdomain 255.255.255.255 UGH 600 0 0 wlp7s0
192.168.0.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp7s0
per.localdomain 0.0.0.0 255.255.255.255 UH 600 0 0 wlp7s0
192.168.200.0 0.0.0.0 255.255.255.0 U 50 0 0 tun1
Ifconfig on Client VPN:
tun1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 192.168.200.200 netmask 255.255.255.0 destination 192.168.200.200
inet6 fe80::f93e:ee3f:85a:7471 prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (Não Especificado)
RX packets 6 bytes 504 (504.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 319 bytes 25314 (25.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ifconfig on Router VPN1:
eth1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.100.1.1 netmask 255.255.255.0 broadcast 10.100.1.255
inet6 fe80::2e0:4cff:fe68:5e prefixlen 64 scopeid 0x20<link>
ether 00:e0:4c:68:00:5e txqueuelen 1000 (Ethernet)
RX packets 3639 bytes 255105 (249.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 723 bytes 102554 (100.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 192.168.200.11 netmask 255.255.255.0 destination 192.168.200.11
inet6 fe80::f3bf:2fea:7231:73f6 prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 1443 bytes 98929 (96.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1296 bytes 85623 (83.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
In the server:
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 192.168.200.1 netmask 255.255.255.0 destination 192.168.200.1
inet6 fe80::5aa4:80b0:2ea3:b889 prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 323 bytes 41133 (40.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 297 bytes 17892 (17.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Ping tests between server and clients:
Server to router VPN1:
root@server123:~# ping 192.168.200.11
PING 192.168.200.11 (192.168.200.11) 56(84) bytes of data.
64 bytes from 192.168.200.11: icmp_seq=1 ttl=64 time=21.7 ms
64 bytes from 192.168.200.11: icmp_seq=2 ttl=64 time=20.9 ms
Server to client:
root@server123:~# ping 192.168.200.200
PING 192.168.200.200 (192.168.200.200) 56(84) bytes of data.
64 bytes from 192.168.200.200: icmp_seq=1 ttl=64 time=21.7 ms
64 bytes from 192.168.200.200: icmp_seq=2 ttl=64 time=37.8 ms
64 bytes from 192.168.200.200: icmp_seq=3 ttl=64 time=70.9 ms
Between Router VPN1 and server:
root@router_vpn1:/home/administrador# ping 192.168.200.1
PING 192.168.200.1 (192.168.200.1) 56(84) bytes of data.
64 bytes from 192.168.200.1: icmp_seq=1 ttl=64 time=20.9 ms
64 bytes from 192.168.200.1: icmp_seq=2 ttl=64 time=21.6 ms
From client to client:
jonatas@vpn_client:~$ ping 192.168.200.11
PING 192.168.200.11 (192.168.200.11) 56(84) bytes of data.
64 bytes from 192.168.200.11: icmp_seq=1 ttl=64 time=42.1 ms
64 bytes from 192.168.200.11: icmp_seq=2 ttl=64 time=42.7 ms
But i cannot ping from vpn_client to router_vpn lan interface, and routing is enabled on router.
I added a route on server to make a test without sucess:
route add -net 10.100.1.0 netmask 255.255.255.0 gw 192.168.200.11
I still can not reach the 10.100.1.0 network
I'll be waiting for a light.