LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-11-2005, 12:32 PM   #1
capitalista
LQ Newbie
 
Registered: Dec 2005
Posts: 7

Rep: Reputation: 0
Weird - cannot connect to localhost


This is strange, I have a new Ubuntu installation, and I can't connect to localhost (127.0.0.1) through any service - ssh, telnet, ftp, apache, etc. However, I can connect to those if I type in the machine's "real" IP - like 192.168.1.100. I can even access it from the outside by typing in the external IP of my router and port forwarding those services to the box. Connecting to localhost still does not work. I am sure it is something simple...any ideas?

Thanks,
Andrew
 
Old 12-11-2005, 12:35 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
You simply may not have those services bound to the loopback device. Easy way to find out:
Code:
netstat -atun
Post the output here and someone can comment. Any reason why you need to connect to localhost other than testing the connection to localhost?
 
Old 12-11-2005, 12:38 PM   #3
capitalista
LQ Newbie
 
Registered: Dec 2005
Posts: 7

Original Poster
Rep: Reputation: 0
I think it is setup correctly, it looks like they are bound to everything, but here is the output. As far as the reason - I have setup an imap server, and I need my scripts to be able to connect to it. Also, my sql servert, etc. Thanks again.

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:32770 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:32771 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:41523 127.0.0.1:32770 ESTABLISHED
tcp 0 0 127.0.0.1:32770 127.0.0.1:41523 ESTABLISHED
tcp 0 1 192.168.1.100:44662 127.0.0.1:631 SYN_SENT
tcp6 0 0 :::143 :::* LISTEN
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 :::443 :::* LISTEN
tcp6 0 52 ::ffff:192.168.1.100:22 ::ffff:192.168.1.101:3118 ESTABLISHED
udp 0 0 0.0.0.0:68 0.0.0.0:*
 
Old 12-11-2005, 12:40 PM   #4
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
Hi,

just a few guesses...

do you have an entry for localhost in your /etc/hosts ?

do you have iptables running and dropping local connections (iptables -L to list the rules, and iptables -A INPUT -i lo -j ACCEPT; iptables -A OUTPUT -o lo -j ACCEPT to allow localhost connections)

all the services you're refering to can be configured to listen only on specific interfaces (but usually, it's not the default config)... check your sshd.conf

is your lo interface up and running (actually, i cannot remember any machine on which it was down, but still...)? You should see its status by running ifconfig.

by the way, can you ping 127.0.0.1? localhost? that's definitly the first thing to check...

Hope this helps
 
Old 12-11-2005, 12:45 PM   #5
capitalista
LQ Newbie
 
Registered: Dec 2005
Posts: 7

Original Poster
Rep: Reputation: 0
thanks for the reply. the answers to you questions, in order:

==hosts file==
127.0.0.1 localhost.localdomain localhost bones

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

==iptables -L output==
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination


i have no sshd.conf for whatever reason...

i cannot ping 127.0.0.1. hmm, now that definately is weird...what do you think it is?
 
Old 12-11-2005, 12:47 PM   #6
capitalista
LQ Newbie
 
Registered: Dec 2005
Posts: 7

Original Poster
Rep: Reputation: 0
oh i also tried the iptables commands you posted, to no avail.
 
Old 12-11-2005, 12:53 PM   #7
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
yep, since your iptables -L said default policy accept for all tables, you didn't need the 2 iptables commands...

what did the ifconfig gave? It should say something like
Code:
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
with other lines giving the RX/TX stats

what's important is that the interface says UP and that the IP and mask are correct.
 
Old 12-11-2005, 12:54 PM   #8
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Try su (or sudo) and run
Code:
ifconfig
Your netstat output is a bit strange. It looks like you may have no regular IP bound to your ethernet card (but it is listening for IPv6 on all devices).
 
Old 12-11-2005, 12:55 PM   #9
capitalista
LQ Newbie
 
Registered: Dec 2005
Posts: 7

Original Poster
Rep: Reputation: 0
oh snap, i think you may have identified what the problem is. i don't think the IP and mask are what they should be. i think this is because of the setup of my wireless usb adapter. check it out:
lo Link encap:Local Loopback
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6687 errors:0 dropped:0 overruns:0 frame:0
TX packets:6687 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:613745 (599.3 KiB) TX bytes:613745 (599.3 KiB)

rausb0 Link encap:Ethernet HWaddr 00:11:50:88:77:C9
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::211:50ff:fe88:77c9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:99899 errors:0 dropped:0 overruns:0 frame:0
TX packets:95553 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:98598734 (94.0 MiB) TX bytes:91556172 (87.3 MiB)

sit0 Link encap:IPv6-in-IPv4
inet6 addr: ::127.0.0.1/96 Scope:Unknown
UP RUNNING NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:912 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)


is that right or wrong...if it's wrong...how do i fix it?

thanks again for the replies, i appreciate it.
 
Old 12-11-2005, 01:00 PM   #10
fr_laz
Member
 
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32
the address of lo0 is quite strange...
try a ifconfig lo0 127.0.0.1 netmask 255.0.0.0 up
that should do it.

you might want to change your network config file... but both location and syntax depends on what distrib you're running.
 
Old 12-11-2005, 01:12 PM   #11
capitalista
LQ Newbie
 
Registered: Dec 2005
Posts: 7

Original Poster
Rep: Reputation: 0
wow, that did it, thanks a lot.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't connect to host localhost Scoobsky Linux - Networking 3 10-26-2005 11:47 AM
Cannot connect to anything on localhost JohnKFT Slackware 17 05-11-2005 02:21 AM
HELP! Weird localhost/localdomain name bleed goatpiper Linux - Software 1 04-08-2005 09:01 AM
can't connect to localhost acidblue Fedora 0 12-05-2004 07:20 PM
Can't connect to localhost Brendon Linux - Networking 11 07-30-2002 10:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration