I have VNC Server that run on VPN client's computer, port 5900 and will connect to my VPN Server (ppp) which it is accessible via Internet users. The VPN server is CentOS 6.8 x64.
However, the current VPN Client ISP (not the VPN Server) isnt allow incoming connections from external/internet. In other word, they have secured and do something with the firewalls. For now, my VPN client is able to:
- Connect to the Internet without VPN Server
- Connect to the Internet with VPN Server
- Port 5900 is open for VNC Server so that everyone can connect from LAN/MAN/WAN
- Able to receive 5900 (LAN only) due ISP blocked the ports
My VPN Server is able to: - Receive and Transmit from VPN and internet
In VPN Server, which is the Centos 6.8, these are the iptables, which my VPN client is able to access to the Internet via VPN Server:
-A POSTROUTING -o eth0 -j MASQUERADE
-A INPUT -p tcp -m tcp --dport 5900 -j ACCEPT
-A FORWARD -d 210.48.222.2/32 -i eth0 -o ppp+ -p tcp -m tcp --dport 5900 -j ACCEPT
-A FORWARD -i ppp+ -o eth0 -j ACCEPT
-A FORWARD -i eth0 -o ppp+ -j ACCEPT
And these are the ifconfig in CentOS
eth0 Link encap:Ethernet HWaddr 04:01:4C:C5:81:02
inet addr:128.199.210.115 Bcast:128.199.255.255 Mask:255.255.192.0
inet6 addr: 2400:6180:0:d0::45c:c001/64 Scope:Global
inet6 addr: fe80::601:4cff:fec5:8701/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:163888 errors:0 dropped:0 overruns:0 frame:0
TX packets:171866 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:178131279 (169.8 MiB) TX bytes:179452807 (171.1 MiB)
eth1 Link encap:Ethernet HWaddr 04:01:4C:C5:67:01
inet addr:10.130.133.116 Bcast:10.130.255.255 Mask:255.255.0.0
inet6 addr: fe80::601:4cff:fec5:8702/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:566 (566.0 b)
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:24797 errors:0 dropped:0 overruns:0 frame:0
TX packets:24797 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2914752 (2.7 MiB) TX bytes:2914752 (2.7 MiB)
ppp0 Link encap:Point-to-Point Protocol
inet addr:128.199.210.115 P-t-P:210.48.222.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1396 Metric:1
RX packets:33106 errors:0 dropped:0 overruns:0 frame:0
TX packets:43985 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:3997842 (3.8 MiB) TX bytes:39318955 (37.4 MiB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 -00
inet addr:10.50.0.1 P-t-P:10.50.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)
I've reviewed iptables: How to forward packets with destination port 80 from eth0 to eth1?, it does works from eth0 to eth1, and try to apply from eth0 to ppp+, but it doesnt works. Or maybe I need to do add some more in iptables.
For the VPN, I've followed the steps in the article https://www.photonvps.com/billing/knowledgebase.php?action=displayarticle&id=58 is works (VPN client able to connect to VPN server)
However, I still unable to connect to my VPN client's VNC (port 5900) from the internet/other ISP without connecting the VPN Server. Is there any mistakes or missing in the iptables?
These are my plan:-
My PC (not the VPN user) > Remotely Access to > CentOS + VPN Server > Client (connected to the CentOS VPN)
Client
's ISP blocks port 5900, then it won't be reachable. Using the VPN as you seem to have defined does allowMy PC
to reach port 5900 of theClient
's but why don't you just use an unblocked port if you want to give public access? (Note that in either case it could possibly be a breach in the ISP's terms, justifying the block.)