LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   pptpd server (https://www.linuxquestions.org/questions/linux-networking-3/pptpd-server-4175458505/)

!! hack-back !! 04-17-2013 12:17 PM

pptpd server
 
hello minds,
i installed pptpd server on centos
and i can connect to it from my windows laptop
the reason i made vpn server because i want to work on port is closed in my internet
the server is on softlayer
so is there any configuration to open the port on the pptpd server ???
thanks

warez74 04-17-2013 02:06 PM

Hello, can you explain a little bit better your configuration and what you actually want?

Which port is closed where?

You said you were able to connect from your laptop, so what's the problem then?

Regards

!! hack-back !! 04-17-2013 09:51 PM

http://www.canyouseeme.org/
and i check the port i want to use it said
Error: I could not see your service on x.x.x.x on port (80)
Reason: Connection timed out


but if i use free vpn i see it is opened so what i should do more ?
thank you

!! hack-back !! 04-17-2013 11:05 PM

it is iptables issue

warez74 04-18-2013 07:13 AM

So you want to open some ports? Which one?

I suggest you read the following thread:

http://www.linuxquestions.org/questi...es-4175457932/

!! hack-back !! 04-18-2013 08:32 AM

i make this rule but didnt work ,
i want to use port 81 through this vpn
any idea please??
thank you

!! hack-back !! 04-18-2013 08:36 AM

this is my iptables rules

PHP Code:

# Generated by iptables-save v1.4.7 on Wed Apr 17 23:44:22 2013
*filter
:INPUT ACCEPT [226:18889]
:
FORWARD ACCEPT [0:0]
:
OUTPUT ACCEPT [2619:1038700]
:
acctboth - [0:0]
-
A INPUT -j acctboth
-A INPUT -i bond1 -p tcp -m tcp --dport 1723 -j ACCEPT
-A INPUT -i bond1 -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i ppp+ -o bond1 -j ACCEPT
-A FORWARD -i bond1 -o ppp+ -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -j acctboth
COMMIT
# Completed on Wed Apr 17 23:44:22 2013
# Generated by iptables-save v1.4.7 on Wed Apr 17 23:44:22 2013
*nat
:PREROUTING ACCEPT [5:260]
:
POSTROUTING ACCEPT [0:0]
:
OUTPUT ACCEPT [0:0]
-
A POSTROUTING -o bond1 -j MASQUERADE
COMMIT
# Completed on Wed Apr 17 23:44:22 2013 


warez74 04-18-2013 02:31 PM

I still do not understand what you want to do, but anyway try allowing the port 81 on INPUT chain for all interfaces:

iptables -A INPUT -p tcp -m tcp --dport 81 -j ACCEPT

!! hack-back !! 04-18-2013 02:58 PM

simply,
i want to use program work on port 81 and 3460
in my internet these ports is closed so i tested on vpnpop.com it is solve
now i dont want to use free vpn and i have my own
but my own is closed to
clear now ??
thank you bro

!! hack-back !! 04-18-2013 03:02 PM

i used : iptables -A INPUT -p tcp -m tcp --dport 81 -j ACCEPT
and the same
http://www.canyouseeme.org/
give me
Error: I could not see your service on x.x.x.x on port (81)
Reason: Connection refused

!! hack-back !! 04-18-2013 04:12 PM

need help !!

warez74 04-18-2013 04:24 PM

Quote:

i want to use program work on port 81 and 3460
Where that "program" is running? On the pptpd server or on your PC?

Does that program should be listening at port 81/3460?

BTW, you must explain the situation better if you want to get any help.

!! hack-back !! 04-18-2013 04:41 PM

it is running on my pc
Does that program should be listening at port 81/3460?
yes
no thing else :(

warez74 04-18-2013 05:00 PM

Ok, the things are much more clear now.

What you need is the so-called destination NAT iptables rule.

Before I provide you with that, please paste here the part of /etc/pptpd.conf where the localip and remoteip are specified.

!! hack-back !! 04-18-2013 05:06 PM

localip x.173.180.202
remoteip x.4.252.69

!! hack-back !! 04-18-2013 05:17 PM

at first i do what is in this guide
http://freehostinganswers.com/blog/h...at-and-ubuntu/

warez74 04-18-2013 05:21 PM

Add the following iptable rules:

iptables -t nat -A PREROUTING -d x.x.x.x -p tcp --dport 81 -j DNAT --to x.4.252.69
iptables -t nat -A PREROUTING -d x.x.x.x -p tcp --dport 3460 -j DNAT --to x.4.252.69

where x.x.x.x is IP address of your public server. (dont forget to change the "x" with proper number in the x.4.252.69)

!! hack-back !! 04-18-2013 05:35 PM

now i cant access my server from my ip iam waiting softlayer to answer me why lol :(

warez74 04-18-2013 05:40 PM

?

One thing... the localip and the remoteip (pptpd.conf) should be IP addresses from private range e.g.:
localip 10.10.10.2
remoteip 10.10.10.1

Does that goes for your case?

warez74 04-18-2013 05:41 PM

btw, I hope you did not set the public ip of your PC as a remoteip.

!! hack-back !! 04-18-2013 05:46 PM

my laptop ip is x.4.252.69
my server ip is x.173.180.202

!! hack-back !! 04-18-2013 05:48 PM

Quote:

Originally Posted by warez74 (Post 4934361)
btw, I hope you did not set the public ip of your PC as a remoteip.


hahaha i did that sorry i didnt understand this step very well :doh:

warez74 04-18-2013 05:50 PM

Oh, no :(

You made a common mistake in pptpd.conf

find the place in pptpd.conf where the localip/remoteip are specified and edit it to be like this:

localip 10.10.10.2
remoteip 10.10.10.1

Then when you get access to your server again, add the following iptables rules:

iptables -t nat -A PREROUTING -d x.173.180.202 -p tcp --dport 81 -j DNAT --to 10.10.10.1
iptables -t nat -A PREROUTING -d x.173.180.202 -p tcp --dport 3460 -j DNAT --to 10.10.10.1

!! hack-back !! 04-18-2013 05:54 PM

ok i edited thanks
i can access it through free vpn
but i cant access from my ip i dont know why but i put ticket for softlayer.com
waiting them to finish so that i can test with these rules

!! hack-back !! 04-18-2013 05:57 PM

how i can disconnect ppp0
??? vpn account connected to the server

!! hack-back !! 04-18-2013 06:02 PM

i solved the problem /etc/init.d/pptpd restart-kill
that because i put my ip in remote ip lol
the softlayer still searching for the problem :P

!! hack-back !! 04-18-2013 06:05 PM

you are my super man :D
i love you man :D :hattip:
thanks alot

!! hack-back !! 04-18-2013 06:07 PM

if i make more than 1 vpn account
all of them will take 10.10.10.1
so that i can put
remoteip 10.10.10.1-200

right ?

!! hack-back !! 04-18-2013 06:08 PM

and in iptables
iptables -t nat -A PREROUTING -d 184.173.180.202 -p tcp --dport 82 -j DNAT --to 10.10.10.1-200
??

warez74 04-18-2013 06:09 PM

No, wait.

You can remove the last added iptables rules.

First enter this:

iptables -t nat -L --line-numbers

you should get something like this:

Chain PREROUTING (policy ACCEPT)
num target prot opt source destination
1 DNAT tcp -- anywhere landings.nyc.trafficz.com tcp dpt:81 to:10.10.10.1

Notify "1" under below the "num" field. You should use that rule number (in your case it can be different) to delete the previous added rules:

Then enter:
iptables -t nat -D PREROUTING 1

where "1" is the number that you found for "destination" x.173.180.202

!! hack-back !! 04-18-2013 06:14 PM

i didnt understand ,
now i have vpn account and when i connect it take this ip 10.10.10.1
ok if i connect from more than vpn acount 2-3-4-5
so it will all take the ip 10.10.10.1 this will be conflict

warez74 04-18-2013 06:16 PM

Quote:

iptables -t nat -A PREROUTING -d 184.173.180.202 -p tcp --dport 82 -j DNAT --to 10.10.10.1-200
??
No.
I will explain what this rule means.
In short this rule means:

All TCP packets that are destined to ip 184.173.180.202, to port 82, route to (translate, change destination address) 10.10.10.1

So, when somebody tries to open 184.173.180.202:82, he gets routed (DNAT) to 10.10.10.1

That's the what the DNAT is commonly used for, to enable access to the local servers that has a private ip address.

warez74 04-18-2013 06:19 PM

Quote:

so it will all take the ip 10.10.10.1 this will be conflict
True. You can set the range for remote ip (check the guide in pptpd.conf)

!! hack-back !! 04-18-2013 06:24 PM

localip 10.10.10.1
remoteip 10.10.10.2-245
so that the users will get ip between 2 and 245

!! hack-back !! 04-18-2013 06:32 PM

but how i can open port for ips between 2 and 245

warez74 04-18-2013 06:35 PM

uhm.. No :)

better put like this:

localip 10.10.10.254
remoteip 10.10.10.1-10.10.10.253


If you want that a specific pptp user(let's say user: hack-back) always get the same remoteip (10.10.10.1 in your case, because you want to run the some kind of server software at your pptp remoteip), you can achieve this by editing the

/etc/ppp/chap-secrets

# client server secret IP addresses

Bob * pass123 *
hack-back * pass123 10.10.10.1


So, in this case study, user "Bob" will get random ip from specified remoteip range, while user "hack-back" will always get the same remoteip - 10.10.10.1

Also, while editing the file above please note that you must press the TAB key between client,server,secret,IP addresses fields.

!! hack-back !! 04-18-2013 06:39 PM

ok good thanks and whats about the iptables

-A PREROUTING -d 184.173.180.202/32 -p tcp -m tcp --dport 1177 -j DNAT --to-destination 10.10.10.1


will be just for 10.10.10.1 or all vpn users ??

warez74 04-18-2013 06:45 PM

No, you should add one iptables DNAT rule per each user that is going to run some software that should be reachable from Internet.

The static remoteip applies to all those users who are going to run some software that listens at some port.

For other users that will not be running anything like I said, you should not add the DNAT rules.

warez74 04-18-2013 06:52 PM

...yeah be aware that you should not add the DNAT rules using same --dport for different --to-destination

e.g. adding the following two rules will be a mistake:

iptables -t nat -A PREROUTING -d 184.173.180.202 -p tcp --dport 82 -j DNAT --to 10.10.10.1
iptables -t nat -A PREROUTING -d 184.173.180.202 -p tcp --dport 82 -j DNAT --to 10.10.10.2

!! hack-back !! 04-18-2013 06:53 PM

ok thank you man thats big for today,
thank you again bro

warez74 04-18-2013 06:54 PM

You are welcome, bye


All times are GMT -5. The time now is 09:55 AM.