Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I don't have $localhost set on my system either - that doesn't mean you have it set up wrongly. If you need the variable set for one of your applciations you can export it from (for example) ~/.bash_profile
If that's not what you meant - can you post more info about what you're trying to do please?
I don't have $localhost set on my system either - that doesn't mean you have it set up wrongly. If you need the variable set for one of your applciations you can export it from (for example) ~/.bash_profile
If that's not what you meant - can you post more info about what you're trying to do please?
Thanks Gilead
I'm trying to run a ruby application and it fails. From what i read online it said that the problem might be because localhost isn't setup properly
and hence the question
The entry you have in /etc/hosts is enough for communicating with the local host. As long as your ruby app is trying to access either localhost or 127.0.0.1 it should be fine - anything else will resolve as a remote host (unless you have DNS entries pointing back to that box). Are you getting a "getaddrinfo" error?
You have not provided enough information. What is the intent of your application? socket programming, HTML etc.
localhost references the network local loopback adapter (lo) i.e. 127.0.0.1 on each TCP/IP computer. In a nutshell lo lets you run network server/client apps on the same computer. For example if running a webserver you can view the default page on the same computer by typing http://localhost in a web browser.
$localhost is a shell variable, this is not what you want. When you run a network-aware program such as ping,telnet,ssh etc and you provide a *hostname* rather than an IP address, i.e. ping localhost with no '$' in front, it will first try to look at /etc/hosts to see if there is an entry in there to see what the IP address is. If that hostname does not exist in /etc/hosts it will then do a DNS query to see if it can find out what the IP address is.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.