Ubuntu: Configure client-side DNS?



Question:

I have a network with 2 machines. machine A has IP 192.168.1.100 , machine B has IP 192.168.1.101. Now i want to resolve machine B IP address to test. I don't want to pass through a dns server. Instead I want to modify /etc/hosts, /etc/resolv.conf ... so that when I type "test" on machine's A browser, I am directed to machine B . Is this approach feasible and if yes, how.


Solution:1

Edit you /etc/hosts and below put like fallow

sudo nano /etc/hosts

127.0.0.1       localhost  127.0.1.1       xxx.yyy.com        xxx    # The following lines are desirable for IPv6 capable hosts  ::1     ip6-localhost ip6-loopback  fe00::0 ip6-localnet  ff00::0 ip6-mcastprefix  ff02::1 ip6-allnodes  ff02::2 ip6-allrouters    192.168.1.101    test  


Solution:2

You can do this by modifying Machine A's /etc/hosts file.

Open the file and add the following:

192.168.1.101  test    

Now you can reach Machine B by just using hostname test, you can also add an alias like:

192.168.1.101  test  machine-b  

Also make sure the /etc/nsswitch.conf file's hosts database lookup starts with the files data source. For example, in my computer:

hosts:          files mdns4_minimal [NOTFOUND=return] dns  

This means that while doing hostname resolution the relevant files in the /etc directory will be checked first.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »

1 comments:

Write comments
Aaron Cross
AUTHOR
24 August 2017 at 02:11 delete

Hi, I'm Aaron, I had my friend help me hack my ex's email cause I suspected he was cheating. All he asked for was a his phone number. Contact him now, his email is hackerresolution@gmail.com..If you need help tell him Aaron referred you and he'll assist. At first I did not give it much thought, but my mind was still bothered so I decided to contact the hackerresolution@gmail.com to help me catch my cheating spouse. He delivered as was promised he is really a genius,he also does P.I jobs, clears your record, passwords,I love him and his work. You should try. Good luck

Reply
avatar