Every time I connect to the network at work my device gets a new IP address which makes it /etc/hosts/
invalid and my hostname becomes unreachable.
I was looking for a way to set /etc/hosts
automatically every time I reconnect and I came across dhclient-scrip.
I am pretty new to Ubuntu world and honestly I got lost through all this :)
All I need is just to update the IP of my local hostname when my local IP changes.
Thanks
EDIT:
here is my /etc/hosts
128.141.239.50 mtahawi.comp.com mtahawi
127.0.0.1 localhost
127.0.1.1 mtahawi
so the problem is: the IP I am mapping to my hostname mtahawi.comp.com
is changing when I reconnect.
I forgot to say I am using a WiFi.
Why do it the hard way?
Bind your MAC to an ip or use address reservation. Every server should have a static ip for more than just the reason you have.