1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

LAN -> DHCP Server -> Can't put a Domain Name with '.' in it. (Solution Provided)

Discussion in 'Asuswrt-Merlin' started by Debu, Jun 26, 2019.

  1. Debu

    Debu Occasional Visitor

    Joined:
    May 11, 2017
    Messages:
    26
    Hi,

    I'm trying to setup a home lab and I'm trying to get DNS to resolve a server on my network.
    Well, I can't use the dhcp feature because it won't let me use a . character a part of the hostname....whatever.

    Maybe there is a better way to do this, in Tomato, I used to be able to just add an IP and Hostname and it would resolve the name and ip easily in the gui.

    The thing that is annoying is that this is using dnsmasq in the back so why not just expose that in the gui better and have all these restrictions on names?

    So instead I created a small script in /jffs/config
    This works with 2 files.

    sort_ip.sh
    hosts.add

    sort_ip.sh
    Code:
    #!/bin/sh
    
    sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 hosts.add > hosts.working
    mv hosts.working hosts.add
    service restart_dnsmasq
    hosts.add
    (this is an example of the file where you put your hostnames so they resolve when using static IPs.

    Code:
    192.168.1.1 router
    192.168.1.2 family
    192.168.1.3 cisco
    192.168.1.5 basement
    Note: You have to backup jffs every time you make an update to it and also you need to push it up if you mess too much with your firmware and do a factory wipe.

    Hope this helps someone.
     
    L&LD likes this.
  2. ColinTaylor

    ColinTaylor Part of the Furniture

    Joined:
    Mar 31, 2014
    Messages:
    8,860
    Location:
    UK
    You could have just said "Use a hosts.add file" as per the wiki. No need to complicate matters with an unnecessary script IMHO.
     
    Last edited: Jun 26, 2019
    L&LD likes this.
  3. Jumpstarter

    Jumpstarter Senior Member

    Joined:
    Apr 3, 2019
    Messages:
    226
    Not dismissing the application, but I was scanning the thread, What application in the real world does this have? what purpose?-- application wise.