I am currently following a tutorial on using chef. The teacher uses vagrant to set up a virtual machine, his vagrant file contains this:
config.vm.network :hostonly, "33.33.33.10"
I didn't want to use vagrant, so created a VM from scratch and implemented all the other parts of his vagrant file manually. However I'm not quite sure what this exactly does. He then goes onto updating his hosts file in /etc/hosts to include:
33.33.33.10 kayak.test
Then he can access his nginx server using "kayak.test" in his browser on another computer. I can access my server using my private IP address "192.168.169.129" in the browser, but I added this that name to my hosts file and I can not access it in the same way. My host file now looks like this:
127.0.0.1 localhost
127.0.1.1 jack.www.jack.co.uk jack
192.168.169.129 jack.test
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
But I cannot access jack.test in the browser of my other computer. What do I need to do to get the same functionality as he has?
Thanks,
Jack.
Probably this issue related to Avahi if you have it on your system. RFC2206 explicitly defines .test .example .localhost an other TLD's as invalid: http://www.rfc-editor.org/rfc/rfc2606.txt
As a possible workaround you can change the line in /etc/nsswitch.conf this way:
hosts: files mdns4_minimal dns mdns4
Do not forget to restart avahi daemon after this.
Source of the workaround: http://avahi.org/wiki/AvahiAndUnicastDotLocal
Thanks @AndreySabitov you made me see where I was going wrong.
I was getting confused and updating my servers /etc/hosts file, rather than my laptops. Therefore when I updated my laptops etc/hosts file with
192.168.169.129 jack.srv
I can now access that server from my laptop.
Thanks!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.