What's new

Any way to set a host entry at router level ?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

ahmadka

Regular Contributor
Hi guys ... I have a VM running on my laptop, and the VM has its own dedicated IP. This VM is running a website, and I want to add a host entry sort of a thing at the router level, so that whenever someone on my network enter's the website's address (e.g. www.xyz.com), the request is forwarded to the VM's static IP inside my network (e.g. 192.168.1.12) ..

This can easily be done on computers (by adding host entries), but doing it on phones and tablets is harder, if not impossible. So I was wondering if I can instead do this on my ASUS RT-N66U (running Merlin 374.41) somehow, so that all devices access this VM for that website automatically ..
 
Thanks. Isn't there a way to do this directly from within the router's settings pages ? I don't mind going command prompt, but I'd like to stick with the router's settings area if possible, as it would be easier to keep track of changes that way.
AFAIK, this is the only way.
 
Thanks. Isn't there a way to do this directly from within the router's settings pages ? I don't mind going command prompt, but I'd like to stick with the router's settings area if possible, as it would be easier to keep track of changes that way.
You could create a DHCP reservation for it in LAN > DHCP Server. That would have the same effect (it creates a /etc/hosts.dnsmasq file) whether or not the VM was using DHCP.
 
Last edited:
You could create a DHCP reservation for it in LAN > DHCP Server. That would have the same effect (it creates a /etc/hosts.dnsmasq file) whether or not the VM was using DHCP.

Are you referring to setting a static IP for a given MAC address ?

Well that's not what I want, because that doesn't necessarily make a website address go to specific IP. That just tells the router to always assign a specific IP to a given MAC address.
 
Are you referring to setting a static IP for a given MAC address ?

Well that's not what I want, because that doesn't necessarily make a website address go to specific IP. That just tells the router to always assign a specific IP to a given MAC address.

If you enter a valid hostname in the Name field, it will be provided to dnsmasq for use for local name resolution.
 
If you enter a valid hostname in the Name field, it will be provided to dnsmasq for use for local name resolution.
Hmm, Looks like you can only put short host names in there. So "xyz" would be OK but "xyz.com" is ignored.
 
Hmm, Looks like you can only put short host names in there. So "xyz" would be OK but "xyz.com" is ignored.
This is what the hosts file / dnsmasq CAN do...
 
Thanks for the input guys ..

Okay so if I put "xyz" for the name, and then I browse to xyz.com, will it go to that VM then or not ?

Also, another problem I have is that both the MAC of my laptop's NIC, and of the VM's NIC, are the same from the router's point of view. That is to say, in the MAC dropdown, I see too entries with the same MAC (one of my laptop's physical NIC, and one for the virtual NIC inside the VM running on this laptop), even though the VM's virtual MAC address is different .. So this sort of creates a problem I think, because then I don't know which MAC entry to choose from the two .. I mean I don't want the router to be confused between the laptop and the VM .. I have a static MAC <> IP mapping here for my main laptop's NIC (to assign my laptop a static IP), and I don't want that to get messed up .. I also don't want to do this static IP setting on the laptop itself, because I take my laptop to office and other locations, so that'll require to keep changing settings in the laptop ..

Isn't there a way to NOT provide the MAC address for this ?
 
Last edited:
Okay so if I put "xyz" for the name, and then I browse to xyz.com, will it go to that VM then or not ?
No, you're going to have to use a /jffs/configs/hosts.add file.

Isn't there a way to NOT provide the MAC address for this ?
Rather pointless now given the answer above. But for the record you can enter any MAC-like address. It doesn't have to be on the drop-down. So 00:00:00:00:00:01 would do because you say your VM has a static address so it's not using DHCP anyway.
 
Last edited:
Hmm, Looks like you can only put short host names in there. So "xyz" would be OK but "xyz.com" is ignored.

A dot is not a valid character in a hostname. That field is only for the device's hostname, which will be used within your local domain (which must not be a public TLD such as a .com, or you will have name resolutions issues).
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Staff online

Top