4

I'm creating a script which configuration the network interfaces.

The script which generates /etc/udev/rules.d/70-persistent-net.rules and names interfaces to my preference.

In CentOS 6.5, my understanding is that I also need to update files in /etc/sysconfig/network-scripts/ifcfg-eth#.

My question is about the UUID listed in ifcfg-eth#. Can I change this value to any random number using uuidgen? For a network device is it important to do it based on the MAC address or does it not matter?

In other words, could i use the the function below, or will modifying the UUID in this manner cause problems?

function make_ifcfg() {
    cat > ifcfg-eth0 <<EOF                                                                 
DEVICE=eth0                                                                                
HWADDR=${intel_MAC_addresses[0]}                                                           
TYPE=Ethernet                                                                              
UUID=$(uuidgen)                                                                          
ONBOOT=yes                                                                                 
NM_CONTROLLED=yes                                                                          
BOOTPROTO=dhcp                                                                             
EOF                                                                                        
}

Thank you.

  • personally i don't see why not, i usually clone the ifcfg-* file and do the same. – Rabin Jul 25 '14 at 10:39
  • Thanks @Rabin. Is it necessary to generate the UUID based on the mac address or it doesn't matter? – user1527227 Jul 25 '14 at 15:30
  • I usually just change one number in the string, using the mac address is a nice way to make sure your uuid is unique – Rabin Jul 26 '14 at 7:14
2

Yes, this article shows how. Keep NetworkManager in line, in case you use it.

  • The article is correct that uuidgen will generate a new UUID that can be included in the ifcfg-x file. However, including the device name with uuidgen doesn't do anything at all. To answer the OP's question, yes, you can use any UUID value (generated by uuidgen or otherwise). – cherdt Aug 10 '17 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.