Hiro
Posts: 78
Joined: Fri Dec 30, 2011 11:09 am

DNS software

Wed May 15, 2013 7:41 pm

I have dynamically issued IP addresses on my network and would like to keep it like that for now. However i would like to be able to mount network drives and ping other computers on the network using computer names rather than IP addresses. I can do this no problem from a windows box but not from a linux box. I believe this is because windows has a DNS built in and configured to work automatically but linux doesn't?
I have had a search for setting up a DNS but it seems to involve bind and lots of config file editing so i wondered if there was any software available to automate setting up a DNS on my Pi? Failing that is there an easier way to do what i am trying to do?
Cheers, Hiro.

User avatar
stevepork
Posts: 45
Joined: Wed May 15, 2013 10:36 am
Location: Barnoldswick, UK
Contact: Website

Re: DNS software

Fri May 17, 2013 1:52 pm

Windows uses hostnames. I haven't had much experience beyond my domain. I have however setup a DNS server on my homeserver...... all it seems to do is capture preset and point into internal ip's that you have set (If that makes any sense!). The rest of the lookups are forwarded to google DNS.

I say this because if the Dynamic IP's change on a daily basis only hostnames are of any use to you. Personally I have a DHCP server running with my Raspberry Pi's and a few main PC's including my HomeServer with a Static IP set.

I don't know if any of this is of any use but I figured it may help,

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: DNS software

Fri May 17, 2013 2:30 pm

If you know the IP for the various boxes on your system, you can just add their names and IP addresses to /etc/hosts. I do not know of any way to automate that which would be easier. Doing it by hand seems the easiest.

For example, add a line at bottom of /etc/hosts

192.168.1.3 johnny

and another line for mina's computer at 192.168.1.4

192.168.1.4 mina

the names are really just aliases for the IP numbers.

It does not have anything to do with how to bring up the connections automatically, just assigns names to the IPs for your local use on the Pi.
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: DNS software

Sat May 18, 2013 8:47 am

The Pi does come installed with Bonjour/Zeroconf enabled
AFAIK , and can advertise itself on the Network via that.
You should be able to change the hostname and use it on
any compatible machine.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Hiro
Posts: 78
Joined: Fri Dec 30, 2011 11:09 am

Re: DNS software

Mon May 20, 2013 8:33 pm

Thanks for all the help, i had rather assumed that there would be a simple piece of DNS software available but by the looks of it it will be easier to switch over to static IP addressing so i think i'll go that route.
Cheers, Hiro.

jnihil
Posts: 36
Joined: Sat Dec 29, 2012 12:29 pm

Re: DNS software

Tue May 28, 2013 5:22 pm

dnsmasq works like a charm for me:

$ sudo apt-get install dnsmasq dnsutils
$ sudo vi /etc/dnsmasq.conf

# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.
local=/localnet/
# Set the domain for dnsmasq. this is optional, but if it is set, it
# does the following things.
# 1) Allows DHCP hosts to have fully qualified domain names, as long
# as the domain part matches this setting.
# 2) Sets the "domain" DHCP option thereby potentially setting the
# domain of all systems configured by DHCP
# 3) Provides the domain part for "expand-hosts"
domain=localnet
# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
interface=eth0
# Set this (and domain: see below) if you want to have a domain
# automatically added to simple names in a hosts-file.
expand-hosts

$ sudo /etc/init.d/dnsmasq restart

That's it. Now use your RPi as the local DNS server (make sure you give the RPi an external nameserver to relay the requests to).

You should be able to use this DNS caching-server to resolve all of your local ip hosts via the RPi's /etc/hosts file.

User avatar
joan
Posts: 14762
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: DNS software

Tue May 28, 2013 5:32 pm

Some routers will act as a DNS for machines on the local LAN. My TG585 v7 does.

jnihil
Posts: 36
Joined: Sat Dec 29, 2012 12:29 pm

Re: DNS software

Sun Feb 09, 2014 2:53 am

actually, I've been using 'lan' instead of 'localnet' since it seems to not work well with MS Windows and Apple's Bonjour.

Return to “General discussion”