setting local hostname resolution
by mshlinux from LinuxQuestions.org on (#5BAKP)
Hi everyone!
I am trying to use hostname in rsync like
Code:$ rsync ~/transfer-file myhostname:/home/user/I looked at this https://wiki.archlinux.org/index.php...ame_resolution
and
https://wiki.archlinux.org/index.php...ame_resolution
If I add the line in /etc/hosts file like
Code:192.168.1.11 myhostnameit works.
My question is maybe very stupid because I don't really understand about networking.
I have 2 computers, one is Acer and another is Lenovo.
I always share files using rsync back and forth between them. I have to check ip address of the computer to receive file and type rsync command. Both computers usually connect to home or work local networks and ip addresses are accordingly.
That's why I find that if my computers at home and add the line ip and hostname accordingly in /etc/hosts, it works but it does not work at my office because the ip has changed.
So I thought to set up DNS Server and chose Avahi's Hostname Resolution according to this page.
I followed the wiki and edit the hosts line in /etc/nsswitch.conf file like this:
Code:hosts: files mymachines myhostname mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dnsIn that line, am I supposed to repleace myhostname with my hostname I want?
In fact, I have tried it but not work.
I don't really understand because of lack of networking knowledge.


I am trying to use hostname in rsync like
Code:$ rsync ~/transfer-file myhostname:/home/user/I looked at this https://wiki.archlinux.org/index.php...ame_resolution
and
https://wiki.archlinux.org/index.php...ame_resolution
If I add the line in /etc/hosts file like
Code:192.168.1.11 myhostnameit works.
My question is maybe very stupid because I don't really understand about networking.
I have 2 computers, one is Acer and another is Lenovo.
I always share files using rsync back and forth between them. I have to check ip address of the computer to receive file and type rsync command. Both computers usually connect to home or work local networks and ip addresses are accordingly.
That's why I find that if my computers at home and add the line ip and hostname accordingly in /etc/hosts, it works but it does not work at my office because the ip has changed.
So I thought to set up DNS Server and chose Avahi's Hostname Resolution according to this page.
I followed the wiki and edit the hosts line in /etc/nsswitch.conf file like this:
Code:hosts: files mymachines myhostname mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dnsIn that line, am I supposed to repleace myhostname with my hostname I want?
In fact, I have tried it but not work.
I don't really understand because of lack of networking knowledge.