LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > 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
  Search this Thread
Old 06-13-2005, 09:21 AM   #1
hogg85
LQ Newbie
 
Registered: Jun 2005
Posts: 4

Rep: Reputation: 0
MAC Address based hostname


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
 
Old 06-13-2005, 10:13 AM   #2
demian
Member
 
Registered: Apr 2001
Location: Bremen, Germany
Distribution: Debian
Posts: 303

Rep: Reputation: 30
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}'`
 
Old 06-13-2005, 12:51 PM   #3
hogg85
LQ Newbie
 
Registered: Jun 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Ok, that is perfect. But what file do I put this in? /etc/hosts?
Thanks Hogg
 
  


Reply



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 04:11 PM
Can I deny access based on mac or IP address with shorewall? enigma_0Z Linux - Networking 1 06-02-2005 04:15 PM
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 04:33 AM
restricting service based on mac address sixth_sense Linux - Networking 3 09-28-2004 08:59 PM
Get IP based on Mac address sunmiewon Linux - Networking 4 01-31-2004 06:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:44 AM.

Main Menu
Advertisement
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
Twitter: @linuxquestions
Open Source Consulting | Domain Registration