Saturday, February 9, 2019

Unifi: set a local hostname to resolve to the local IP inside your home network



When you want to access a local server in your home network, it's handy to use domain names for that. Unfortunately, in some cases, the same server has a public and private IP both sharing the same domain name. Thus, defining them in your public DNS with your public IP, could make it impossible to access the same server locally. Still, if you want to use the FQDN instead of the IP name, you can define the domain name with local IP in your Unifi Security Gateway.
  1. Login via SSH to your Unifi (SG) and enter your admin password.
  2. ssh -l admin 192.168.x.1
  3. Switch to become root
  4. sudo -i
  5. Edit the hosts file and add an entry for the local server
  6. vi /etc/hosts
    192.168.x.10     yourserver.domain.name
  7. Test on another machine if the domain name gets resolved as expected
  8. MacBook-Pro:~ user$ nslookup host.domain.name
    Server:  192.168.x.1
    Address: 192.168.x.1#53
    
    Name: host.domain.name
    Address: 192.168.x.10
    
    

No comments:

Post a Comment