LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-16-2014, 06:16 PM   #1
5883
Member
 
Registered: Aug 2004
Posts: 173

Rep: Reputation: 0
How to generate a uuid for eth0 from command line ?


hi, if you have NetworkManager, you can check the uuid value in its config files.

Now how does it come up with this uuid in the first place ?
i need to manually generate uuid for eth0.

The real question is, how to change dhcp to static ip from command line if you are using ubuntu 12.04 ?

Thanks !
 
Old 01-17-2014, 01:40 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by 5883 View Post
The real question is, how to change dhcp to static ip from command line if you are using ubuntu 12.04 ?
On a non-Ubuntu Debian system (raspbian, to be precise), the file /etc/network/interfaces contains the network interfaces descriptions. On my system:
Code:
iface eth0 inet static
        address 192.168.1.16
        netmask 255.255.255.0
        gateway 192.168.1.1
For more info, try man interfaces.

I can't answer your question about the UUID though.
 
Old 01-17-2014, 03:41 AM   #3
anon237
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by 5883 View Post
hi, if you have NetworkManager, you can check the uuid value in its config files.

Now how does it come up with this uuid in the first place ?
i need to manually generate uuid for eth0.
Network interfaces do not have an UUID, they do have an unique hardware address (HWaddr).

You don't tell us why you need to generate this value. Generally you don't need to provide one, the network interface already has a unique hw address.

If you do want to create one: The general layout is 6 two digit fields separated by a colon (a1:b2:c3:d4:e5:f6), each digit is made up of a number from 0 to F (hexadecimal). Any random combination will do as long as it is not the same as other (virtual) network interfaces on your box.

Here's a one-liner that will generate a random hwaddr:
Code:
openssl rand -hex 6 | sed 's/\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)/\1:\2:\3:\4:\5:\6/'
 
Old 01-17-2014, 04:06 AM   #4
ericson007
Member
 
Registered: Sep 2004
Location: Japan
Distribution: RHEL9.4
Posts: 735

Rep: Reputation: 154Reputation: 154
Network manager doesn't create the uuid. The system does.

Never tried with nics, but with hdd you can use blkid to get the uuid.

I still am not sure on a small system why it is useful, but on a cluster that is centrally managed containing 300 network cards, the uuid can help out by identifying the actual component rather than eth0 since hundreds of systems would contain eth0

You can also use uuid to mount your partitions etc.
 
Old 01-17-2014, 04:48 AM   #5
anon237
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
I've never come across a uuid entry for network interfaces, but some research shows that it can be present.

Anyway: If you want/need to generate a random UUID: Have a look at the uuidgen command (uuidgen(1) - Linux man page)
 
Old 01-17-2014, 06:15 AM   #6
ericson007
Member
 
Registered: Sep 2004
Location: Japan
Distribution: RHEL9.4
Posts: 735

Rep: Reputation: 154Reputation: 154
Uuid is generated as standard on rhel and derivatives. I honestly don't bother with them, if they are there after install, i leave them, but if i manually do fstab entries or nic configs, i don't bother since on a single system i find they make it more difficult to understand which component is involved.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change UUID - Edit UUID using the dd command GMHilltop Linux - Newbie 10 10-28-2010 07:39 PM
[SOLVED] Generate /boot/grub/menu.lst with UUID instead of mapped name? uhcafigdc Linux - Software 6 08-03-2010 03:40 PM
how to configure my eth0? (from the command line) criacuervo Linux - Newbie 5 02-21-2009 12:16 AM
getting eth0 up from command line dannyk1 Linux - Networking 6 12-21-2005 04:16 AM
Who to configure eth0 to use dhco from command line waelaltaqi Linux - Networking 3 11-18-2005 06:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:34 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