Re: [Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-20 Thread Victor Churchill
(Sorry, I am a bit behind the wave here... :)

On 17 August 2013 22:09, Ralph Corderoy ra...@inputplus.co.uk wrote:

 OK, that means jd-Dimension-5000 could be turned into an IP address but
 no SSH daemon was listening on the default port of 22 so the machine
 clearly responded with a nothing's listening, connection refused.  So
 jd-Dimension-5000 didn't become the 192.168.1.5 you give above but
 something else;  something that doesn't run sshd on port 22.

 To find out what you could use strace to observe the connect(2) system
 call that's getting the error from the kernel.  That will show the IP
 address that ssh has already worked out as it is passed to the kernel.
 Here, I've pretended it's 1.2.3.4.  Other connects might fail beforehand
 but they aren't interesting ones so I've elided them.


If I want to know where my system thinks SomeHostName is then I would
either grep SomeHostName /etc/hosts or ping SomeHostName - striles me as
less noisy than doing strace.

On another tack I was disgusted to discover that the Belkin router (which I
bought in a hurry from PCW one Sunday when my Buffalo died):
a) has a horrible HTTP control interface ...
b) ... which does not allow mapping of fixed IP addresses to MAC addresses
...
c) ... and has *lousy* logging and log-searching ...
d) and is not on the list of devices yu can flash DD-WRT onto :(
Buy in haste, repent at leisure.







-- 
best regards,

Victor Churchill,
Bournemouth
-- 
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-20 Thread Ralph Corderoy
Hi Victor,

  To find out what you could use strace to observe the connect(2)
  system call that's getting the error from the kernel.  That will
  show the IP address that ssh has already worked out as it is passed
  to the kernel.
 
 If I want to know where my system thinks SomeHostName is then I would
 either grep SomeHostName /etc/hosts or ping SomeHostName - striles me
 as less noisy than doing strace.

Agreed, but it would also be skipping ssh-specific stuff that might
change the IP address used, e.g.  ~/.ssh/config, and I thought it best
to see what the kernel is asked to do since it's where the connection
refused reply eminates.  :-)

Cheers, Ralph.

-- 
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-18 Thread Keith Edmunds
On Sun, 18 Aug 2013 05:56:07 +0100, bob.dun...@xyzzy.org.uk said:

 A static IP address can be configured by the router using DHCP

What Ralph said, correctly, was, Perhaps what John's friend was
suggesting it to configure the DHCP server on the router to always give a
particular IP address out to a particular MAC address. That of course
works; we too use that feature a lot, but as Ralph also points out, if the
MAC address changes, the static IP becomes dynamic.

Whether you consider the allocation of a specific IP to a specific MAC
address as a static IP is more of a semantic question than a technical
one.
-- 
You can't live a perfect day without doing something for someone 
who will never be able to repay you.

-- 
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-17 Thread JD
Message: 3 Date: Mon, 12 Aug 2013 14:32:39 +0100 From: Andrew 
zil...@ziltro.com To: dorset@mailman.lug.org.uk Subject: Re: [Dorset] 
Can I use hostnames with ssh without editing /etc/hosts Message-ID: 
5208e3f7.1050...@ziltro.com Content-Type: text/plain; charset=UTF-8; 
format=flowed On 12/08/2013 14:04, JD wrote:

My problem is that I would like to use hostnames and not IP addresses
when linking between 3 Linux computers that are just connected via my
router.

The router has the correct hostname for each computer but I get a
refusal if I try, say, jd@jd-Dimension-5000, whereas jd@192.168.1.5
works.  In principle, the IP addresses change so I'd rather use
hostnames.  I admit that the IP addresses don't change very often, but
I turn the router off whenever I go away so the addresses get
reassigned and that is a pain.




Thanks for the suggestions.  Andrew's recommendation - use hostname.local 
does work so I shall use that.

For completeness:
Ralph, the failure message was ssh: connect to host 
jd-Dimension-5000 port 22: Connection refused.
Tim, I want to use my Pi for many other projects, some on the 'bare 
metal' so I won't make it the DNS.
I've also had a suggestion from a friend here in very rural Dorset. 
Configure my router to allocate static IP addresses.  This seems to be 
possible with the Huawei but the GUI is tortuous and there is no manual.


John
PS The above looks a bit of a mess.  How should I reply to replies?



--
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-17 Thread Peter Merchant


Tim, I want to use my Pi for many other projects, some on the 
'bare metal' so I won't make it the DNS.
I've also had a suggestion from a friend here in very rural Dorset. 
Configure my router to allocate static IP addresses.  This seems to be 
possible with the Huawei but the GUI is tortuous and there is no manual.




Whoa!!! You don't configure static IP addresses at the router. They are 
done on the individual hosts/devices.


My router is 192.168.1.1,

I have DHCP set up for 192.168.1.2 -- 192.168.1.8 and my Raspberry Pi 
set up to a fixed IP address of 192.168.1.11. This computer used to be 
DHCP but is now fixed at 192.168.1.12 as it is the connection for a 
shared printer on my network.


I ended up fixing the IP address of the RPi because I hated having to 
find it out every time I wanted to ssh into it.


FWIW my netmask is 255.255.255.240   This limits the range of static IP 
addresses that you can use.


Peter

--
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-17 Thread Ralph Corderoy
Hi Peter,

  I've also had a suggestion from a friend here in very rural Dorset.
  Configure my router to allocate static IP addresses.
 
 Whoa!!! You don't configure static IP addresses at the router.  They
 are done on the individual hosts/devices.

Perhaps what John's friend was suggesting it to configure the DHCP
server on the router to always give a particular IP address out to a
particular MAC address when it comes calling.  That way, all the other
devices continue with their default of using DHCP to obtain an IP
address but they happen to be given the same one each time.  Well, until
you upgrade the motherboard and the MAC address changes.

Cheers, Ralph.

-- 
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-17 Thread Ralph Corderoy
Hi John,

   The router has the correct hostname for each computer but I get a
   refusal if I try, say, jd@jd-Dimension-5000, whereas
   jd@192.168.1.5 works.
 
 Ralph, the failure message was ssh: connect to host jd-Dimension-5000
 port 22: Connection refused.

OK, that means jd-Dimension-5000 could be turned into an IP address but
no SSH daemon was listening on the default port of 22 so the machine
clearly responded with a nothing's listening, connection refused.  So
jd-Dimension-5000 didn't become the 192.168.1.5 you give above but
something else;  something that doesn't run sshd on port 22.

To find out what you could use strace to observe the connect(2) system
call that's getting the error from the kernel.  That will show the IP
address that ssh has already worked out as it is passed to the kernel.
Here, I've pretended it's 1.2.3.4.  Other connects might fail beforehand
but they aren't interesting ones so I've elided them.

$ strace -e connect ssh jd-Dimension-5000
...
connect(3, {sa_family=AF_INET, sin_port=htons(22),
sin_addr=inet_addr(1.2.3.4)}, 16) = -1 ECONNREFUSED (Connection 
refused)
ssh: connect to host jd-Dimension-5000 port 22: Connection refused
$

The IP address ssh it uses might give a clue.  The other place to look
is 

$ cat /etc/host.conf
# The order line is only used by old versions of the C library.
order hosts,bind
multi on
$

which normally says that /etc/hosts should be consulted before trying
the bind method.  Perhaps /etc/hosts contains an old definition for
jd-Dimension-5000?

 PS The above looks a bit of a mess.  How should I reply to replies?

It wasn't too bad.  You deleted a lot of the extra stuff.  I'm not too
sure what to suggest other than watch what others do and see what you
like and dislike.  Many just type their lines at the top, where the
cursor is initially placed, without deleting any of the ever-growing
quoted reply that follows.  :-)

Cheers, Ralph.

-- 
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-17 Thread Bob Dunlop
Hi,

On Sat, Aug 17 at 08:44, Peter Merchant wrote:
...
 Whoa!!! You don't configure static IP addresses at the router. They are 
 done on the individual hosts/devices.

A static IP address can be configured by the router using DHCP in fact I
find this a very useful feature of DHCP.  All my portable devices are
configured as DHCP clients to get dynamic addresses from any network
they are on.  When on the home network, the home router supplies them
with static addresses via DHCP so I can easily access them.

All the machines at work (and we have hundreds) have static addresses
assigned via DHCP from a central router.  If we need to reconfigure the
network we'd only need to hit the one server rather than manually
reconfigure each individual machine.  Dynamic addresses are only issued
in a narrow range for guest devices and this is used as a big security
hint to various firewalls and servers.

-- 
Bob Dunlop

-- 
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue


[Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-12 Thread JD
Thanks to several people who have given links for cross-compiling to a 
Pi, e.g. the toolchain and the Baking Pi tutorials.


My problem is that I would like to use hostnames and not IP addresses 
when linking between 3 Linux computers that are just connected via my 
router.


The router has the correct hostname for each computer but I get a 
refusal if I try, say, jd@jd-Dimension-5000, whereas jd@192.168.1.5 
works.  In principle, the IP addresses change so I'd rather use 
hostnames.  I admit that the IP addresses don't change very often, but I 
turn the router off whenever I go away so the addresses get reassigned 
and that is a pain.


BTW, the router is a Huawei and I get the IP addresses from the DHCP page.

Thanks,
John

--
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-12 Thread Tim Allen

Hi John


On 12/08/13 14:04, JD wrote:

Thanks to several people who have given links for cross-compiling to a
Pi, e.g. the toolchain and the Baking Pi tutorials.

My problem is that I would like to use hostnames and not IP addresses
when linking between 3 Linux computers that are just connected via my
router.

The router has the correct hostname for each computer but I get a
refusal if I try, say, jd@jd-Dimension-5000, whereas jd@192.168.1.5
works. In principle, the IP addresses change so I'd rather use
hostnames. I admit that the IP addresses don't change very often, but I
turn the router off whenever I go away so the addresses get reassigned
and that is a pain.

BTW, the router is a Huawei and I get the IP addresses from the DHCP page.



There's nothing to stop you using your Pi as a DNS and DHCP server - you 
then have full control. I'm using a Pi for exactly this with Bind and 
ISC DHCP server. You can assign static IP's on the clients or stick to 
DHCP and have ISC DHCP server assign then based on the client MAC's.



Cheers

Tim

--
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-12 Thread Andrew

On 12/08/2013 14:04, JD wrote:
My problem is that I would like to use hostnames and not IP addresses 
when linking between 3 Linux computers that are just connected via my 
router.


The router has the correct hostname for each computer but I get a 
refusal if I try, say, jd@jd-Dimension-5000, whereas jd@192.168.1.5 
works.  In principle, the IP addresses change so I'd rather use 
hostnames.  I admit that the IP addresses don't change very often, but 
I turn the router off whenever I go away so the addresses get 
reassigned and that is a pain.




Does hostnale.local work? Eg. jd-Dimension-5000.local?

--

Andrew.



--
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue


Re: [Dorset] Can I use hostnames with ssh without editing /etc/hosts

2013-08-12 Thread Ralph Corderoy
Hi John,

 The router has the correct hostname for each computer but I get a
 refusal if I try, say, jd@jd-Dimension-5000, whereas jd@192.168.1.5
 works.

By refusal do you mean connection refused?  It would help us if you
paste the shell line where you attempt it up to the next shell prompt.

Does ping with one of the IP addresses work, e.g. ping 192.168.1.5?
If so, does it with using respective hostname instead?

Cheers, Ralph.

-- 
Next meeting:  Bournemouth, Tuesday, 2013-08-06 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread on mailing list:  mailto:dorset@mailman.lug.org.uk
How to Report Bugs Effectively:  http://goo.gl/4Xue