Can't ping localhost
I have an issue with the localhost
alias. It doesn't work. Basically, no program can resolve localhost
to 127.0.0.1
. The alias is in /etc/hosts
:
[root@gabriel-notebook gpoesia]# cat /etc/hosts
#
# /etc/hosts: static lookup table for host names
#
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost gabriel-notebook
::1 localhost ip6-localhost ip6-loopback
# End of file
Also, myhostname
is enabled in /etc/nsswitch.conf
:
[root@gabriel-notebook gpoesia]# cat /etc/nsswitch.conf
# Begin /etc/nsswitch.conf
passwd: compat mymachines systemd
group: compat mymachines systemd
shadow: compat
publickey: files
hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname
networks: files
protocols: files
services: files
ethers: files
rpc: files
netgroup: files
# End /etc/nsswitch.conf
And localhost shows up in getent hosts
. Also, /etc/hostname
is set.
[root@gabriel-notebook gpoesia]# getent hosts
127.0.0.1 localhost.localdomain localhost gabriel-notebook
127.0.0.1 localhost ip6-localhost ip6-loopback
[root@gabriel-notebook gpoesia]# getent hosts gabriel-notebook
127.0.0.1 localhost.localdomain localhost gabriel-notebook
[root@gabriel-notebook gpoesia]# cat /etc/hostname
gabriel-notebook
[root@gabriel-notebook gpoesia]# hostname
gabriel-notebook
However, ping localhost
doesn't work.
[root@gabriel-notebook gpoesia]# ping localhost
ping: localhost: Name or service not known
The main difficulty is I don't know exactly when this started to happen. I remember it working in the past, but I can't tell what caused it to break. Googling around didn't help. I've found people with the same issue caused by reasons that don't hold for me (such as corrupted files, wrong syntax in /etc/hostname
, etc).
Any ideas?
Thanks!
networking arch-linux dns ping
bumped to the homepage by Community♦ 9 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have an issue with the localhost
alias. It doesn't work. Basically, no program can resolve localhost
to 127.0.0.1
. The alias is in /etc/hosts
:
[root@gabriel-notebook gpoesia]# cat /etc/hosts
#
# /etc/hosts: static lookup table for host names
#
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost gabriel-notebook
::1 localhost ip6-localhost ip6-loopback
# End of file
Also, myhostname
is enabled in /etc/nsswitch.conf
:
[root@gabriel-notebook gpoesia]# cat /etc/nsswitch.conf
# Begin /etc/nsswitch.conf
passwd: compat mymachines systemd
group: compat mymachines systemd
shadow: compat
publickey: files
hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname
networks: files
protocols: files
services: files
ethers: files
rpc: files
netgroup: files
# End /etc/nsswitch.conf
And localhost shows up in getent hosts
. Also, /etc/hostname
is set.
[root@gabriel-notebook gpoesia]# getent hosts
127.0.0.1 localhost.localdomain localhost gabriel-notebook
127.0.0.1 localhost ip6-localhost ip6-loopback
[root@gabriel-notebook gpoesia]# getent hosts gabriel-notebook
127.0.0.1 localhost.localdomain localhost gabriel-notebook
[root@gabriel-notebook gpoesia]# cat /etc/hostname
gabriel-notebook
[root@gabriel-notebook gpoesia]# hostname
gabriel-notebook
However, ping localhost
doesn't work.
[root@gabriel-notebook gpoesia]# ping localhost
ping: localhost: Name or service not known
The main difficulty is I don't know exactly when this started to happen. I remember it working in the past, but I can't tell what caused it to break. Googling around didn't help. I've found people with the same issue caused by reasons that don't hold for me (such as corrupted files, wrong syntax in /etc/hostname
, etc).
Any ideas?
Thanks!
networking arch-linux dns ping
bumped to the homepage by Community♦ 9 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Output ofls -l /etc/hosts /etc/nsswitch.conf
andip addr show
please. (In your question, naturally.)
– roaima
Jul 1 '17 at 23:02
add a comment |
I have an issue with the localhost
alias. It doesn't work. Basically, no program can resolve localhost
to 127.0.0.1
. The alias is in /etc/hosts
:
[root@gabriel-notebook gpoesia]# cat /etc/hosts
#
# /etc/hosts: static lookup table for host names
#
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost gabriel-notebook
::1 localhost ip6-localhost ip6-loopback
# End of file
Also, myhostname
is enabled in /etc/nsswitch.conf
:
[root@gabriel-notebook gpoesia]# cat /etc/nsswitch.conf
# Begin /etc/nsswitch.conf
passwd: compat mymachines systemd
group: compat mymachines systemd
shadow: compat
publickey: files
hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname
networks: files
protocols: files
services: files
ethers: files
rpc: files
netgroup: files
# End /etc/nsswitch.conf
And localhost shows up in getent hosts
. Also, /etc/hostname
is set.
[root@gabriel-notebook gpoesia]# getent hosts
127.0.0.1 localhost.localdomain localhost gabriel-notebook
127.0.0.1 localhost ip6-localhost ip6-loopback
[root@gabriel-notebook gpoesia]# getent hosts gabriel-notebook
127.0.0.1 localhost.localdomain localhost gabriel-notebook
[root@gabriel-notebook gpoesia]# cat /etc/hostname
gabriel-notebook
[root@gabriel-notebook gpoesia]# hostname
gabriel-notebook
However, ping localhost
doesn't work.
[root@gabriel-notebook gpoesia]# ping localhost
ping: localhost: Name or service not known
The main difficulty is I don't know exactly when this started to happen. I remember it working in the past, but I can't tell what caused it to break. Googling around didn't help. I've found people with the same issue caused by reasons that don't hold for me (such as corrupted files, wrong syntax in /etc/hostname
, etc).
Any ideas?
Thanks!
networking arch-linux dns ping
I have an issue with the localhost
alias. It doesn't work. Basically, no program can resolve localhost
to 127.0.0.1
. The alias is in /etc/hosts
:
[root@gabriel-notebook gpoesia]# cat /etc/hosts
#
# /etc/hosts: static lookup table for host names
#
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost gabriel-notebook
::1 localhost ip6-localhost ip6-loopback
# End of file
Also, myhostname
is enabled in /etc/nsswitch.conf
:
[root@gabriel-notebook gpoesia]# cat /etc/nsswitch.conf
# Begin /etc/nsswitch.conf
passwd: compat mymachines systemd
group: compat mymachines systemd
shadow: compat
publickey: files
hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname
networks: files
protocols: files
services: files
ethers: files
rpc: files
netgroup: files
# End /etc/nsswitch.conf
And localhost shows up in getent hosts
. Also, /etc/hostname
is set.
[root@gabriel-notebook gpoesia]# getent hosts
127.0.0.1 localhost.localdomain localhost gabriel-notebook
127.0.0.1 localhost ip6-localhost ip6-loopback
[root@gabriel-notebook gpoesia]# getent hosts gabriel-notebook
127.0.0.1 localhost.localdomain localhost gabriel-notebook
[root@gabriel-notebook gpoesia]# cat /etc/hostname
gabriel-notebook
[root@gabriel-notebook gpoesia]# hostname
gabriel-notebook
However, ping localhost
doesn't work.
[root@gabriel-notebook gpoesia]# ping localhost
ping: localhost: Name or service not known
The main difficulty is I don't know exactly when this started to happen. I remember it working in the past, but I can't tell what caused it to break. Googling around didn't help. I've found people with the same issue caused by reasons that don't hold for me (such as corrupted files, wrong syntax in /etc/hostname
, etc).
Any ideas?
Thanks!
networking arch-linux dns ping
networking arch-linux dns ping
asked Jul 1 '17 at 22:44
Gabriel
1063
1063
bumped to the homepage by Community♦ 9 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 9 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Output ofls -l /etc/hosts /etc/nsswitch.conf
andip addr show
please. (In your question, naturally.)
– roaima
Jul 1 '17 at 23:02
add a comment |
Output ofls -l /etc/hosts /etc/nsswitch.conf
andip addr show
please. (In your question, naturally.)
– roaima
Jul 1 '17 at 23:02
Output of
ls -l /etc/hosts /etc/nsswitch.conf
and ip addr show
please. (In your question, naturally.)– roaima
Jul 1 '17 at 23:02
Output of
ls -l /etc/hosts /etc/nsswitch.conf
and ip addr show
please. (In your question, naturally.)– roaima
Jul 1 '17 at 23:02
add a comment |
1 Answer
1
active
oldest
votes
Firstly I assume that ping 127.0.0.1
and ping ::1
both work fine (or at least one of them works).
Next I would try ping gabriel-notebook
and ping ip6-localhost
just to rule out the low hanging fruit.
There are a couple nitpicks that could be made with your configuration but nothing that would explain this. For example many argue against putting the name of the local machine as an alias of localhost, but this looks to be a laptop so you probably want it. And the hosts line in your nsswich.conf file looks like the myhostname module will not work right but that is not the issue you are fighting.
The only thing that looks fishy is that getent shows 127.0.0.1 being mapped to both the expected ip4 aliases but also the ip6 aliases. this makes me suspect funky white space in the hosts or nsswitch.conf file (can be checked with hd
) or that the mymachines module is doing something funky. I would check that with getent hosts localhost
.
Given how everything else looks ok, It is time to reach for the tinfoil beanie, and ask If this is a root kit, and a well made one if you didn't notice it until now, why would they screw around with name resolution?
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f374696%2fcant-ping-localhost%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Firstly I assume that ping 127.0.0.1
and ping ::1
both work fine (or at least one of them works).
Next I would try ping gabriel-notebook
and ping ip6-localhost
just to rule out the low hanging fruit.
There are a couple nitpicks that could be made with your configuration but nothing that would explain this. For example many argue against putting the name of the local machine as an alias of localhost, but this looks to be a laptop so you probably want it. And the hosts line in your nsswich.conf file looks like the myhostname module will not work right but that is not the issue you are fighting.
The only thing that looks fishy is that getent shows 127.0.0.1 being mapped to both the expected ip4 aliases but also the ip6 aliases. this makes me suspect funky white space in the hosts or nsswitch.conf file (can be checked with hd
) or that the mymachines module is doing something funky. I would check that with getent hosts localhost
.
Given how everything else looks ok, It is time to reach for the tinfoil beanie, and ask If this is a root kit, and a well made one if you didn't notice it until now, why would they screw around with name resolution?
add a comment |
Firstly I assume that ping 127.0.0.1
and ping ::1
both work fine (or at least one of them works).
Next I would try ping gabriel-notebook
and ping ip6-localhost
just to rule out the low hanging fruit.
There are a couple nitpicks that could be made with your configuration but nothing that would explain this. For example many argue against putting the name of the local machine as an alias of localhost, but this looks to be a laptop so you probably want it. And the hosts line in your nsswich.conf file looks like the myhostname module will not work right but that is not the issue you are fighting.
The only thing that looks fishy is that getent shows 127.0.0.1 being mapped to both the expected ip4 aliases but also the ip6 aliases. this makes me suspect funky white space in the hosts or nsswitch.conf file (can be checked with hd
) or that the mymachines module is doing something funky. I would check that with getent hosts localhost
.
Given how everything else looks ok, It is time to reach for the tinfoil beanie, and ask If this is a root kit, and a well made one if you didn't notice it until now, why would they screw around with name resolution?
add a comment |
Firstly I assume that ping 127.0.0.1
and ping ::1
both work fine (or at least one of them works).
Next I would try ping gabriel-notebook
and ping ip6-localhost
just to rule out the low hanging fruit.
There are a couple nitpicks that could be made with your configuration but nothing that would explain this. For example many argue against putting the name of the local machine as an alias of localhost, but this looks to be a laptop so you probably want it. And the hosts line in your nsswich.conf file looks like the myhostname module will not work right but that is not the issue you are fighting.
The only thing that looks fishy is that getent shows 127.0.0.1 being mapped to both the expected ip4 aliases but also the ip6 aliases. this makes me suspect funky white space in the hosts or nsswitch.conf file (can be checked with hd
) or that the mymachines module is doing something funky. I would check that with getent hosts localhost
.
Given how everything else looks ok, It is time to reach for the tinfoil beanie, and ask If this is a root kit, and a well made one if you didn't notice it until now, why would they screw around with name resolution?
Firstly I assume that ping 127.0.0.1
and ping ::1
both work fine (or at least one of them works).
Next I would try ping gabriel-notebook
and ping ip6-localhost
just to rule out the low hanging fruit.
There are a couple nitpicks that could be made with your configuration but nothing that would explain this. For example many argue against putting the name of the local machine as an alias of localhost, but this looks to be a laptop so you probably want it. And the hosts line in your nsswich.conf file looks like the myhostname module will not work right but that is not the issue you are fighting.
The only thing that looks fishy is that getent shows 127.0.0.1 being mapped to both the expected ip4 aliases but also the ip6 aliases. this makes me suspect funky white space in the hosts or nsswitch.conf file (can be checked with hd
) or that the mymachines module is doing something funky. I would check that with getent hosts localhost
.
Given how everything else looks ok, It is time to reach for the tinfoil beanie, and ask If this is a root kit, and a well made one if you didn't notice it until now, why would they screw around with name resolution?
answered Jul 2 '17 at 0:37
hildred
4,73622137
4,73622137
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f374696%2fcant-ping-localhost%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Output of
ls -l /etc/hosts /etc/nsswitch.conf
andip addr show
please. (In your question, naturally.)– roaima
Jul 1 '17 at 23:02