host names, network names and IP addresses - Mandriva
This is a discussion on host names, network names and IP addresses - Mandriva ; On Sat, 11 Aug 2007 23:03:06 -0400, Peter D. wrote:
> Presumably the hostname is rolled back to its previous value
> when that interface goes down.
Haven't tried it, and don't feel like digging through the scripts
right now, ...
-
Re: host names, network names and IP addresses
On Sat, 11 Aug 2007 23:03:06 -0400, Peter D. wrote:
> Presumably the hostname is rolled back to its previous value
> when that interface goes down.
Haven't tried it, and don't feel like digging through the scripts
right now, to see.
>
>> It may also be changed by other "helper" scripts. This is one aspect
>> that has changed, with different versions. New helper scripts, keep
>> hiding what they're doing, and where things need to be set.
>>
> So the sane application randomly chooses one and uses it until
> an error or a timeout occurs, then it uses another?
That varies depending on the application. Some browsers will try
the addresses, in the order received, some will only try the
first address. I've found at time, using opera, I had to specify
the ip address, when the first address returned was not responding.
Regards, Dave Hodgins
--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
-
Re: host names, network names and IP addresses
on Monday 13 August 2007 01:34
in the Usenet newsgroup alt.os.linux.mandriva
Bit Twister wrote:
> On Sun, 12 Aug 2007 18:02:39 +1000, Peter D. wrote:
>>
>> I also can type "host 96.226.25.1" and get the same result, but I don't
>> know what it means. (I've had a look at the man page.) The DNS system
>> has a mapping between "96.226.25.1" and "1.25.226.96.in-addr.arpa"?
>> Or between "96.226.25.1" and "L100.VFTTP-33.DLLSTX.verizon-gni.net"?
>
> It is a mapping defined by verizon's dns servers.
So, the information in Verizon's dns servers has not propagated
to my ISP's dns servers. Should it? I don't think that I want
to use either of those long names.
>> I can't ping either, but I can ping 96.22.25.1. Is that you?
>
> No, it is verizon's gateway node I used to get to the internet.
> In other words, it was the first node upstream of my modem.
> If you check this post's header, you will see that my node is
> 71.170.249.83
>
> By the way, now that they forced a new lease upon me, I have this new
> ip address and use a different gateway. Seems the old 96.22.25.x was
> keeping me from accessing www.mozilla.com.
--
sig goes here...
Peter D.
-
Re: host names, network names and IP addresses
on Sunday 12 August 2007 16:55
in the Usenet newsgroup alt.os.linux.mandriva
Bit Twister wrote:
> On Sun, 12 Aug 2007 13:02:58 +1000, Peter D. wrote:
>> Bit Twister wrote:
[snip]
>> There is no IP address (except 127.0.0.N) that is associated
>> with the host but not associated with one of the interfaces?
>>>
>>> Example 1:
>>> Yes, assuming you threw out something like
>>> 96.226.25.1 isp_gateway
>>> in my /etc/hosts and
[snip]
I think that 96.226.25.1 (isp_gateway) is a node rather than a host.
Only the sysadmin of the host that supports the interface with
IP address 96.226.25.1 knows for sure what the true host name of
that computer is, but for convenience it is probably set to be
the same as one of the node names.
At the moment I think that a host can and does commandeer the IP
address(es) of the node(s) on that host. Also I believe, at the
moment, that a host does not have any IP addresses independent
of nodes. Even 127.0.0.1 belongs to a node that has a virtual
interface. IP addresses belong to nodes not hosts.
But then again, this is making my head hurt. 8-(
--
sig goes here...
Peter D.
-
Re: host names, network names and IP addresses
on Monday 13 August 2007 01:50
in the Usenet newsgroup alt.os.linux.mandriva
Jim Whitby wrote:
> On Sun, 12 Aug 2007 13:03:08 +1000, Peter D. wrote:
[snip]
>> And only one hostname (in long and short forms with or without aliases)
>> The FQDN is typically stored in /etc/HOSTNAME
>
> almost. The name can be either a dotted name or just a name, but not both.
"/bin/hostname -s" is worrying me. From the man page;
-s, --short
Display the short host name. This is the host name
cut at the first dot.
Strangely I can't find any use for the "short host name" unless it
is also an alias. For example I can't ping it.
Perhaps is main use is to confuse people like me.
[snip]
>> "hostname" is only concerned with information above this point.
>>
>
> Not sure what you mean.
This point in the post.
The command /bin/hostname gets its its information from /etc/hosts
and is only concerned with data about the host not the nodes
attached to the host.
For my slightly odd /etc/hosts file;
# /etc/hosts Peter,
127.0.0.1 live.home.invalid silly_name localhost
192.168.1.1 nb.home.invalid modem
192.168.1.2 on_board.home.invalid M2007
192.168.2.1 card.test.invalid M2007
192.168.2.2 x2.test.invalid
hostname; hostname -s; hostname -a; hostname -i; hostname -f; hostname -d;
hostname -y
gives...
live.home.invalid
live
silly_name localhost
127.0.0.1
live.home.invalid
home.invalid
(none)
Even though both 192.168.1.2 and 192.168.2.1 are in this host.
And it only finds the information that it does because I happened
to set the host name to be the same as one of the node names.
>> Names and numbers below this point might, or might not, be the same as
>> names and numbers above this point.
>>
>
> Above/below what?
Below this point in the post I was writing about nodes, which
/bin/hostname does not seem to care about.
The stuff in "man 2 uname" suggests that somebody is a little
confused about hosts and nodes.
I'm guessing, but maybe /bin/hostname and /bin/uname start
with the environment variable HOSTNAME, search /etc/hosts,
can't find Mandriva specific configuration in /etc/sysconfig/
and do the best that they can.
[snip]
>>> A node name *may* point to more than one IP address.
>>
>> You've lost me.
>>
>> host != node
>>
>
> correct. It is reasonable to have a "node name" point to more than one IP
> address.
>
>> Do you mean, a host may multiple interfaces? (And nodes?)
>>
>
> yes. In addition...
> A "node name" may point to multiple hosts, each with a unique IP address.
> As used by many larger web sites (google, mozilla, M$, yahoo and many
> more ). An example:
>
> $ dig www.google.com
[snip]
> In the above, each IP may or maynot be on a different host.
> The DNS server will hand out (probably) a different address each time you
> try to connect.
>
> Try a ping to www.google.com and see what address you get. Then try a
> couple more times.
Is anybody responsible for designing this system, or did it just grow?
Is that one *node* spanning multiple hosts? Or one *node name*
referring to multiple nodes arranged one per host? (Even though
each node is allowed multiple IP addresses?)
[snip]
>>> If you're not totally confused yet, give me some more time.
>>>
>>> jim
I'm trying to collate a summary post - if I can ever get all of
this into a coherent arrangement. Then everyone can tell me
how badly I've got it wrong.
It is somewhat more involved than I first thought.
--
sig goes here...
Peter D.
-
Re: host names, network names and IP addresses
On Wed, 15 Aug 2007 17:23:59 +1000, Peter D. wrote:
>
> I'm trying to collate a summary post - if I can ever get all of this
> into a coherent arrangement. Then everyone can tell me how badly I've
> got it wrong.
>
> It is somewhat more involved than I first thought.
I'll wait for the summary.
-
Re: host names, network names and IP addresses
On Wed, 15 Aug 2007 17:23:59 +1000, Peter D. wrote:
>
> Strangely I can't find any use for the "short host name" unless it
> is also an alias. For example I can't ping it.
What do you mean you can not ping a short/alias name.
Assuming /etc/hosts is on all your systems as follows:
127.0.0.1 live.home.invalid silly_name localhost
192.168.1.1 nb.home.invalid modem
192.168.1.2 on_board.home.invalid on_board
192.168.2.1 card.test.invalid card
192.168.2.2 x2.test.invalid x2
a user on x2 should be able to
ping -c1 modem
and a user on modem should be able to
ping -c1 x2
That assumes pings are not blocked by firewalls.
-
Re: host names, network names and IP addresses
on Wednesday 15 August 2007 21:22
in the Usenet newsgroup alt.os.linux.mandriva
Bit Twister wrote:
> On Wed, 15 Aug 2007 17:23:59 +1000, Peter D. wrote:
>>
>> Strangely I can't find any use for the "short host name" unless it
>> is also an alias. For example I can't ping it.
>
> What do you mean you can not ping a short/alias name.
>
> Assuming /etc/hosts is on all your systems as follows:
>
> 127.0.0.1 live.home.invalid silly_name localhost
> 192.168.1.1 nb.home.invalid modem
> 192.168.1.2 on_board.home.invalid on_board
> 192.168.2.1 card.test.invalid card
> 192.168.2.2 x2.test.invalid x2
>
>
> a user on x2 should be able to
> ping -c1 modem
> and a user on modem should be able to
> ping -c1 x2
>
> That assumes pings are not blocked by firewalls.
I am sitting in front of live.home.invalid. (It has two Ethernet
ports, on_board.home.invalid and card.test.invalid, but we're
not interested in them at the moment.)
The output of "hostname -f" (the FQDN) is an acceptable input for ping.
The output of "hostname -a" (aliases) are acceptable inputs for ping.
The output of "hostname -s" (the short host name) is not OK for ping.
Here is a cut'n'past. Ignore the long two like prompt.
[live] /etc
->hostname -s
live
[live] /etc
->ping -c1 -q live
ping: unknown host live
[live] /etc
->hostname -f
live.home.invalid
[live] /etc
->ping -c1 -q live.home.invalid
PING live.home.invalid (127.0.0.1) 56(84) bytes of data.
--- live.home.invalid ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.067/0.067/0.067/0.000 ms
[live] /etc
->hostname -a
silly_name localhost
[live] /etc
->ping -c1 -q silly_name
PING live.home.invalid (127.0.0.1) 56(84) bytes of data.
--- live.home.invalid ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.066/0.066/0.066/0.000 ms
I could easily add the short host name (live) as another alias
for the host name (live.home.invalid) in /etc/hosts. I was
just wondering what is the use of "hostname -s". Does it
show up that often in networking scripts?
--
sig goes here...
Peter D.
-
Re: host names, network names and IP addresses
On Wed, 15 Aug 2007 08:45:39 -0400, Peter D. wrote:
> I could easily add the short host name (live) as another alias
> for the host name (live.home.invalid) in /etc/hosts. I was
> just wondering what is the use of "hostname -s". Does it
> show up that often in networking scripts?
Seems to be very rarely used. The only script I've found it used in is
/etc/csh.cshrc: set prompt=\[`id -nu`@`hostname -s`\]\$\
which, of course is not a network script.
Regards, Dave Hodgins
--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
-
Re: host names, network names and IP addresses
On Wed, 15 Aug 2007 22:45:39 +1000, Peter D. wrote:
> ->ping -c1 -q live
> ping: unknown host live
Yep, you do not have an alias *live* in /etc/hosts
> I could easily add the short host name (live) as another alias
> for the host name (live.home.invalid) in /etc/hosts.
That is what it would take to ping live.
> I was just wondering what is the use of "hostname -s".
You use it anytime you want the short name. For instance on my
multiboot systems, I do not want some cron jobs to to run.
Those scripts are shared accross installs.
They do a test for a flag file cron.lock_$(hostname -s)
and if exists, exit 0.
$ ls cron*
cron.lock_2006oe cron.lock_fc7 cron.lock_kubuntu cron.lock_ubuntu
cron.lock_2007 cron.lock_fw cron.lock_m2007 cron.lock_wb1
cron.lock_beta cron.lock_hotbu cron.lock_scsi cron.lock_wb4
cron.lock_fc4 cron.lock_kubu6 cron.lock_suse
I also use the lock file to to keep disk audit scripts from running when
I am using k3b.
$ cat /local/bin/k3b
#************************************************* ****
#* k3b wrapper to disable cron jobs before running k3b
#************************************************* ****
/local/bin/cronlock start
xmessage "Do a
cronlock stop
when done with k3b
" &
/usr/bin/k3b
#***************** end k3b ******************************
#!/bin/bash
#************************************************* *************
#*
#* cronlock - create/delete/check cron lock file
#*
#* Usage: cronlock {start|stop|check|status}
#*
#* returns 0 if lock file exists
#*
#* Example:
#* /local/bin/cronlock check
#* if [ $? -eq 0 ]; then
#* exit 0
#* fi
#
#*
#************************************************* *************
_exe=$0
_cmd=$1
_lock_fn=/local/doc/cron.lock_$(hostname -s)
_rtn_code=0
if [ -z "$_cmd" ] ; then
_cmd="no command given"
fi
case "$_cmd" in
check) # return o if exist, 1 if not
if [ -e $_lock_fn ] ; then
_rtn_code=0
else
_rtn_code=1
fi
;;
start) # create lock file
touch $_lock_fn
;;
status) # tell if lock file exists or not
if [ -e $_lock_fn ] ; then
echo $_lock_fn exists
else
echo $_lock_fn does not exist
fi
;;
stop) # delete lock file
/bin/rm -f $_lock_fn
;;
*)
echo "Usage: $_exe {start|stop|check|status} not -->$_cmd<--"
exit 1
;;
esac
exit $_rtn_code
#**************** end cronlock *****************************
> Does it show up that often in networking scripts?
Take a look for yourself,
su - root
grep -r "hostname \-s" /etc/sysconfig/network-scripts/*
grep -r "hostname \-s" /etc/init.d/*
-
Re: host names, network names and IP addresses SUMMARY
on Tuesday 07 August 2007 22:46
in the Usenet newsgroup alt.os.linux.mandriva
Peter D. wrote:
> Hi,
>
> There is some confusion (to me) about the relationship between
> host names, IP addresses and things.
[snip]
After a long and convoluted thread with several knowledgeable
and patient gurus, I think that I understand it...
A computer running a TCP/IP stack is a host and has a host name.
A physical computer might, or might not, support one or more
virtual computers. Each may have a host name.
A host name might be short (without any dots) or long (with
dots). A long (dotted) name is preferable, but not necessary.
A host has (by definition) a TCP/IP stack installed and with
that comes a virtual local loopback interface with an IP address
of 127.0.0.1.
A host (real or virtual) might, or might not, have a physical
network interface. Either way it is still a host and has a
host name.
A host has only one host name. It might, or might not, have aliases.
A host is sometimes referred to by its "short host name". The
command "hostname -s" returns the first part of the host name
up to the first dot. The output of "hostname -s" is sometimes used
by script writers, but of little use to other people.
The combination of a network interface (real or virtual) and
an IP address constitutes a node. A node might, or might not,
have a name and aliases. The default name for the node with
the IP address of 127.0.0.1 is "localhost".
A host may have zero or more physical network interfaces.
A network interface many have zero or more IP addresses.
A network interface with one or more IP addresses is a node.
A node may have a node name.
A node name may have aliases.
A node name may have more than one IP address and those IP
addresses might be on different hosts. Consider .
A host does not directly have any IP addresses, not even 127.0.0.1,
although it can have nodes which can have IP addresses.
When a host has one or more nodes the host name is usually, but
not necessarily, set to be the same as one of the node names.
Configuration data might be in all sorts of strange places such as;
the environment variable HOSTNAME, /etc/HOSTNAME, /etc/hosts,
/etc/sysconfig/network and /etc/sysconfig/network-scripts/*
Names and numbers can change while the system is running. If
you have hot pluggable hardware I guess that even the number
of interfaces can change.
This quote from "man 2 uname" is interesting;
"On the other hand, the field nodename is meaningless:
it gives the name of the present machine in some
undefined network, but typically machines are in more
than one network and have several names.
No wonder everyone is confused.
Then again, I could be completely wrong. ;-)
--
sig goes here...
Peter D.
-
Re: host names, network names and IP addresses SUMMARY
On Wed, 29 Aug 2007 09:12:15 -0400, Peter D. wrote:
> A host has (by definition) a TCP/IP stack installed and with
> that comes a virtual local loopback interface with an IP address
> of 127.0.0.1.
One more twist for you.
While the loopback address is normally specificied as 127.0.0.1, anything
starting with 127, is also a loopback ip address. So, directing your
browser to http://127.212.233.123 will return exactly the same as
going to http://127.0.0.1
Regards, Dave Hodgins
--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)