I have an apache webserver installed on my pc whcih works as expected untill I connect to my VPN service provider (Private Internet Access) using their software.
Once connected I'm no longer able to remotely access the webserver (using my ISP's public ip address 123.4.5.6
) with Connection Timeout
error every time I try to access it. However the webserver will remain reachable through my local area network (using LAN ip address 192.168.0.6
).
Here's my network diagram to the best of my knowledge (the isp and vpn ips are not the real ones):
Here's some info I gathered about the network (I disabled my UFW
firewall and flushed all iptables
rules to rule out the possibility that the firewall is causing it):
Before connecting to VPN:
me@mypc:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
me@mypc:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:1d:09:b4:b9:21
inet addr:192.168.0.6 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::21d:9ff:feb4:b921/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:239399 errors:0 dropped:0 overruns:0 frame:0
TX packets:89260 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:321072109 (321.0 MB) TX bytes:17959636 (17.9 MB)
Interrupt:17
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:359782 errors:0 dropped:0 overruns:0 frame:0
TX packets:359782 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:140030332 (140.0 MB) TX bytes:140030332 (140.0 MB)UU
After connecting to VPN:
me@mypc:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.132.1.5 128.0.0.0 UG 0 0 0 tun0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
10.132.1.1 10.132.1.5 255.255.255.255 UGH 0 0 0 tun0
10.132.1.5 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
128.0.0.0 10.132.1.5 128.0.0.0 UG 0 0 0 tun0
192.168.0.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
234.5.6.7 192.168.0.1 255.255.255.255 UGH 0 0 0 eth0
me@mypc:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:1d:09:b4:b9:21
inet addr:192.168.0.6 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:238838 errors:0 dropped:0 overruns:0 frame:0
TX packets:88929 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:320930349 (320.9 MB) TX bytes:17868326 (17.8 MB)
Interrupt:17
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:348572 errors:0 dropped:0 overruns:0 frame:0
TX packets:348572 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:135702614 (135.7 MB) TX bytes:135702614 (135.7 MB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.132.1.6 P-t-P:10.132.1.5 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:833 errors:0 dropped:0 overruns:0 frame:0
TX packets:918 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:694943 (694.9 KB) TX bytes:105489 (105.4 KB)
What is causing this issue and how can I fix it?
Best Answer
You have to add route to 123.4.5.6 trought your ISP gate. For example:
According your Linux distribution put this rule for routing in appropriate config file.