TheOneAndOnlyChosenOne Posted October 12, 2013 Share Posted October 12, 2013 HiI have the next set up:A server (1) that is reachable from the internet and an internal server (2) that is not reachable externally, but can be reached through server 1.Now. When I run next script on server 1, everything works. 'startsuccess!' is printed. <?php echo "start"; $host = 'server2'; $port = '389; $ds = ldap_connect($host, $port); echo "success!"; ?>When I run this on my local pc, it doesn't work.I forward port 389 to port 1337. This tunnel should work, because portforwarding of other ports (like 22) work.This is the script I run locally:<?php echo "start"; $host = 'localhost'; $port = '1337; $ds = ldap_connect($host, $port); echo "success!"; ?>Only 'start' is printed out.Am I doing something wrong, or do I have to forward more ports?Thanks! Link to comment https://forums.phpfreaks.com/topic/282915-ports-needed-for-ldap-connection/ Share on other sites More sharing options...
jazzman1 Posted October 13, 2013 Share Posted October 13, 2013 The outputs of netstat -tulpn from the both servers should be a good start for us. Link to comment https://forums.phpfreaks.com/topic/282915-ports-needed-for-ldap-connection/#findComment-1453710 Share on other sites More sharing options...
TheOneAndOnlyChosenOne Posted October 14, 2013 Author Share Posted October 14, 2013 Thanks for your reply! Server 1: Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:5126 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:4040 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN - tcp 0 0 193.190.253.193:53 0.0.0.0:* LISTEN - tcp 0 0 193.190.253.225:53 0.0.0.0:* LISTEN - tcp 0 0 193.190.253.208:53 0.0.0.0:* LISTEN - tcp 0 0 192.168.0.160:53 0.0.0.0:* LISTEN - tcp 0 0 192.168.0.150:53 0.0.0.0:* LISTEN - tcp 0 0 192.168.0.182:53 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:8022 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:4951 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:59266 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:5123 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:51651 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:389 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:5125 0.0.0.0:* LISTEN - tcp6 0 0 ::1:4040 :::* LISTEN - tcp6 0 0 :::111 :::* LISTEN - tcp6 0 0 :::44593 :::* LISTEN - tcp6 0 0 :::4949 :::* LISTEN - tcp6 0 0 :::22 :::* LISTEN - tcp6 0 0 ::1:4951 :::* LISTEN - tcp6 0 0 :::25 :::* LISTEN - tcp6 0 0 :::40859 :::* LISTEN - tcp6 0 0 :::389 :::* LISTEN - tcp6 0 0 ::1:5125 :::* LISTEN - udp 0 0 193.190.253.193:53 0.0.0.0:* - udp 0 0 193.190.253.225:53 0.0.0.0:* - udp 0 0 193.190.253.208:53 0.0.0.0:* - udp 0 0 192.168.0.160:53 0.0.0.0:* - udp 0 0 192.168.0.150:53 0.0.0.0:* - udp 0 0 192.168.0.182:53 0.0.0.0:* - udp 0 0 127.0.0.1:53 0.0.0.0:* - udp 0 0 0.0.0.0:67 0.0.0.0:* - udp 0 0 0.0.0.0:69 0.0.0.0:* - udp 0 0 0.0.0.0:111 0.0.0.0:* - udp 0 0 193.190.253.193:123 0.0.0.0:* - udp 0 0 193.190.253.225:123 0.0.0.0:* - udp 0 0 193.190.253.208:123 0.0.0.0:* - udp 0 0 192.168.0.160:123 0.0.0.0:* - udp 0 0 192.168.0.150:123 0.0.0.0:* - udp 0 0 192.168.0.182:123 0.0.0.0:* - udp 0 0 127.0.0.1:123 0.0.0.0:* - udp 0 0 0.0.0.0:123 0.0.0.0:* - udp 0 0 0.0.0.0:36056 0.0.0.0:* - udp 0 0 0.0.0.0:5353 0.0.0.0:* - udp 0 0 0.0.0.0:33009 0.0.0.0:* - udp 0 0 0.0.0.0:55549 0.0.0.0:* - udp 0 0 0.0.0.0:850 0.0.0.0:* - udp 0 0 127.0.0.1:875 0.0.0.0:* - udp 0 0 0.0.0.0:60281 0.0.0.0:* - udp 0 0 127.0.0.1:921 0.0.0.0:* - udp 0 0 0.0.0.0:517 0.0.0.0:* - udp 0 0 0.0.0.0:518 0.0.0.0:* - udp6 0 0 :::40540 :::* - udp6 0 0 :::111 :::* - udp6 0 0 fe80::219:dbff:fec5:123 :::* - udp6 0 0 ::1:123 :::* - udp6 0 0 fe80::219:dbff:fec5:123 :::* - udp6 0 0 :::123 :::* - udp6 0 0 :::53430 :::* - udp6 0 0 :::5353 :::* - udp6 0 0 :::850 :::* - udp6 0 0 :::52110 :::* Server 2: Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:389 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - tcp6 0 0 :::389 :::* LISTEN - tcp6 0 0 :::4949 :::* LISTEN - tcp6 0 0 :::22 :::* LISTEN - My own pc: Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:1337 0.0.0.0:* LISTEN 25768/ssh tcp6 0 0 :::22 :::* LISTEN - tcp6 0 0 ::1:631 :::* LISTEN - tcp6 0 0 ::1:1337 :::* LISTEN 25768/ssh udp 0 0 0.0.0.0:1900 0.0.0.0:* - udp 0 0 0.0.0.0:43048 0.0.0.0:* - udp 0 0 127.0.0.1:53 0.0.0.0:* - udp 0 0 0.0.0.0:68 0.0.0.0:* - udp 0 0 0.0.0.0:5353 0.0.0.0:* - udp6 0 0 :::51728 :::* - udp6 0 0 :::5353 :::* - Link to comment https://forums.phpfreaks.com/topic/282915-ports-needed-for-ldap-connection/#findComment-1453870 Share on other sites More sharing options...
jazzman1 Posted October 14, 2013 Share Posted October 14, 2013 So, run nmap from your local server terminal and give me the output of: nmap -Pn -p 339 ip_address_of_server2 Link to comment https://forums.phpfreaks.com/topic/282915-ports-needed-for-ldap-connection/#findComment-1453876 Share on other sites More sharing options...
TheOneAndOnlyChosenOne Posted October 14, 2013 Author Share Posted October 14, 2013 You mean on my local pc? Server 2 is not reachable from the outside. Also, nmap is not installed on server 1 and server 2. Link to comment https://forums.phpfreaks.com/topic/282915-ports-needed-for-ldap-connection/#findComment-1453880 Share on other sites More sharing options...
jazzman1 Posted October 14, 2013 Share Posted October 14, 2013 Yep, I mean to run nmap from your local PC! Server 2 should be reachable by port 389, but not sure if this port is not filtered. PS: Are you using windows for home PC? Try to run ldap but be careful about php syntax: <?php echo 'start'; $host = 'server 2 ip address'; $port = 389; $ds = ldap_connect($host, $port); echo 'success!'; Go to the php.net website and take a look at examples how to check if the connection of ldap is success or fail. Never use php to do this before. Link to comment https://forums.phpfreaks.com/topic/282915-ports-needed-for-ldap-connection/#findComment-1453882 Share on other sites More sharing options...
TheOneAndOnlyChosenOne Posted October 28, 2013 Author Share Posted October 28, 2013 Thanks for your reply! Doesn't it have to be $port = 1337? I'm running Linux on my local pc. Nmap for both port 389 and 1337: Server 2 has no external ip, so I used his internal ip. Nmap scan report for ip_server_2 Host is up. PORT STATE SERVICE 389/tcp filtered ldap Nmap scan report for ip_server_2 Host is up. PORT STATE SERVICE 1337/tcp filtered waste Link to comment https://forums.phpfreaks.com/topic/282915-ports-needed-for-ldap-connection/#findComment-1455808 Share on other sites More sharing options...
TheOneAndOnlyChosenOne Posted October 28, 2013 Author Share Posted October 28, 2013 Error reporting did the trick!"Call to undefined function: ldap_connect()"-> Had to install php5-ldap.Problem solved. Link to comment https://forums.phpfreaks.com/topic/282915-ports-needed-for-ldap-connection/#findComment-1455810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.