LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Thread Tools
Old 06-13-2005, 10:21 AM   #1
hogg85
LQ Newbie
 
Registered: Jun 2005
Posts: 4
Thanked: 0
MAC Address based hostname


[Log in to get rid of this advertisement]
Ok, so here is what i have done. We created a distro for thin clients to connect to terminal services based on PCLinuxOS. It is really sweet. However, if anyone knows how to get hostnames to be dynamic (i.e. based on MAC address) please advise.
thanks HOGG
hogg85 is offline     Reply With Quote
Old 06-13-2005, 11:13 AM   #2
demian
Member
 
Registered: Apr 2001
Location: Bremen, Germany
Distribution: Debian
Posts: 303
Thanked: 0
The hostname is set during startup using the command "hostname". Most distributions read the name in from a file but you can give the hostname command any input you want. If you use ifconfig and grep or perl or whatever I'm sure you can set it to the mac address. Quick'n'dirty example:

hostname `ifconfig -a|grep eth0 |awk '{print $5}'`
demian is offline     Reply With Quote
Old 06-13-2005, 01:51 PM   #3
hogg85
LQ Newbie
 
Registered: Jun 2005
Posts: 4
Thanked: 0

Original Poster
Ok, that is perfect. But what file do I put this in? /etc/hosts?
Thanks Hogg
hogg85 is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCP seems to set hostname = Mac address, doesn't reverse lookup techsimian Linux - Networking 4 08-15-2006 05:11 PM
Can I deny access based on mac or IP address with shorewall? enigma_0Z Linux - Networking 1 06-02-2005 05:15 PM
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 05:33 AM
restricting service based on mac address sixth_sense Linux - Networking 3 09-28-2004 09:59 PM
Get IP based on Mac address sunmiewon Linux - Networking 4 01-31-2004 07:18 PM


All times are GMT -5. The time now is 03:16 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration