Hi
I am not able to access internet after getting connected my VPN through openvpn . Its connects successfully , gets a tun interface IP as per config file
I have 2 IP
take them as
server ip1
and
server ip2
Open vpn is configured to run on server ip2
The server config is
netstat -nr
without vpn connected
with vpn connected
ifconfig
without vpn connected
with vpn conneected
route -n
wihtout vpn connected
root@kuduku:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.8.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 venet0
iptables -t nat -L -n -v
without vpn connected
with vpn connected
iptables-save
without vpn connected
with vpn connected
/etc/resolv.conf
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 4.2.2.2
with vpn connected
I have reached this far with setting up Debian server with openvpn with help of @varkey who has helped me innumerable times . A big thanks to him . @varkey please sort out this issue also .
@dinjo
Guys please help and it would be greatly appreciated .
I am not able to access internet after getting connected my VPN through openvpn . Its connects successfully , gets a tun interface IP as per config file
I have 2 IP
take them as
server ip1
and
server ip2
Open vpn is configured to run on server ip2
The server config is
Code:
dev tun
proto tcp
port 1194
ca /etc/openvpn/easy-rsa/2.0/keys/ca.crt
cert /etc/openvpn/easy-rsa/2.0/keys/server.crt
key /etc/openvpn/easy-rsa/2.0/keys/server.key
dh /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
user nobody
group nogroup
server 10.8.0.0 255.255.255.0
persist-key
persist-tun
#status openvpn-status.log
#verb 3
client-to-client
push "redirect-gateway def1"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 4.2.2.4"
comp-lzo
netstat -nr
without vpn connected
Code:
root@kuduku:~# netstat .nr
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 host.colocrossing:51413 c-69-251-124-201.:54874 TIME_WAIT
tcp 0 0 host.colocrossing:51413 188-27-85-32.rdsn:60372 ESTABLISHED
tcp 0 0 host.colocrossing:51413 dsl-hkibrasgw5-58c:1821 TIME_WAIT
tcp 0 0 host.colocrossing:51413 bzq-84-111-154-24:42865 TIME_WAIT
tcp 0 0 host.colocrossing.c:ssh static.212.203:ms-sql-s ESTABLISHED
tcp 0 0 host.colocrossing:51413 S010600248c510c8a:51925 TIME_WAIT
tcp 0 0 host.colocrossing:51413 c-0963e455.014-2-:61892 TIME_WAIT
tcp 1 0 host.colocrossing:60985 91.194.235.182:www CLOSE_WAIT
tcp 0 0 host.colocrossing.c:ssh static.212.203.4.4:1425 ESTABLISHED
tcp 0 0 host.colocrossing:51413 hosted-by.leasewe:44766 TIME_WAIT
tcp 0 0 host.colocrossing:51413 84.126.219.251.dy:46527 TIME_WAIT
tcp 0 0 host.colocrossing:51413 pool-108-15-26-18:51518 TIME_WAIT
udp 0 0 host.colocrossing:16310 ns6.verizon.net:domain ESTABLISHED
udp 0 0 host.colocrossing:41818 f.gtld-servers.n:domain ESTABLISHED
udp 0 0 host.colocrossing:18049 h.gtld-servers.n:domain ESTABLISHED
udp 0 0 host.colocrossing:17304 ns3.verizon.net:domain ESTABLISHED
udp 0 0 host.colocrossing:20774 j.gtld-servers.n:domain ESTABLISHED
udp6 0 0 localhost.localdo:64377 c2.nstld.com:domain ESTABLISHED
udp6 0 0 localhost.localdo:64377 c2.nstld.com:domain ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 204940735 /var/spool/postfix/dev/log
unix 14 [ ] DGRAM 204940733 /dev/log
unix 2 [ ] DGRAM 205030806
unix 2 [ ] DGRAM 205007377
unix 2 [ ] DGRAM 204941791
unix 2 [ ] DGRAM 204941728
unix 3 [ ] STREAM CONNECTED 204941716 /var/run/dovecot/login/default
unix 3 [ ] STREAM CONNECTED 204941715
unix 3 [ ] STREAM CONNECTED 204941713 /var/run/dovecot/login/default
unix 3 [ ] STREAM CONNECTED 204941712
unix 3 [ ] STREAM CONNECTED 204941710 /var/run/dovecot/login/default
unix 3 [ ] STREAM CONNECTED 204941709
unix 3 [ ] STREAM CONNECTED 204941708 /var/run/dovecot/login/default
unix 3 [ ] STREAM CONNECTED 204941706
unix 3 [ ] STREAM CONNECTED 204941707 /var/run/dovecot/login/default
unix 3 [ ] STREAM CONNECTED 204941705
unix 3 [ ] STREAM CONNECTED 204941701 /var/run/dovecot/login/default
unix 3 [ ] STREAM CONNECTED 204941700
unix 3 [ ] STREAM CONNECTED 204941694
unix 3 [ ] STREAM CONNECTED 204941693
unix 3 [ ] STREAM CONNECTED 204941691
unix 3 [ ] STREAM CONNECTED 204941690
unix 3 [ ] STREAM CONNECTED 204941688
unix 3 [ ] STREAM CONNECTED 204941687
unix 3 [ ] STREAM CONNECTED 204941685
unix 3 [ ] STREAM CONNECTED 204941684
unix 3 [ ] STREAM CONNECTED 204941682
unix 3 [ ] STREAM CONNECTED 204941681
unix 3 [ ] STREAM CONNECTED 204941679
unix 3 [ ] STREAM CONNECTED 204941678
unix 2 [ ] DGRAM 204941652
unix 2 [ ] DGRAM 204941646
unix 3 [ ] STREAM CONNECTED 204941643
unix 3 [ ] STREAM CONNECTED 204941642
unix 3 [ ] STREAM CONNECTED 204941638
unix 3 [ ] STREAM CONNECTED 204941637
unix 3 [ ] STREAM CONNECTED 204941634
unix 3 [ ] STREAM CONNECTED 204941633
unix 3 [ ] STREAM CONNECTED 204941630
unix 3 [ ] STREAM CONNECTED 204941629
unix 3 [ ] STREAM CONNECTED 204941626
unix 3 [ ] STREAM CONNECTED 204941625
unix 3 [ ] STREAM CONNECTED 204941622
unix 3 [ ] STREAM CONNECTED 204941621
unix 3 [ ] STREAM CONNECTED 204941618
unix 3 [ ] STREAM CONNECTED 204941617
unix 3 [ ] STREAM CONNECTED 204941614
unix 3 [ ] STREAM CONNECTED 204941613
unix 3 [ ] STREAM CONNECTED 204941610
unix 3 [ ] STREAM CONNECTED 204941609
unix 3 [ ] STREAM CONNECTED 204941606
unix 3 [ ] STREAM CONNECTED 204941605
unix 3 [ ] STREAM CONNECTED 204941602
unix 3 [ ] STREAM CONNECTED 204941601
unix 3 [ ] STREAM CONNECTED 204941598
unix 3 [ ] STREAM CONNECTED 204941597
unix 3 [ ] STREAM CONNECTED 204941594
unix 3 [ ] STREAM CONNECTED 204941593
unix 3 [ ] STREAM CONNECTED 204941590
unix 3 [ ] STREAM CONNECTED 204941589
unix 3 [ ] STREAM CONNECTED 204941586
unix 3 [ ] STREAM CONNECTED 204941585
unix 3 [ ] STREAM CONNECTED 204941582
unix 3 [ ] STREAM CONNECTED 204941581
unix 3 [ ] STREAM CONNECTED 204941578
unix 3 [ ] STREAM CONNECTED 204941577
unix 3 [ ] STREAM CONNECTED 204941574
unix 3 [ ] STREAM CONNECTED 204941573
unix 3 [ ] STREAM CONNECTED 204941570
unix 3 [ ] STREAM CONNECTED 204941569
unix 3 [ ] STREAM CONNECTED 204941566
unix 3 [ ] STREAM CONNECTED 204941565
unix 3 [ ] STREAM CONNECTED 204941562
unix 3 [ ] STREAM CONNECTED 204941561
unix 3 [ ] STREAM CONNECTED 204941558
unix 3 [ ] STREAM CONNECTED 204941557
unix 3 [ ] STREAM CONNECTED 204941554
unix 3 [ ] STREAM CONNECTED 204941553
unix 3 [ ] STREAM CONNECTED 204941550
unix 3 [ ] STREAM CONNECTED 204941549
unix 3 [ ] STREAM CONNECTED 204941546
unix 3 [ ] STREAM CONNECTED 204941545
unix 3 [ ] STREAM CONNECTED 204941542
unix 3 [ ] STREAM CONNECTED 204941541
unix 3 [ ] STREAM CONNECTED 204941538
unix 3 [ ] STREAM CONNECTED 204941537
unix 3 [ ] STREAM CONNECTED 204941534
unix 3 [ ] STREAM CONNECTED 204941533
unix 3 [ ] STREAM CONNECTED 204941531
unix 3 [ ] STREAM CONNECTED 204941530
unix 3 [ ] STREAM CONNECTED 204941527
unix 3 [ ] STREAM CONNECTED 204941526
unix 3 [ ] STREAM CONNECTED 204941524
unix 3 [ ] STREAM CONNECTED 204941523
unix 2 [ ] DGRAM 204941511
unix 2 [ ] DGRAM 204941504
unix 2 [ ] DGRAM 204941075
unix 2 [ ] DGRAM 204941037
unix 3 [ ] STREAM CONNECTED 204941028 /var/run/dovecot/auth-worker.545
unix 3 [ ] STREAM CONNECTED 204941027
unix 3 [ ] STREAM CONNECTED 204941018
unix 3 [ ] STREAM CONNECTED 204941017
unix 2 [ ] DGRAM 204940975
unix 3 [ ] STREAM CONNECTED 204940839
unix 3 [ ] STREAM CONNECTED 204940838
unix 3 [ ] STREAM CONNECTED 204940817
unix 3 [ ] STREAM CONNECTED 204940816
unix 2 [ ] DGRAM 204940775
with vpn connected
Code:
root@kuduku:~# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.8.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 venet0
ifconfig
without vpn connected
Code:
root@kuduku:~# ifconfig
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:16436 Metric:1
RX packets:127 errors:0 dropped:0 overruns:0 frame:0
TX packets:127 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15711 (15.3 KiB) TX bytes:15711 (15.3 KiB)
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.1 P-t-P:10.8.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:5625 errors:0 dropped:0 overruns:0 frame:0
TX packets:4962 errors:0 dropped:401 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:843669 (823.8 KiB) TX bytes:1029801 (1005.6 KiB)
venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:server ip1 P-t-P:server ip1 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
venet0:1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:server ip2 P-t-P:server ip2 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
with vpn conneected
Code:
root@kuduku:~# ifconfig
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:16436 Metric:1
RX packets:167 errors:0 dropped:0 overruns:0 frame:0
TX packets:167 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:19615 (19.1 KiB) TX bytes:19615 (19.1 KiB)
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.1 P-t-P:10.8.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:484 errors:0 dropped:0 overruns:0 frame:0
TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:32670 (31.9 KiB) TX bytes:7209 (7.0 KiB)
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:13629 errors:0 dropped:0 overruns:0 frame:0
TX packets:11524 errors:0 dropped:861 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1941181 (1.8 MiB) TX bytes:2658397 (2.5 MiB)
venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:server ip1 P-t-P:server ip1 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
venet0:1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:server ip2 P-t-P:server ip2 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
route -n
wihtout vpn connected
root@kuduku:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.8.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 venet0
iptables -t nat -L -n -v
without vpn connected
Code:
root@kuduku:~# iptables -t nat -L -n -v
Chain PREROUTING (policy ACCEPT 3895 packets, 511K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 577 packets, 45971 bytes)
pkts bytes target prot opt in out source destination
0 0 SNAT all -- * venet0:1 10.8.0.0/24 0.0.0.0/0 to:server ip2
Chain OUTPUT (policy ACCEPT 577 packets, 45971 bytes)
pkts bytes target prot opt in out source destination
Code:
root@kuduku:~# iptables -t nat -L -n -v
Chain PREROUTING (policy ACCEPT 9242 packets, 1201K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 1107 packets, 87447 bytes)
pkts bytes target prot opt in out source destination
0 0 SNAT all -- * venet0:1 10.8.0.0/24 0.0.0.0/0 to:server ip2
Chain OUTPUT (policy ACCEPT 864 packets, 72003 bytes)
pkts bytes target prot opt in out source destination
iptables-save
without vpn connected
Code:
root@kuduku:~# iptables-save
# Generated by iptables-save v1.4.8 on Thu Jun 27 12:24:58 2013
*raw
:PREROUTING ACCEPT [9369:1340653]
:OUTPUT ACCEPT [7926:1737166]
COMMIT
# Completed on Thu Jun 27 12:24:58 2013
# Generated by iptables-save v1.4.8 on Thu Jun 27 12:24:58 2013
*nat
:PREROUTING ACCEPT [5629:740568]
:POSTROUTING ACCEPT [653:52223]
:OUTPUT ACCEPT [653:52223]
-A POSTROUTING -s 10.8.0.0/24 -o venet0:1 -j SNAT --to-source server ip2
COMMIT
# Completed on Thu Jun 27 12:24:58 2013
# Generated by iptables-save v1.4.8 on Thu Jun 27 12:24:58 2013
*mangle
:PREROUTING ACCEPT [9369:1340653]
:INPUT ACCEPT [9369:1340653]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [7926:1737166]
:POSTROUTING ACCEPT [7926:1737166]
COMMIT
# Completed on Thu Jun 27 12:24:58 2013
# Generated by iptables-save v1.4.8 on Thu Jun 27 12:24:58 2013
*filter
:INPUT ACCEPT [9369:1340653]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [7926:1737166]
COMMIT
# Completed on Thu Jun 27 12:24:58 2013
with vpn connected
Code:
root@kuduku:~# iptables-save
# Generated by iptables-save v1.4.8 on Thu Jun 27 12:37:47 2013
*raw
:PREROUTING ACCEPT [17104:2394883]
:OUTPUT ACCEPT [13257:2983553]
COMMIT
# Completed on Thu Jun 27 12:37:47 2013
# Generated by iptables-save v1.4.8 on Thu Jun 27 12:37:47 2013
*nat
:PREROUTING ACCEPT [9621:1245543]
:POSTROUTING ACCEPT [1209:94396]
:OUTPUT ACCEPT [884:73659]
-A POSTROUTING -s 10.8.0.0/24 -o venet0:1 -j SNAT --to-source server ip2
COMMIT
# Completed on Thu Jun 27 12:37:47 2013
# Generated by iptables-save v1.4.8 on Thu Jun 27 12:37:47 2013
*mangle
:PREROUTING ACCEPT [17104:2394883]
:INPUT ACCEPT [15750:2307601]
:FORWARD ACCEPT [1354:87282]
:OUTPUT ACCEPT [13257:2983553]
:POSTROUTING ACCEPT [14611:3070835]
COMMIT
# Completed on Thu Jun 27 12:37:47 2013
# Generated by iptables-save v1.4.8 on Thu Jun 27 12:37:47 2013
*filter
:INPUT ACCEPT [15750:2307601]
:FORWARD ACCEPT [1354:87282]
:OUTPUT ACCEPT [13257:2983553]
COMMIT
# Completed on Thu Jun 27 12:37:47 2013
/etc/resolv.conf
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 4.2.2.2
with vpn connected
Code:
root@kuduku:~# cat /etc/resolv.conf
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 4.2.2.2
I have reached this far with setting up Debian server with openvpn with help of @varkey who has helped me innumerable times . A big thanks to him . @varkey please sort out this issue also .
@dinjo
Guys please help and it would be greatly appreciated .
Last edited by a moderator: