Static DNS entries in router?

HavocXphere

Honorary Master
Joined
Oct 19, 2007
Messages
33,153
Reaction score
1,297
Location
Europe
I want to do the same thing as the hosts file does, but router side. i.e. resolve certain URLs to a preset IP.

Problem is I can't find anything in the router page that allows me to do this. Its a Netgear DGN2000. I see static routes, address reservation etc, but I don't that it.

Failing that, is there a hosts equivalent file somewhere in the router when accessed via telnet? I vaguely remember that linux has something like that.

Thanks
 
[nicholas@GrIM ~]$ ssh [email protected]
[email protected]'s password:
DSL Modem CLI
Copyright (c) 2004 Texas Instruments, Inc.
cli> em
^
% Invalid input at caret.

cli> enable
Password: *****
New priv level = 5
cli# shell

Starting /bin/sh
Type exit to return to the CLI


BusyBox v0.61.pre (2007.06.14-08:18+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

# cat /etc/hosts
127.0.0.1 localhost
10.0.0.2 login.router
# echo "10.0.0.2 testformybb" >> /etc/hosts
# cat /etc/hosts
127.0.0.1 localhost
10.0.0.2 login.router
10.0.0.2 testformybb
# exit
cli# exit

Connection to 10.0.0.2 closed.
[nicholas@GrIM ~]$ ping testformybb
PING testformybb (10.0.0.2) 56(84) bytes of data.
64 bytes from login.router (10.0.0.2): icmp_req=1 ttl=255 time=0.599 ms
64 bytes from login.router (10.0.0.2): icmp_req=2 ttl=255 time=0.582 ms
^C
--- testformybb ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.582/0.590/0.599/0.025 ms
 
Thanks Grim

I'm a bit uneasy about the cat style editing. If I create a backup like this:

cp /etc/hosts /etc/hosts.bck

then I should be able to recover from mistakes made, right? And the backup will survive a hard-reset?
 
cat just display's the contents of a file,
echo "text" > filename (will write)
echo "test" >> filename (will append to new line)

reseting the router will probably get ride of anychanges , could be wrong . you can make a backup file if you want , or just take note or the original contents

edit: reason i used that method is because its very unlikley the stripped down linux distro will have any editors or anything like that
 
hmmm...didn't quite work.

Managed to create a backup and add a line, but it doesn't actually resolve (used the equivalent line of what you did). Then I did a soft reset to see if it only reads in the hosts on boot...and that wiped the hosts clean and deleted the backup too.

I guess its not happening. Thanks for the replies nonetheless Grim.
 
Top
Sign up to the MyBroadband newsletter
X