Hot answers tagged

109

Install dnsmasq (I do this on all my Linux desktops as a DNS cache anyways). In dnsmasq.conf add the line: address=/localhost.com/127.0.0.1


109

There isn't a great deal of difference between the two; 127/8 (eg: 127.0.0.0 => 127.255.255.255) are all bound to the loopback interface. The reason why is documented in the Debian manual here: http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution Ultimately, it is a bug workaround; the original report is here: http://...


42

It is not possible to specify wildcards in the /etc/hosts file. Either specify the required hostnames explicitly or alternatively set up a local name server with the appropriate rules.


41

Jon Postel picked 127. Before the Internet Assigned Numbers Authority took over (RFC 3232) around the time of his death (RFC 2468), he was the "czar" of Internet address and port assignments, having essentially nominated himself for the task. (RFC 349) Back in the early 1980s, when IPv4 as we know it was first being hashed out, existing networks were given ...


32

I have written a dns proxy in Python. It will read wildcard entries in /etc/hosts. See here: https://github.com/hubdotcom/marlon-tools/blob/master/tools/dnsproxy/dnsproxy.py


30

To sum up the linked-to information: It is (debatably) useful to have an entry in your /etc/hosts translating the machine's fully-qualified domain name into its permanent IP address. debian-installer, and more specifically, its netcfg component, currently (up to March 2013 at least) creates this entry. If the machine is not known to have a permanent IP ...


28

Inside the Service tag change: <Connector port="8080" protocol="HTTP/1.1" ... to: <Connector address="127.0.0.1" port="8080" protocol="HTTP/1.1" ... For more information: http://tomcat.apache.org/tomcat-6.0-doc/config/http.html


28

Use an IP-binding to 127.0.0.1. That should activate a listening port on localhost. On the client side do not use localhost - use 127.0.0.1 instead. Many clients have an internal alias that makes them connect to the socket if you specify localhost as target. MySQL is strange.


28

From the RFC: 127.0.0.0/8 - This block is assigned for use as the Internet host loopback address. A datagram sent by a higher level protocol to an address anywhere within this block should loop back inside the host. This is ordinarily implemented using only 127.0.0.1/32 for loopback, but no addresses within this block should ever ...


22

In Linux and other *nixes, MySQL will assume you want to use a socket if you connect to the host "localhost" (which would be the default hostname). You can override this in 3 ways: 1) Specify a different hostname like 127.0.0.1 (mysql -h 127.0.0.1) or your server's real hostname 2) Specify that you want to use TCP and not a socket (mysql --protocol tcp) ...


20

There's a WIKI Entry about exactly this issue on the wireshark homepage. They also mention specifics about the loopback interface regarding Windows - you could be running just into that.


18

MySQL will try to connect to the unix socket if you tell it to connect to "localhost". If you tell it to connect to 127.0.0.1 you are forcing it to connect to the network socket. So probably you have MySQL configured to only listen to the network socket and not to the file system socket. What exactly is wrong with your unix socket is hard to tell. But I ...


13

You need to set up a DNS server and have each client use it for resolution. The server itself can be something as "light" as dnsmasq or as heavy as BIND.


13

That's the default Apache HTTP index page. It's there to indicate you've correctly installed and enabled httpd.


12

Yes, 127.0.0.1 is called loopback network and is always available. This address points to the machine itself. EDIT: To answer the second part of the question: Yes, machines A and B can be on the same network (but NOT the same as 127.0.0.1, while loopback is virtual) if the netmask is set properly. Use IP calculator to get what you need.


12

For some reason you are missing the http.conf which usually has no content. Please try to create it and restart your web server touch /etc/apache2/httpd.conf


11

cacert.pem is a collection of trusted root certification authorities. You can't use these to secure your own site. There are a number of reasons, but mainly: you don't have the matching private key. You site certificate contains a public key that is used by the client to encrypt messages to your server that can only be decrypted by the matching private key....


10

The "do not change" warning refers to changing the name "localhost". Many software packages expect "localhost" to resolve to 127.0.0.1. Adding more entries is not a problem. You can add the entries after the host (as shown by Iain), or add additional lines. For example: 127.0.0.1 localhost 127.0.0.1 api.localhost 127.0.0.1 testsite2.localhost On ...


10

Isn't this really a client issue ? If using the mysql program You can use the --protocol switch. From the man page --protocol={TCP|SOCKET|PIPE|MEMORY} The connection protocol to use for connecting to the server. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want. ...


10

To alias localhost, you can use this terminal command to create a 'loopback': ifconfig lo0 alias 127.0.0.2 With the localhost alias setup, you can create multiple HTTPS virtual hosts thusly: <VirtualHost 127.0.0.1:443> ...... </VirtualHost> <VirtualHost 127.0.0.2:443> ...... </VirtualHost> You could also initialize these hosts ...


9

Change the ^HOSTNAME line in /etc/sysconfig/network Change the hostname (FQDN and alias) in /etc/hosts Run /bin/hostname new_hostname for the hostname change to take effect immediately. Run /sbin/service syslog restart for syslog to log using the new hostname. A reboot is not required to change the system hostname, of course you should reboot in order to ...


9

localhost.example.com is sometimes included on internal DNS servers to prevent "localhost" requests leaking out to the internet (for the case where John Smith types http://localhost/ in his browser & for whatever reason his resolver doesn't look in the hosts file, appends his search path (example.com) & starts asking name servers what that resolves ...


9

No. It is possible to send data as fake 127.0.0.1, but the reply will go "out" (stay inside actually) the loopback interface, and be 'lost'. If there is a router on the way, it will send the packet through it's own loopback interface, and it will be lost there.


8

I found the problem. The /etc/hosts file had overly restrictive permissions -rw------ (I believe that is 600 octal). Changing that to mode 644 fixed the problem. My tests with ping were done with ordinary priv, and the hosts file was unreadable. My original problem was getting postgresql to startup properly; it starts with root privilege, but apparently ...


7

The page "It Works" is the default apache Vhost. If you are getting this, it has nothing to do with the hosts file. Will need more information on the url you are trying to access and what you expect to happen.


7

What I did to disable local delivery. I'll be using the example.com domain. Requirements: example.com A entry pointing to IP address assigned to one of the eth interfaces. /etc/hosts defining example.com assigned to the very same IP address as above example.com MX records pointing to Google servers (ASPMX.L.GOOGLE.COM, etc) default sendmail installation (...


7

To access the server from itself, use http://localhost/ or http://127.0.0.1/. To access the server from a separate computer on the same network, use http://192.168.X.X where X.X is your server's local IP address. You can find the sever's local IP address (assuming it's Linux) by running hostname -I.


7

Nothing is blocking port 80. You just have firewall NAT rules which are redirecting connections to that port to other ports, which aren't open. Chain PREROUTING (policy ACCEPT 1 packets, 40 bytes) pkts bytes target prot opt in out source destination 0 0 REDIRECT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 ...


7

It's probably not going to break much of anything on your local machine, assuming no Windows domain nor DHCP is involved. However, the identifier 'localhost' specifically and always is defined to mean the local machine. This means that any other computer that wants to connect to you by name will be unable to do so, because attempting to connect to '...


6

The hostname www.circle.nu is mapped to IP address 0.0.0.0 in their DNS. 0.0.0.0 is usually interpreted as the "default network", and in your case that's why you're getting sent to localhost.



Only top voted, non community-wiki answers of a minimum length are eligible