router by dns (instead of IP)

Discuss the technical details of Gargoyle and ongoing development

Moderator: Moderators

Post Reply
bplotkin
Posts: 41
Joined: Fri Nov 06, 2009 4:19 pm
Location: Canada
Contact:

router by dns (instead of IP)

Post by bplotkin »

Hi,

I wanted to access the router by name instead of IP address so for example 'ping router' will return 192.168.1.1 (so if I change router IP it will be simple to get http and ssh, no need to remember IP address) and in this example 'http://router' will be the interface.

My attempt works now but maybe there is a better way to do this, so if anyone can help that would be great and maybe if you'd like it implement in next firmware version.

I added the line to the file /etc/hosts:
192.168.1.1 router.

now I can 'ping router.' and 'http://router.' (appending a dot to the end of the hostname made it work, the solution is to make sure that we have a domain set in resolv.conf, but I wasn't sure how to do that: [http://www.thekelleys.org.uk/dnsmasq/docs/FAQ])

EDIT: when setting openwrt.lan or same as device name and the domain from the web interface (instead of 'router.') the .lan is auto added so 'ping openwrt' and 'http://openwrt' will work without appending a dot.

Therefore the solution is /etc/hosts:
192.168.1.1 openwrt.lan

Let me know what you think!
Linksys WRT54GL = Gargoyle 1.4.2
TP-Link TL-WR741ND = Gargoyle 1.4.2
Buffalo WZR-HP-G300NH = Gargoyle 1.4.2
http://eduboris.blogspot.com/search/label/Gargoyle

Eric
Site Admin
Posts: 1443
Joined: Sat Jun 14, 2008 1:14 pm

Re: router by dns (instead of IP)

Post by Eric »

I like this idea a lot. I will implement it in the near future.

FYI -- the reason development has been slow (nonexistent, really) for the past couple weeks is that I'm working on migrating the Gargoyle site to a new hosting provider. I'm about at the limit of my disk space quota for this site, and the upgrades from this plan are a bit pricy with my current host.

The best deals are from the VPS providers (I've selected linode), where I can get 4x the bandwidth and 8x the disk space I now have for just under twice the price. However configuring a VPS to do what I want is a bit tricky. Admittedly, I've complicated the problem considerably because I also want to migrate the source code repository/bugtracker from Assembla to the new host. I'm doing all of this right now because my contract with my current host is up in a few weeks and I don't want to have to renew for another year before I complete the migration.

So... yes, I like your idea, I'll implement it, but I'm crazy busy between moving the site/setting up source hosting and bugtracking, migrating to backfire, handling router orders (see most recent news post) and my day job. Therefore you may have to wait a little while, even though it's pretty straightforward.

BikeMike
Posts: 108
Joined: Sat Jun 13, 2009 8:02 am
Location: Adelaide, South Australia

Re: router by dns (instead of IP)

Post by BikeMike »

I did ask a similar question once but nobody replied... perhaps I didn't phrase it correctly :shock:

http://www.gargoyle-router.com/phpbb/vi ... ?f=5&t=451

I though if you've given the router a hostname you should be able to ping/browse that hostname.

User avatar
DoesItMatter
Moderator
Posts: 1373
Joined: Thu May 21, 2009 3:56 pm

Re: router by dns (instead of IP)

Post by DoesItMatter »

Is this something you actually configure in the router?

I thought you put this stuff in the 'hosts' file in your windows
directory or whatever other file it is for unix systems?

Most of the time I'm not even using my routers for DNS

I'm typically using Cisco's main DNS server or Google's DNS servers.
:twisted: Soylent Green Is People! :twisted:
2x Asus RT-N16 = Asus 3.0.0.4.374.43 Merlin
2x Buffalo WZR-HP-G300NH V1 A0D0 = Gargoyle 1.9.x / LEDE 17.01.x
2x Engenius - ESR900 Stock 1.4.0 / OpenWRT Trunk 49400

bplotkin
Posts: 41
Joined: Fri Nov 06, 2009 4:19 pm
Location: Canada
Contact:

Re: router by dns (instead of IP)

Post by bplotkin »

Eric: thanks, I'm glad you like it!
and don't worry about the updates, it is a great project and we can see you put a lot into it, I unfortunately am not good at OOP but can do some scripting so can help you with small things like this...
And its very easy to do manually so even if the next update comes next month we can already benefit by doing this via ssh.

Also if you are having some hosting problems I'm sure us IT ppl can find a way to help you out since this is an open source project ppl can donate bw and disk space right?

PS about hosting, have you tried google code? they have a cool system and it's google so it's free and lots of space! :)

BikeMike: it was a little unclear what you wanted in that post but now you can see how to word it better right :D

DoesItMatter: your router acts as your internal DNS what this means when you make a query it will check the lists first in your local PC, then the router, then go to the internet (ie. public/private DNS like google 8.8.8.8 or verisign 4.2.2.2 for example... which can be set on the router instead of individual PCs)

so to answer your question; yes you can do this locally on hosts file in windows/linux but your just affecting your own system, what about the next pc connecting to your router?

well this can be solved by doing what I desicribed above in the first post, when you request openwrt (or w/e you want to name it) it will check your PC=nothing, check the router and return 192.168.1.1
vuala!


BTW if anyone wants to know how to do this and my instructions aren't clear I can help you out.
Linksys WRT54GL = Gargoyle 1.4.2
TP-Link TL-WR741ND = Gargoyle 1.4.2
Buffalo WZR-HP-G300NH = Gargoyle 1.4.2
http://eduboris.blogspot.com/search/label/Gargoyle

Post Reply