Custom DNS

Discussion in 'Tomato Firmware' started by Synaps3, Jan 16, 2013.

  1. Synaps3

    Synaps3 Serious Server Member

    What I am trying to do is extremely simple, but no matter what I do nothing changes. I have a LAN with all devices using a static IP. DHCP is disabled on my tomato router. I have the dual WAN version of the firmware. Under the DNS settings for my router, I have both DNS servers set to IP provided by my ISP. All computers on the network then have the router's IP for their DNS server. All I want to do is have custom DNS names within my network that resolve to static IPs.

    There are many tutorials which show you how to do this using either dnsmasq or Static DHCP, but for whatever reason none of them work.

    I've gone to Basic -> Static DHCP and entered them there.
    I've gone to Advanced -> DHCP / DNS and entered address=/dfadsafas/ipaddress
    All of them seem to indicate DHCP. EXCEPT I DONT WANT DHCP. I simply want to enter a name and it goes to that IP address. WHY is it so complicated.
  2. Bird333

    Bird333 Network Guru Member

    I believe you have to add your names to the the 'hosts' file. I think it is /tmp/etc/hosts. You'll have to put a line like this in your 'init' field in the gui
    echo "   Synaps3-PC" >> /tmp/etc/hosts
    Of course modify it to match your needs. Also you'll need a line for each device on your lan.
  3. gfunkdave

    gfunkdave LI Guru Member

    I'm not sure what the problem is. Either approach should work.

    In Static DHCP, if you click the Bound To box for a host, it should work.

    In Advanced DNS, entering one host per line in the form of
    should work.

    Both work just fine for me on TOastman.
  4. Synaps3

    Synaps3 Serious Server Member

    Where do I find the init field?

    That's what I've been trying. When ever I add anything to that box, it disables my DNS on the internet.
  5. gfunkdave

    gfunkdave LI Guru Member

    He means the Init script field under Administration-Scripts.

    It most definitely shouldn't be disabling your internet DNS when you add stuff to that field. Are you using an old Tomato version? Do you have any other checkboxes checked on that page? What are your DNS servers set to?

    You might check the box to use received DNS with user-entered DNS, but it shouldn't matter.
  6. mvsgeek

    mvsgeek LI Guru Member

    Since you have DHCP disabled, the address=/FQDN/IP option won't do anything, because dnsmasq isn't running. Toastman recently posted a neat little trick, but I think it was a casualty of the recent server issue. From memory, it's something like this...
    1. Enable DHCP, but assign a range of 1 IP address (e.g.
    2. Assign to a fictitious MAC address
    3. Assign static IP addresses to your real MAC addresses as desired.

    Like gfunkdave I'm using Toastman firmware, and the address= option works fine, but on a router which has DHCP enabled.
    gfunkdave likes this.
  7. Synaps3

    Synaps3 Serious Server Member

    Thanks for all the help guys. I'm getting closer to having it work how I want. After doing what mvsgeek said about turning on DHCP for one IP address, I am able to enter hostnames under Basic -> Static DHCP and have them work properly. However, it still doesn't work when I enter them like address=/FQDN/IP. For one of my devices, I need to include a port number in addition to the IP address and there is not enough space in the text box under Static DHCP (it doesn't scroll to the side when it fills up like it should). Any idea why the dnsmasq way isn't working? It did change something with the dnsmasq though because when I enter anything in the box it doesn't disable my internet DNS like it used to, it just doesn't work with the addresses entered.

    Version 1.28.0532 MIPSR1 K26 4M (Dual WAN)
    DNS servers are set to what is provided by my ISP for both WAN lines.
    Still haven't tried the init field. Now that I know where it is, I am going to try that next.

    Here is what's checked on my dnsmasq page:
    Use internal DNS: Checked
    Use received DNS with user-entered DNS: Checked
    Prevent DNS-rebind attacks: Checked
    Intercept DNS port (UDP 53): Not
    Use user-entered gateway if WAN is disabled: Not
    Maximum active DHCP leases: 255
    Static lease time - Same as normal lease time
  8. Synaps3

    Synaps3 Serious Server Member

    Ok, so I tried the init script and it worked also except when I add a port to the end of the IP it doesn't. Also does that init script add to the file each time it boots (making the file bigger and bigger) or does the file get reset? Sorry for all the questions, I am pretty new to this.
  9. gfunkdave

    gfunkdave LI Guru Member

    DNS has nothing to do with ports. All it does is map IP addresses to hostnames. What are you trying to do?
  10. sarelc

    sarelc LI Guru Member

    Not sure if this helps you or not, but if you add "address=/", will not match, and vice-versa. Where are you wanting to use these addresses? Web-browser, command line, some other app?
  11. Synaps3

    Synaps3 Serious Server Member

    I just have a service running on one of my machines and it uses a port other than port 80 because port 80 is already used for a different service on that IP. I am trying to find a way to get a different IP for that service so this wont be a problem.

    Got it working. Didn't realize I had to enter my domain after the name. I thought it was already using my domain because when I enter it in the Static DHCP page I just specify the name and it already knows the domain.

    So almost everything works fine now. Just have to figure out how to set up a different IP for that service so I can add a DNS entry for it.
  12. gfunkdave

    gfunkdave LI Guru Member

    Well, each network card gets a separate IP address. What you're trying to do won't work. Assuming the machine in question only has one network card, it can only have one IP at a time.

    You've already got the answer. Set your custom DNS as you like, and just connect to the port you want. If it's a web server you're trying to connect to, do http://myinternal.local:myport

    To access a web server running on port 6000 of myinternalhost.internal, go to http://myinternalhost.internal:6000.
  13. Synaps3

    Synaps3 Serious Server Member

    Right. I'd just rather not have a port to enter and have a separate IP instead. It's not that big of a deal if I can't do that, but it's just nicer to have it that way. Apparently there is a way to assign multiple IPs to one interface in FreeBSD which is what I am using, so I am asking them how to do that on their forum.

    Thanks for all the help and the quick responses.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice