I have server with Centos 7 and pptpd, httpd installed. httpd works well and pptpd server has working connections so it works well too. Actually what I need is to make httpd site available only through pptp vpn. I've tried to use these answers but no luck. php $_SERVER['REMOTE_ADDR'] gives me the same ip when I visit site with or without vpn.


iptables -A INPUT -i ! ppp+ -p tcp --dport <protected-port> -j REJECT

gives me Bad argument 'ppp+'

Then I wrote iptables rules to block all requests to <protected-port> and allow only ppp+ packets. But seems like it doesn't work too.

All I need is just to have vpn and httpd on the same server and web site available only for vpn connections. And I need it for http and https.

  • Add more details please, better questions make better answers – Jacob Evans Oct 13 '15 at 13:16
  • 1
    Further you should be aware that PPTP has been known to be insecure for over a decade now. It should not be used at all for new VPNs, and old VPNs should have been migrated away from it...in 2005. – Michael Hampton Oct 13 '15 at 13:22

It sounds like you need Split (or public dns with internal record) DNS in order to access the internal IP of the website you'll need to either

  • Edit the hosts file (/etc/hosts, %windir%/system32/drivers/etc/hosts)
  • Configure Bind with an internal DNS Name (externally www.example.com points to the external IP, while your bind www.example.com has (centosIP)... Be sure you give this server as your DNS resolver if you do this.
  • Configure an internal dns virtual-host and a public record for the internal site (intranet.example.com =

Also check your access log and see where traffic is coming from, use ping/nslookup/dig to ensure dns is pointing to the internal IP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.