Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I use vagrant to launch VM's and bridge the network access to my local machine. Unfortunately exvery VM launch gives me a new IP address, and MAC address. I have a domain.local that I use and currently I have to change my computer's hosts file every launch to match.

I have admin access to all the machines (local, VM, and the router for the intranet). How to I tell .local domains to resolve locally only in a way that won't require me to change (or set at all) my local hosts file?

share|improve this question
add comment

2 Answers

I understand you need to resolve for dynamically assigned addresses.

I had the same issue and used DNSMASQ, this is an integrated DNS & DHCP server that runs very well on ubuntu server. Great benefit is that it is nearly zero config.

How I set it up:

NAT - SRV01 - InternalNet - SRV02 / SRV03 / CLNT

So SRV02 / SRV03 / CLNT are only connected to InternalNet, getting DHCP and domain lookups from SRV01. SRV01 is gateway for these machines as well (by using ip forwarding and iptables masquerade on SRV01).

Works like a charm. Hope this helps.

/dnsmasq

share|improve this answer
1  
That went right over my head. It looks like a solution, are you able to elaborate or be a little more specific? What extra information do you need from me to do so? –  Bradley Jul 25 '13 at 16:21
1  
@Bradley unix.stackexchange.com/questions/16890/… may help –  Gilles Jul 25 '13 at 23:19
    
@Bradley Sorry it took so long for me to answer... Of course I can elaboreate. What I did is install 3 Ubuntu servers (SRV01, SRV02 and SRV03) and a Windows host (CLNT) in VBox VM's. On SRV01, which has 2 vnics (one NAT-ted (called it WAN), the other one internal network (called it LAN)) I installed DNSMASQ. Configured it to hand out IP-addresses on LAN (which automagically enables the hostname to be resolved to the IP that was handed out). The other machines only have internal nics (the LAN part of SRV01) and are set to dynamc IP config (DHCP). HTH, if you need more info let me know. –  user182984 Aug 28 '13 at 8:01
add comment

You can use Zeroconf. It broadcasts the host name and makes it available to the other hosts on the local network. That way you can access your hosts using hostA.local, hostB.local, etc.

On Debian bases systems you need the package libnss-mdns for the host name advertisement and avahi-daemon for the name resolution.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.