# localhost mess-up, need some clarification

## Seektheguru

I was just wondering exactly what needs to be set so that my localhost will work. It seems to be giving me trouble with both cups and samba. Here is what resolv.conf says:

```
domain mydomain.com

nameserver 148.77.1.33

nameserver 148.77.1.34
```

And here is what hostname says:

```
deathdork.mydomain.com
```

And here is what hosts says for localhost...:

```
127.0.0.1       localhost
```

So then, what else could be wrong?

----------

## nitro322

Well, your config files look fine, but I'm not really understanding what your problem is.  You said cups and samba are giving you errors?  Can you paste them here?  Also, do you get a reply when you 'ping localhost'?  If so, then your loopback device should be working fine.

----------

## Seektheguru

It looks like I get a reply from the ping... the real problem comes when I can't get to "localhost:631" and when I try to browse my network, I get "Could not connect to host localhost." So, that's my problem...

----------

## Chris W

Is anything listening on port 631?   For example: 

```
# netstat -pan --inet

```

 gives: 

```

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 172.16.56.1:53          0.0.0.0:*               LISTEN      5643/named

tcp        0      0 10.0.0.29:53            0.0.0.0:*               LISTEN      5643/named

tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      5643/named

tcp        0      0 0.0.0.0:119             0.0.0.0:*               LISTEN      9216/xinetd

tcp        0      0 0.0.0.0:3128            0.0.0.0:*               LISTEN      5870/(squid)

tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      5794/master

tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      5643/named

...
```

 on my machine.   There is no CUPS or SWAT listening here.   If you cannot see something listening on 631 (CUPS) or 901 (SWAT)  then that's where your problem lies.   Try 

```
# /etc/init.d/cupsd start

```

 and then see if you can connect.   If so, you may wish to permanently add it to the default runlevel: 

```
# rc-update add cupsd default
```

----------

## Seektheguru

This is what i get when I 

```
netstat -pan --inet
```

:

```
Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      4225/smbd

tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      4332/X

tcp        0      0 0.0.0.0:631             0.0.0.0:*               LISTEN      4010/cupsd

tcp        1      1 148.71.27.108:32774     66.250.107.251:80       LAST_ACK    -

tcp        1      0 148.71.27.108:32775     66.250.107.251:80       CLOSE_WAIT  4694/mozilla-bin

udp        0      0 148.71.27.108:137       0.0.0.0:*                           4227/nmbd

udp        0      0 0.0.0.0:137             0.0.0.0:*                           4227/nmbd

udp        0      0 148.71.27.108:138       0.0.0.0:*                           4227/nmbd

udp        0      0 0.0.0.0:138             0.0.0.0:*                           4227/nmbd

```

For some reason, the fact that cups is not listening on 127.0.0.1 seems a bit odd.. how can i get it to listen there?

----------

## pjp

Can you set hostname in cups, or does it have to be an IP?

----------

## Seektheguru

are you asking that to me, or, in general? I'm not sure... but I thought it had to be the hostname, like 127.0.0.1:631... not any old ip... who knows...

----------

## pjp

Yeah, I was asking you... probably should have made that more clear.  127.0.0.1 is an IP address, not a hostname.

----------

## Seektheguru

Alright... so then, that means what.. hehe

----------

## Chris W

In a netstat listing, any server listening on 0.0.0.0:631 will be given any connections to port 631 on any interface in the machine.   This should include  the loopback (lo) interface.   Servers listed like nnn.ooo.ppp.qqq:631 are listening for connections only on the interface with the specified address.

What happens when you: 

```
# telnet localhost 631
```

A good response is:

```
# telnet localhost 631

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

GET / HTTP/1.0

<snipped much HTML>

Connection closed.
```

and a bad one:

```
 # telnet localhost 631

Trying 127.0.0.1...

telnet: Unable to connect to remote host: Connection refused
```

Does your browser have a proxy set?  If you have a local squid proxy then, by default, it will not connect to port 631 because it is not a known HTTP port (a security feature).   Try disabling your browser proxy settings before connecting to http://localhost:631.   If squid is causing heartache you need to either bypass the proxy for localhost, or modify squid.conf to declare port 631 fair game.

----------

## Seektheguru

This is what I get:

```

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

GET / HTTP/1.0

Connection closed by foreign host.
```

I typed the 

```
GET / HTTP/1.0
```

... was I supposed to?

I also did have a proxy set in konqueror, so I can access the admin now through 631, however... still can't print a test page... I have an S750 and am using a bjc8200 driver for it... Also, when it is hooked up with usb, it shows up fine in /dev/usb, however, when by parallel, it doesn't show up anywhere in /dev.. any ideas?

----------

## Chris W

Good, so the admin stuff is working  :Smile: 

I'm not really going to be much help with the CUPS printing itself.   The first parallel port is /dev/parport0 I think.

----------

## nE0

in your /etc/hosts I'm missing:

```

127.0.0.1            localhost

192.168.1.15       deathdork

```

Or your own ip adres in front of your netbiosname.

some services / deamons dont run on the loopback adaptor (lo) but only on the eth0/1/2 etc.

so complete your config file, and then try it.

Ne0

----------

## Seektheguru

the reason i didn't originally have that info listed in my hostname was because i masked it. It is in there, however. The problem still occurs. I can get to localhost:631 through konqueror. I can do administrative tasks, but not print a thing. I try a test page and get nothing.

----------

