Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have two servers over which I am trying to install some software. One is server1(IP 10.1.2.205) and the other is server2(IP 10.1.2.206). Both are able to ping each other by name and by IP address (ie. from server2 i can ping server1 or ping 10.1.2.205)

I have the following output when I type in netstat -lnt on server1

    Proto Recv-Q Send-Q Local Address ForeignAddress State  
    tcp        0      0 0.0.0.0:111    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:25   0.0.0.0:*     LISTEN 
    tcp        0      0 0.0.0.0:52666  0.0.0.0:*     LISTEN 
    tcp        0      0 0.0.0.0:6817   0.0.0.0:*     LISTEN 
    tcp        0      0 0.0.0.0:6818   0.0.0.0:*     LISTEN 
    tcp        0      0 0.0.0.0:5672   0.0.0.0:*     LISTEN 
    tcp        0      0 :::111         :::*          LISTEN 
    tcp        0      0 :::22          :::*          LISTEN 
    tcp        0      0 ::1:631        :::*          LISTEN 
    tcp        0      0 :::36483       :::*          LISTEN 
    tcp        0      0 :::5989        :::*          LISTEN  

Now when I try using the netcat command from server2, I get the following results :

nc -v 10.1.2.205 22
Connection to server1 22 port [tcp/ssh] succeeded! SSH-2.0-OpenSSH_5.3

nc -v server1 22
Connection to server1 22 port [tcp/ssh] succeeded! SSH-2.0-OpenSSH_5.3

The problem is with the following outputs though :
nc -v server1 5989
nc: connect to server1 port 5989(tcp) failed: No route to host
I get the same response on every other port.
No other port on server1 responds. My ports of interest are the 6817 and 6818 ports. I have an application that needs to listen and respond on these ports between these two machines.

Output of : iptables -L

    Chain INPUT (policy ACCEPT)
    target  prot opt source   destination         
    ACCEPT  all  --  anywhere anywhere  state RELATED,ESTABLISHED           
    ACCEPT  icmp --  anywhere anywhere            
    ACCEPT  all  --  anywhere anywhere            
    ACCEPT  tcp  --  anywhere anywhere  state NEW tcp dpt:ssh 
    REJECT  all  --  anywhere anywhere  reject-with icmp-host-prohibited 

    Chain FORWARD (policy ACCEPT)
    target  prot opt source   destination         
    REJECT  all  --  anywhere anywhere    reject-with icmp-host-prohibited 

    Chain OUTPUT (policy ACCEPT)
    target  prot opt source   destination    

What could be wrong ?

share|improve this question
    
Sounds like you have a firewall running, have a look at iptables -L –  ssch Nov 5 '13 at 12:13
    
I have put the output of iptables -L in the question. –  ThinkerTailorSoldier Nov 5 '13 at 12:25
    
You want to connect o ports 6817 & 6818? Why does port 631 have to do with this? Also your information is a bit off: nc -v server1 631 results in nc: connect to server1 port 5989. Port 631 vs 5989... –  Patrick Nov 5 '13 at 13:34
add comment

2 Answers

up vote 0 down vote accepted

I think you are using Centos. As you can see in iptables rules all tcp connections other than at port 22 are blocked.

Try flushing iptables rules by :

$ sudo iptables -F

This should remove all iptables rules. Let me know whether this works or not.

share|improve this answer
    
Yes I am using a cousin of CentOS.. Scientific Linux 6.2 –  ThinkerTailorSoldier Nov 5 '13 at 16:27
    
@ThinkerTailorSoldier: Did you try iptables -F command and tested ? –  pradeepchhetri Nov 5 '13 at 17:00
    
Yes, this worked. Is this some sort of default behaviour with CentOS ? –  ThinkerTailorSoldier Nov 6 '13 at 4:58
    
@ThinkerTailorSoldier: centos comes with default iptables rules which blocks all connections coming to any port other than 22 port. –  pradeepchhetri Nov 6 '13 at 14:42
add comment

After you have resolved the firewall rules as discussed above, there may still be some difficulty connecting to cups admin on 631 from other machines.

If you note the format of the ip address before the port number in the output of netstat, you may see that the service running on port 631 seems to be listening to a different IP range from the other services. It looks like is only listening on ip address 127.0.0.1:631 and ::1:631, and not 0.0.0.0:631 :::631.

This suggests that it is listening on the loopback interface lo0 and not the not on the main ethernet interface.

You could confirm this by comparing output of

netstat -L lo0
netstat -L eth0  (or the name of your default network interface)

This is the default configuration and behaviour for the CUPS administration tool.

It only accepts administrative access to web pages from the localhost. See /etc/cupsd.conf (man 5 cupsd.conf) for more information about configuring the cups server to allow remote administrative access.

You will probably need to change "Listen localhost:631" to "Listen *:631", and add a line "Allow 10.1.2.206" or specify an IP and netmask just below the lines "Allow @LOCAL" (local interface) particularly in the /admin section of the configuration file and then restart cupsd ("/etc/init.d/cups restart")

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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