Networking Forums

Networking Forums > Computer Networking > Linux Networking > Resolving host names on a moveable laptop

Reply
Thread Tools Display Modes

Resolving host names on a moveable laptop

 
 
mtford
Guest
Posts: n/a

 
      03-19-2006, 04:00 AM
Hello all,

I have two computers: a Mac OS X laptop and a Linux desktop PC. When I
am at home, the two computers are behind a router, with IP addresses
192.168.0.3 and 192.168.0 2 respectively. So to log into the Linux
machine from the Mac, I would do "ssh -p <port> <user>@192.168.0.2".
However, to make the same connection from my laptop when I'm elsewhere,
I would need to do "ssh -p <port> <user>@mynode.mydomain.com", where
the name resolution is done by a dynamic DNS service, and the
connection is forwarded by my router.

What I would like to do is to have a hostname which ALWAYS points to my
Linux PC when my Mac tries to resolve it. I use my Linux PC as a mail
server, so it's rather inconvenient having to reconfigure the mail
client on the Mac every time I bring it home. Of course I CAN use the
external hostname to make an internal connection from behind the
router... but for some reason this gives me an extremely slow
connection (many times slower than connecting from outside). Is there
an easy way to do this? The only way I can think of is to write a cron
script which runs ifconfig, and adds an entry into my /etc/hosts file
when my own ip address appears to be 192.168.0.3.

Perhaps this question really belongs in a Mac OS X forum rather than a
Linux one... but I suspect the solution will be the same on any
Unix-based system.

Matthew.

 
Reply With Quote
 
 
 
 
saw
Guest
Posts: n/a

 
      03-19-2006, 05:21 AM
Don't know. Should this not be handled by DNS or your mail server?

mtford wrote:
> Hello all,
>
> I have two computers: a Mac OS X laptop and a Linux desktop PC. When I
> am at home, the two computers are behind a router, with IP addresses
> 192.168.0.3 and 192.168.0 2 respectively. So to log into the Linux
> machine from the Mac, I would do "ssh -p <port> <user>@192.168.0.2".
> However, to make the same connection from my laptop when I'm elsewhere,
> I would need to do "ssh -p <port> <user>@mynode.mydomain.com", where
> the name resolution is done by a dynamic DNS service, and the
> connection is forwarded by my router.
>
> What I would like to do is to have a hostname which ALWAYS points to my
> Linux PC when my Mac tries to resolve it. I use my Linux PC as a mail
> server, so it's rather inconvenient having to reconfigure the mail
> client on the Mac every time I bring it home. Of course I CAN use the
> external hostname to make an internal connection from behind the
> router... but for some reason this gives me an extremely slow
> connection (many times slower than connecting from outside). Is there
> an easy way to do this? The only way I can think of is to write a cron
> script which runs ifconfig, and adds an entry into my /etc/hosts file
> when my own ip address appears to be 192.168.0.3.
>
> Perhaps this question really belongs in a Mac OS X forum rather than a
> Linux one... but I suspect the solution will be the same on any
> Unix-based system.
>
> Matthew.
>

 
Reply With Quote
 
mtford
Guest
Posts: n/a

 
      03-19-2006, 06:10 AM
Yes, ideally I suppose it should be handled by my Netgear wireless
router, which acts as a DNS server. However, as far as I can tell, the
router is just forwarding all DNS lookups to my cable ISP. I don't know
any way to configure the router to recognize its own domain name and
resolve names of local nodes. As I say, I don't understand why I get
such a slow connection when I use my external hostname to make a local
connection... I can understand the DNS lookup being slow, but not why
it takes more than a minute to download a 100 KB file through my router
from one local node to another.

 
Reply With Quote
 
Allen McIntosh
Guest
Posts: n/a

 
      03-20-2006, 12:16 AM
> The only way I can think of is to write a cron
> script which runs ifconfig, and adds an entry into my /etc/hosts file
> when my own ip address appears to be 192.168.0.3.


Is there a hook that would let you run this script at the tail end of
the DHCP setup? the tail end of bringing the interface up?
 
Reply With Quote
 
Robert Harris
Guest
Posts: n/a

 
      03-20-2006, 08:32 AM
mtford wrote:
> Yes, ideally I suppose it should be handled by my Netgear wireless
> router, which acts as a DNS server. However, as far as I can tell, the
> router is just forwarding all DNS lookups to my cable ISP. I don't know
> any way to configure the router to recognize its own domain name and
> resolve names of local nodes. As I say, I don't understand why I get
> such a slow connection when I use my external hostname to make a local
> connection... I can understand the DNS lookup being slow, but not why
> it takes more than a minute to download a 100 KB file through my router
> from one local node to another.
>


DNS only happens once per connection - once your laptop knows the IP
address of your ssh server, it doesn't need to ask again. Your packets
are probably being routed out of your system and back again.

Robert
 
Reply With Quote
 
Jerry Peters
Guest
Posts: n/a

 
      03-20-2006, 08:31 PM
Allen McIntosh <(E-Mail Removed)> wrote:
>> The only way I can think of is to write a cron
>> script which runs ifconfig, and adds an entry into my /etc/hosts file
>> when my own ip address appears to be 192.168.0.3.

>
> Is there a hook that would let you run this script at the tail end of
> the DHCP setup? the tail end of bringing the interface up?


If the OP is using dhclient, then yes; look at
/etc/dhclient-exit-hooks which is executed when /sbin/dhclient-script
is about to exit.

Jerry
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Names not resolving Tristan Miller Linux Networking 8 06-05-2008 09:31 PM
DNS and NetBIOS names not resolving over a PPTP VPN using RRAS Nonapeptide@gmail.com Windows Networking 19 05-29-2008 03:39 PM
"Some" Apps not resolving names Bruce Lytle Linux Networking 1 05-29-2006 01:05 AM
DHCPD and host names gedm Linux Networking 0 06-08-2005 09:00 AM
Can Not Resolve Host names =?Utf-8?B?QXR0aWN1cyBGaW5jaA==?= Windows Networking 4 01-16-2005 10:11 PM



1 2 3 4 5 6 7 8 9 10 11