Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
bind hostname to ip address
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
mlybarger
Guru
Guru


Joined: 04 Sep 2002
Posts: 475

PostPosted: Sat Mar 21, 2015 6:12 pm    Post subject: bind hostname to ip address Reply with quote

my hostname is set

Quote:

mark@lightning ~/Downloads $ cat /etc/conf.d/hostname
# Set to the hostname of this machine
hostname="lightning"
mark@lightning ~/Downloads $ hostname
lightning


but i can't ping that hostname:

Quote:

mark@lightning ~/Downloads $ ping lightning
ping: unknown host lightning


my ip address is obtained from dhcp from my wifi router, so it can change. id' rather not put something into /etc/hosts to hack it to work temporarially. how do i get this hostname recognized?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9679
Location: almost Mile High in the USA

PostPosted: Sat Mar 21, 2015 6:33 pm    Post subject: Reply with quote

This is completely dependent on your router's DHCP/DNS caching server... The most that your Linux box can do is make sure that your DHCP client sends out a name along with the DHCP request, and if the router DHCP/DNS server doesn't honor it, you're SOL and need to find another solution.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Sat Mar 21, 2015 7:27 pm    Post subject: Reply with quote

If you want it to work just on the local host, edit /etc/hosts and add it to the 127.0.0.1 line.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3137

PostPosted: Sun Mar 22, 2015 9:48 am    Post subject: Reply with quote

Yeah, export to DNS, a line in /etc/hosts, and finaly avahi (distributed, multicast DNS). 3 ways to get it done, which one is good for you depends completly on your setup
Back to top
View user's profile Send private message
mlybarger
Guru
Guru


Joined: 04 Sep 2002
Posts: 475

PostPosted: Tue Mar 24, 2015 12:43 pm    Post subject: Reply with quote

thanks for the insights. i ended up going with a "static" ip address from the router (dhcp server) and putting it into /etc/hosts.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum