I want to add entries to my hosts file so I can access some local vagrant VMs for development.

I have a near-new install of Ubuntu 16.04 LTS. There is a /etc/hosts file but changes I make to it are being ignored.

It looks like this:

1   localhost
2   q
4 # The following lines are desirable for IPv6 capable hosts
5 ::1     ip6-localhost ip6-loopback
6 fe00::0 ip6-localnet
7 ff00::0 ip6-mcastprefix
8 ff02::1 ip6-allnodes
9 ff02::2 ip6-allrouters
11 # My custom section
12   local.devel <-- being ignored

I have tried adding other entries but nothing is being read.

I have checked /etc/nsswitch.conf and it appears to have files as the first entry. eg:

  12 hosts:          files mdns4_minimal [NOTFOUND=return] dns
  13 networks:       files
  15 protocols:      db files
  16 services:       db files
  17 ethers:         db files
  18 rpc:            db files

Which I think is correct. dnsmasq is installed but restarting the network manager also does not help.

Someone, please help I have been googling solutions for hours and nothing is working...

  • 3
    /etc/hosts can't specify ports (:4567), and should have unique IP addresses - not multiple lines. localhost q – waltinator Mar 7 '18 at 6:01
  • Ah. Thank you. It was the ports. The multiple lines seem to work fine though. – tanbog Mar 7 '18 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.