LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Can ping to localhost but cannot telnet (https://www.linuxquestions.org/questions/linux-networking-3/can-ping-to-localhost-but-cannot-telnet-430547/)

sreeramabsc 04-01-2006 01:08 AM

Can ping to localhost but cannot telnet
 
Hello friends,
I am very much new to networking. I have some issues with telnet.

I have installed RedHat 9.0 on my PC. I have two network cards, eth0 and eth1. The IP addresses are as follows:

(a) eth0 - 192.168.1.20
(b) eth1 - 172.27.248.10
(c) lo - 127.0.0.1

All the interfaces are up and I am able to "ping" each of them successfully. But I am not able to "telnet" !!
When I try to telnet, I get the following message:

(a) [root@Bhadra root]# telnet localhost
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused

(b) [root@Bhadra root]# telnet 192.168.1.20
Trying 192.168.1.20...
telnet: connect to address 192.168.1.20: Connection refused

(c) [root@Bhadra root]# telnet 172.27.248.10
Trying 172.27.248.10...
telnet: connect to address 172.27.248.10: Connection refused


What could be the problem?
Kindly guide me to get in with telnet and get out of this problem.

Some additional information for your kind reference:
----------------------------------------------------
(a) ifconfig command:

[root@Bhadra root]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:00:E8:50:10:9A
inet addr:172.27.248.10 Bcast:172.27.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:4 dropped:0 overruns:0 carrier:8
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:5 Base address:0xb800

eth1 Link encap:Ethernet HWaddr 00:08:A1:69:0B:C7
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:906 errors:0 dropped:0 overruns:0 frame:0
TX packets:916 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:729172 (712.0 Kb) TX bytes:218019 (212.9 Kb)
Interrupt:3 Base address:0x3f00

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8709 errors:0 dropped:0 overruns:0 frame:0
TX packets:8709 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:594126 (580.2 Kb) TX bytes:594126 (580.2 Kb)


(b) route command:
------------------
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
172.27.0.0 * 255.255.0.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default bsnl 0.0.0.0 UG 0 0 0 eth1


(c) netstat command:
--------------------

[root@Bhadra root]# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
172.27.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth1


(d) chkconfig --list:
--------------------
[root@Bhadra root]# chkconfig --list
kudzu 0:off 1:off 2:off 3:on 4:off 5:on 6:off
syslog 0:off 1:off 2:on 3:on 4:off 5:on 6:off
netfs 0:off 1:off 2:off 3:on 4:off 5:on 6:off
network 0:off 1:off 2:on 3:on 4:off 5:on 6:off
random 0:off 1:off 2:on 3:on 4:off 5:on 6:off
rawdevices 0:off 1:off 2:off 3:on 4:off 5:on 6:off
pcmcia 0:off 1:off 2:on 3:on 4:off 5:on 6:off
saslauthd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
keytable 0:off 1:on 2:on 3:on 4:off 5:on 6:off
apmd 0:off 1:off 2:on 3:on 4:off 5:on 6:off
atd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
gpm 0:off 1:off 2:on 3:on 4:off 5:on 6:off
autofs 0:off 1:off 2:off 3:on 4:off 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:off 5:on 6:off
irda 0:off 1:off 2:off 3:off 4:off 5:off 6:off
isdn 0:off 1:off 2:on 3:on 4:on 5:on 6:off
sshd 0:off 1:off 2:on 3:on 4:off 5:on 6:off
portmap 0:off 1:off 2:off 3:on 4:off 5:on 6:off
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
nfslock 0:off 1:off 2:off 3:on 4:off 5:on 6:off
sendmail 0:off 1:off 2:on 3:off 4:on 5:on 6:off
rhnsd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:off 5:on 6:off
anacron 0:off 1:off 2:on 3:on 4:off 5:on 6:off
xfs 0:off 1:off 2:on 3:on 4:off 5:on 6:off
xinetd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
cups 0:off 1:off 2:on 3:on 4:off 5:on 6:off
ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
firstboot 0:off 1:off 2:off 3:off 4:off 5:off 6:off
arpwatch 0:off 1:off 2:off 3:off 4:off 5:off 6:off
named 0:off 1:off 2:off 3:off 4:off 5:off 6:off
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
winbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
smb 0:off 1:off 2:off 3:off 4:off 5:off 6:off
spamassassin 0:off 1:off 2:on 3:on 4:on 5:on 6:off
canna 0:off 1:off 2:on 3:on 4:on 5:on 6:off
dhcpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
dhcrelay 0:off 1:off 2:off 3:off 4:off 5:off 6:off
FreeWnn 0:off 1:off 2:on 3:on 4:on 5:on 6:off
innd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
isicom 0:off 1:off 2:off 3:off 4:off 5:off 6:off
snmpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
snmptrapd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
hpoj 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ups 0:off 1:off 2:off 3:off 4:off 5:off 6:off
mailman 0:off 1:off 2:off 3:off 4:off 5:off 6:off
psacct 0:off 1:off 2:off 3:off 4:off 5:off 6:off
lisa 0:off 1:off 2:off 3:off 4:off 5:off 6:off
xinetd based services:
chargen-udp: off
rsync: off
chargen: off
daytime-udp: off
daytime: off
echo-udp: off
echo: off
services: off
servers: off
time-udp: off
time: off
cups-lpd: off
sgi_fam: on
amanda: off
dbskkd-cdb: off
amandaidx: off
amidxtape: off
ktalk: off
swat: off
telnet: on


(e) Finally, /sbin/iptables -L command:
---------------------------------------

[root@Bhadra root]# /sbin/iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Lokkit-0-50-INPUT all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Lokkit-0-50-INPUT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain RH-Lokkit-0-50-INPUT (2 references)
target prot opt source destination
ACCEPT udp -- pun3lgn-a.sancharnet.in anywhere udp spt:domain dpts:1025:65535
ACCEPT udp -- bsnl anywhere udp spt:domain dpts:1025:65535
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp flags:SYN,RST,ACK/SYN
ACCEPT tcp -- anywhere anywhere tcp dpt:telnet flags:SYN,RST,ACK/SYN
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
REJECT tcp -- anywhere anywhere tcp dpts:0:1023 flags:SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT tcp -- anywhere anywhere tcp dpt:nfs flags:SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT udp -- anywhere anywhere udp dpts:0:1023 reject-with icmp-port-unreachable
REJECT udp -- anywhere anywhere udp dpt:nfs reject-with icmp-port-unreachable
REJECT tcp -- anywhere anywhere tcp dpts:x11:6009 flags:SYN,RST,ACK/SYN reject-with icmp-port-unreachable
REJECT tcp -- anywhere anywhere tcp dpt:xfs flags:SYN,RST,ACK/SYN reject-with icmp-port-unreachable


Kindly suggest and guide me to work out of this problem.
Thanks a lot.

Regards,
Sreeram

rcs1000 04-01-2006 02:06 AM

Well, firstly, is the telnet daemon running? Also, telnet may not be working, but SSH (essentially encrypted telnet) may well be.

Try:
ssh localhost

Also, try:
ps -All | grep telnet

If all three of those fail, try:
ps -All | grep sshd

If none of these work, post the replies up here!

Many thanks,

Robert

sreeramabsc 04-01-2006 06:17 AM

Hello,
I am extremely thankful to you for your suggestions. Yes, SSH worked !! I could enter (login) with SSH. However, I am curious to know as to why is 'telnet' disabled? I see that 'xinetd' is running, but it is not allowing for telnet connections. Why is this? Kindly inform.

However, I have not yet achieved what I wanted to achieve. Entering the system using telnet was only the first step.

I have 2 PCs at my home. One is running Redhat 9 and other one is running Solaris 10 (for x86). I wanted to network these two. The linux box also has another interface through which I can browse the net. Now, I wanted to enter this linux box from the solaris box ( which I could do it now using SSH ). From this SSH session, I would like to open the browser (mozilla) using the command 'mozilla', but it says some display problem. I also tried to issue the command 'xterm' but even that gave the same problem.
The detailed steps and the error are as follows:

(a) I started SSH from my solaris box and logged into the linux box - Successful.
(b) I issued the command: xterm ( this means the xterm of the linux box is expected to run and I would like to see the xterm window in my solaris box ) - Failure.
**************************
ERROR MESSAGE:
Xlib: connection to "172.27.248.20:0.0" refused by server
Xlib: No protocol specified

xterm Xt error: Can't open display: 172.27.248.20:0.0
***************************
NOTE: The IP address "172.27.248.20" is that of the solaris box. In other words, I have set my display in the solaris box using the command: export DISPLAY=172.27.248.20:0.0
[I run bash shell].

(c) I also issued the command 'xhost +' in the linux box, but even this did not help.

What could be the problem here? How do I rectify it?

Kindly suggest.

Thanks,
Sreeram

edcutis 04-01-2006 03:52 PM

Telnet is not considered safe any more, as the user name and password are passed "in the clear" to the server. Most distributions do not include it (telnet) by default. You have to go back and specifically install and configure it. SSH is standard for most distros...

Of course, if both machines are sitting side-by-side then the man in the middle attack becomes laughable, because the man would be sitting right beside you :)

Have a great day!

Habu 04-02-2006 05:20 AM

You'll need to enable x forwarding through ssh. When you issue the ssh command, use the -X switch.
Eg: ssh -X 172.27.248.20

abhi.b 04-02-2006 06:46 AM

Simply do one thing.
run the following commands.

iptables -F -t filter
iptables -F -t nat
iptables -F -t mangle

Check if telnet works now or not...?


All times are GMT -5. The time now is 12:48 PM.