nike
I have installed openvpn server in centos 7 and configured it properly but can't find any ip routing in the vpn server and also can't connect or ping server from LAN client which is same subnet ....please help me
Network :192.168.0.0
My server IP: 192.168.0.222
Openvpn server IP:10.8.0.1
Client IP: 192.168.0.56
--
server configuration setting
port 1194
# TCP or UDP server?
;proto tcp
proto udp
;dev tap
dev tun
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
# openssl dhparam -out dh2048.pem 2048
dh dh2048.pem
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 192.168.0.0 255.255.255.0"
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
client-to-client
keepalive 10 120
tls-crypt myvpn.tlsauth
cipher AES-256-CBC
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
verb 3
# Notify the client that when the server restarts so it
# can automatically reconnect.
explicit-exit-notify 1
----------------------------------------
/etc/sysctl.conf
net.ipv4.ip_forward = 1
----------------------------------------
firewall configuration and routing
firewall-cmd --get-active-zones
firewall-cmd --zone=trusted --add-service openvpn
firewall-cmd --zone=trusted --add-service openvpn --permanent
firewall-cmd --list-services --zone=trusted
firewall-cmd --add-masquerade
firewall-cmd --permanent --add-masquerade
firewall-cmd --query-masquerade
SHARK=$(ip route get 8.8.8.8 | awk 'NR==1 {print $(NF-2)}')
firewall-cmd --permanent --direct --passthrough ipv4 -t nat -A POSTROUTING -s 10.8.0.0/24 -o $SHARK -j MASQUERADE
------------------------------
[root@server openvpn]# ping -I 10.8.0.1 192.168.0.56
PING 192.168.0.56 (192.168.0.56) from 10.8.0.1 : 56(84) bytes of data.
64 bytes from 192.168.0.56: icmp_seq=1 ttl=128 time=1.23 ms
64 bytes from 192.168.0.56: icmp_seq=2 ttl=128 time=0.419 ms
64 bytes from 192.168.0.56: icmp_seq=3 ttl=128 time=0.466 ms
^C
-------
root@server Admin]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 enp4s8
10.8.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 enp4s8
----------------------------
tcpdump -i tun0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on tun0, link-type RAW (Raw IP), capture size 65535 bytes
"NO OUTPUT HERE
--------
root@server Admin]# ifconfig -a
enp4s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.222 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::a881:c86:3359:ef24 prefixlen 64 scopeid 0x20<link>
ether 00:19:d1:23:bd:26 txqueuelen 1000 (Ethernet)
RX packets 8650 bytes 4847467 (4.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4059 bytes 547766 (534.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 4 bytes 216 (216.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 216 (216.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.8.0.1 netmask 255.255.255.0 destination 10.8.0.1
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0