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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-16-2014, 06:16 PM
|
#1
|
Member
Registered: Aug 2004
Posts: 173
Rep:
|
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 !
|
|
|
01-17-2014, 01:40 AM
|
#2
|
LQ Addict
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316
|
Quote:
Originally Posted by 5883
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.
|
|
|
01-17-2014, 03:41 AM
|
#3
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Quote:
Originally Posted by 5883
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/'
|
|
|
01-17-2014, 04:06 AM
|
#4
|
Member
Registered: Sep 2004
Location: Japan
Distribution: RHEL9.4
Posts: 735
Rep: 
|
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.
|
|
|
01-17-2014, 04:48 AM
|
#5
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
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)
|
|
|
01-17-2014, 06:15 AM
|
#6
|
Member
Registered: Sep 2004
Location: Japan
Distribution: RHEL9.4
Posts: 735
Rep: 
|
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.
|
|
|
All times are GMT -5. The time now is 10:34 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|