What does /etc/hosts do in linux? [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I understand domain names here will resolve to the IP shown on the left. But can someone elaborate on this subject and explain what each column does? From what I found, ::1 is IPv6 shorthand?
[root#stack]# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 stack.corp.com stack localhost6.localdomain6 localhost6
Thanks!

The first field is the IP address, the second the canonical host name, and any remaining fields are just aliases that will also resolve to the IP address in the first field.
::1 is, indeed, an IPv6 address, which is short for
0000:0000:0000:0000:0000:0000:0000:0001
(the :: stands in for as many zeros as possible while making the result a valid IPv6 address).

Related

Ping cannot expand address alias when specifying interface [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed yesterday.
Improve this question
Ping cannot expand an alias (foo) if ALSO specifying an interface (enp5s0f1):
> ping foo%enp5s0f1
ping: foo%enp5s0f1: Name or service not known
I have this alias in /etc/hosts:
fe80:<snip>:dc57 foo
It works when I use the IP instead of the alias:
> ping fe80:<snip>:dc57%enp5s0f1
PING fe80:<snip>:dc57%enp5s0f1(fe80:<snip>:dc57%enp5s0f1) 56 data bytes
It also works if I just use the alias:
> ping foo
PING foo(foo (fe80:<snip>:dc57)) 56 data bytes
I don't understand why the combination of alias AND interface fails.

what does -d 0/0 mean? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 4 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I came across a rule:
iptables -A INPUT -p tcp -s 17.3.3.5/24 -d 0/0 --dport 22 -j DROP
and I was just wondering if someone could explain what this rule is doing. More importantly, I would like to know what the
-d 0/0
part means, in the whole rule (I know its destination specification, so the 0/0 part should be an IP address, but why is it 0/0?).
Im speculating that the rule is dropping that one source address when it arrives at destination port 22, but I'm not sure.
If someone could explain, that would be great.
Couldn't find an answer when searching the interwebs :C
Just like -s 17.3.3.5/24 means any source within the CIDR block 17.3.3.5/24, -d 0/0 means any destination within the CIDR block 0.0.0.0/0. Since there are no bits in the network number, every address is inside this network. So it means any destination at all.

What are all the Flag Values from ARP Cache entries? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
When running "arp -a" on a linux machine, one of the values for each entry returned is "Flags." I've seen 0x0, 0x2, and 0x6 as possible values. All I have gathered so far is that 0x6 represents a permanent (ie: static and not dynamic) entry.
Is there a list somewhere of all of the possible flags for an arp cache entry? Can there ever be more than one flag for an entry?
The answer can be found here (the question "Definition of Arp result flags?"): https://superuser.com/a/822089

How to get the previous hostname of my linux system? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have accidentally changed my system to host name. Now i want to change it to my previous host name. But i don't know the previous host name.
Have a look at these files:
/etc/hostname
/etc/hosts
/etc/ssh/ssh_host_*_key.pub
$HOME/.ssh/id_*.pub
In these typically the host name appears and it might be still unchanged by your renaming action (however you did that).
Also these might contain the old name:
/var/log/Xorg.failsafe.log
/var/log/auth.log.1
/var/log/pm-suspend.log.1
/var/log/Xorg.1.log.old
/var/log/lightdm/x-0.log
/var/log/lightdm/x-1.log
/var/log/lightdm/x-2.log
/var/log/pm-suspend.log
/var/log/Xorg.0.log.old
/var/log/Xorg.1.log
/var/log/syslog
/var/log/Xorg.2.log
/var/log/auth.log
/var/log/kern.log.1
/var/log/kern.log
/var/log/Xorg.failsafe.log.old
/var/log/syslog.1
/var/log/Xorg.0.log
In most cases HOSTNAME is defined in /etc/sysconfig/network file, to be set when boot. In some cases you can find it in /etc/hostname

When I type `route -n` into the Mac terminal, why doesn't it show a routing table? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I read in "TCP/IP Network Administration" by O'Reilly, 2002, that typing the route -n command should bring up a routing table.
When I typed it into the terminal on a Mac, it returned the following:
usage: route [-dnqtv] command [[modifiers] args]
What is the correct command to use to see the routing table in my terminal?
On Mac OS X you can use netstat(1). In your case, netstat -nr, probably.

Resources