hostname of the modem gateway

2018-01-01 Thread Max Power
Hi guys,
with the new release of Debian 'Stretch', the route command has been replaced
but what other command returns the hostname of the modem/router gateway...?
# route
gateway = home.telecomitalia.it
# ip route
gateway = 192.168.1.1

Thanks for reply, Max Power.

Re: hostname of the modem gateway

2018-01-01 Thread john doe

On 1/2/2018 12:12 AM, Max Power wrote:

Hi guys,
with the new release of Debian 'Stretch', the route command has been replaced
but what other command returns the hostname of the modem/router gateway...?
# route
gateway = home.telecomitalia.it
# ip route
gateway = 192.168.1.1

Thanks for reply, Max Power.



You could try the host(1) utility:

$ host 192.168.1.1

https://linux.die.net/man/1/host

--
John Doe



Re: hostname of the modem gateway

2018-01-01 Thread David Wright
On Tue 02 Jan 2018 at 06:25:29 (+0100), john doe wrote:
> On 1/2/2018 12:12 AM, Max Power wrote:
> >Hi guys,
> >with the new release of Debian 'Stretch', the route command has been replaced
> >but what other command returns the hostname of the modem/router gateway...?
> ># route
> >gateway = home.telecomitalia.it
> ># ip route
> >gateway = 192.168.1.1

$ ip -r r

You need to ask for the resolver with -r.

man ip-route documents the arguments/commands, but you need
man ip for the options (which are common).

> >
> >Thanks for reply, Max Power.
> >
> 
> You could try the host(1) utility:
> 
> $ host 192.168.1.1
> 
> https://linux.die.net/man/1/host

$ host 192.168.1.1
Host 1.1.168.192.in-addr.arpa. not found: 3(NXDOMAIN)
$ 

Cheers,
David.



Re: hostname of the modem gateway

2018-01-01 Thread john doe

On 1/2/2018 7:15 AM, David Wright wrote:

On Tue 02 Jan 2018 at 06:25:29 (+0100), john doe wrote:

On 1/2/2018 12:12 AM, Max Power wrote:

Hi guys,
with the new release of Debian 'Stretch', the route command has been replaced
but what other command returns the hostname of the modem/router gateway...?
# route
gateway = home.telecomitalia.it
# ip route
gateway = 192.168.1.1


$ ip -r r

You need to ask for the resolver with -r.

man ip-route documents the arguments/commands, but you need
man ip for the options (which are common).



Thanks for reply, Max Power.



You could try the host(1) utility:

$ host 192.168.1.1

https://linux.die.net/man/1/host


$ host 192.168.1.1
Host 1.1.168.192.in-addr.arpa. not found: 3(NXDOMAIN)
$



Looks like 192.168.1.1 is not your default route.

--
John Doe



Re: hostname of the modem gateway

2018-01-01 Thread Tom Furie
On Tue, Jan 02, 2018 at 07:38:54AM +0100, john doe wrote:

> Looks like 192.168.1.1 is not your default route.

What led you to that conclusion?

Cheers,
Tom

-- 
A good scapegoat is hard to find.
A guilty conscience is the mother of invention.
-- Carolyn Wells


signature.asc
Description: Digital signature


Re: hostname of the modem gateway

2018-01-01 Thread john doe

On 1/2/2018 7:45 AM, Tom Furie wrote:

On Tue, Jan 02, 2018 at 07:38:54AM +0100, john doe wrote:


Looks like 192.168.1.1 is not your default route.


What led you to that conclusion?



My default route is not 192.168.1.1 and host(1) gives me that same error.

--
John Doe



Re: hostname of the modem gateway

2018-01-01 Thread Tom Furie
On Tue, Jan 02, 2018 at 07:52:31AM +0100, john doe wrote:

> My default route is not 192.168.1.1 and host(1) gives me that same error.

What the error actually means is that there is no reverse DNS resolution
for that IP address, in other words the IP address cannot be resolved to
its hostname. It has nothing at all to do with routing.

Cheers,
Tom

-- 
Man is a rational animal who always loses his temper when he is called upon
to act in accordance with the dictates of reason.
-- Oscar Wilde


signature.asc
Description: Digital signature


Re: hostname of the modem gateway

2018-01-01 Thread john doe

On 1/2/2018 8:01 AM, Tom Furie wrote:

On Tue, Jan 02, 2018 at 07:52:31AM +0100, john doe wrote:


My default route is not 192.168.1.1 and host(1) gives me that same error.


What the error actually means is that there is no reverse DNS resolution
for that IP address, in other words the IP address cannot be resolved to
its hostname. It has nothing at all to do with routing.



The OP has said that he want it to get the hostname of his upstream 
router/gateway.
'ip -r r' will show the FQDN of his default route (192.168.1.1) in that 
case.


--
John Doe



Re: hostname of the modem gateway

2018-01-01 Thread john doe

On 1/2/2018 8:16 AM, john doe wrote:

On 1/2/2018 8:01 AM, Tom Furie wrote:

On Tue, Jan 02, 2018 at 07:52:31AM +0100, john doe wrote:

My default route is not 192.168.1.1 and host(1) gives me that same 
error.


What the error actually means is that there is no reverse DNS resolution
for that IP address, in other words the IP address cannot be resolved to
its hostname. It has nothing at all to do with routing.



The OP has said that he want it to get the hostname of his upstream 
router/gateway.
'ip -r r' will show the FQDN of his default route (192.168.1.1) in that 
case.




Rereading the all conversation I should have said to "David Wright 
" that the error:


$ host 192.168.1.1
Host 1.1.168.192.in-addr.arpa. not found: 3(NXDOMAIN)

Meens that there is no hostname associated with that ip.
But in the case of the OP it should work.

--
John Doe



Re: hostname of the modem gateway

2018-01-02 Thread Tom Furie
On Tue, Jan 02, 2018 at 12:12:47AM +0100, Max Power wrote:

> with the new release of Debian 'Stretch', the route command has been replaced
> but what other command returns the hostname of the modem/router gateway...?
> # route
> gateway = home.telecomitalia.it
> # ip route
> gateway = 192.168.1.1

As has already been mentioned, 'ip -r route' (or 'ip -r r', for short)
will work. However if you want to use the 'route' command, or 'netstat
-r' which is equivalent, it is still available in the 'net-tools'
package.

Cheers,
Tom

-- 
Any sufficiently advanced technology is indistinguishable from a rigged demo.
-- Andy Finkel, computer guy


signature.asc
Description: Digital signature


Re: hostname of the modem gateway

2018-01-02 Thread Greg Wooledge
On Tue, Jan 02, 2018 at 12:12:47AM +0100, Max Power wrote:
> Hi guys,
> with the new release of Debian 'Stretch', the route command has been replaced
> but what other command returns the hostname of the modem/router gateway...?
> # route
> gateway = home.telecomitalia.it
> # ip route
> gateway = 192.168.1.1
> 
> Thanks for reply, Max Power.

http://mywiki.wooledge.org/XyProblem
http://mywiki.wooledge.org/IpAddress

I bet one or both of those will help, in the long run.

Note that the gateway address given by DHCP is available in a variable
that dhclient-enter-hooks scripts can use.  You probably want to get it
that way instead of running "ip route" or "route" or "netstat -r" or
any other command.



Re: hostname of the modem gateway

2018-01-02 Thread Glenn English
On Mon, Jan 1, 2018 at 11:12 PM, Max Power  wrote:

> with the new release of Debian 'Stretch', the route command has been replaced

Wipe your disk and install Buster. You get route++ back.

Or create some shell scripts...

--
Glenn English



Re: hostname of the modem gateway

2018-01-02 Thread Greg Wooledge
On Tue, Jan 02, 2018 at 02:59:41PM +, Glenn English wrote:
> On Mon, Jan 1, 2018 at 11:12 PM, Max Power  wrote:
> 
> > with the new release of Debian 'Stretch', the route command has been 
> > replaced
> 
> Wipe your disk and install Buster. You get route++ back.

Worst advice ever.



Re: hostname of the modem gateway

2018-01-03 Thread David Wright
On Tue 02 Jan 2018 at 08:50:13 (+0100), john doe wrote:
> On 1/2/2018 8:16 AM, john doe wrote:
> >On 1/2/2018 8:01 AM, Tom Furie wrote:
> >>On Tue, Jan 02, 2018 at 07:52:31AM +0100, john doe wrote:
> >>
> >>>My default route is not 192.168.1.1 and host(1) gives me that
> >>>same error.
> >>
> >>What the error actually means is that there is no reverse DNS resolution
> >>for that IP address, in other words the IP address cannot be resolved to
> >>its hostname. It has nothing at all to do with routing.
> >>
> >
> >The OP has said that he want it to get the hostname of his
> >upstream router/gateway.
> >'ip -r r' will show the FQDN of his default route (192.168.1.1) in
> >that case.
> >
> 
> Rereading the all conversation I should have said to "David Wright
> " that the error:
> 
> $ host 192.168.1.1
> Host 1.1.168.192.in-addr.arpa. not found: 3(NXDOMAIN)
> 
> Meens that there is no hostname associated with that ip.
> But in the case of the OP it should work.

I haven't a clue what works for the OP, not even after glancing at the
subsequent thread that seems to continue the debate. I don't even know
exactly how they generated the lines:

|> # route
|> gateway = home.telecomitalia.it
|> # ip route
|> gateway = 192.168.1.1

All I did was to suggest how the OP could get ip to do what route
appears to do by default, which is to print names in place of
dotted quads.

I have a name associated with 192.168.1.1 but it's not resolvable
through DNS: there's no resolver in the router. I have to resolve
it with getent, and I asume my system is doing just that:

$ getent hosts 192.168.1.1
192.168.1.1 router
$ ping router
PING router (192.168.1.1) 56(84) bytes of data.
64 bytes from router (192.168.1.1): icmp_seq=1 ttl=64 time=2.24 ms
64 bytes from router (192.168.1.1): icmp_seq=2 ttl=64 time=1.53 ms
64 bytes from router (192.168.1.1): icmp_seq=3 ttl=64 time=1.15 ms
64 bytes from router (192.168.1.1): icmp_seq=4 ttl=64 time=1.42 ms
^C
--- router ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 1.157/1.590/2.245/0.402 ms
$ head -12 /etc/hosts
# /root/hosts-0-acer

127.0.0.1   localhost
127.0.1.1   acer

#
# /root/hosts-1-local-template
# List of local hosts.
# Comment out the line of this host when installing.
# Check the IPv6 lines occasionally because they change them.

192.168.1.1 router
$ 

Cheers,
David.