ComputerSecurityStudent (CSS) [Login] [Join Now]




|UNIX >> Networking >> Current Page |Views: 30027

( Ubuntu Networking: ifconfig shows eth[1-9] instead of eth0 )

{ /etc/udev/rules.d/70-persistent-net.rules}


Background Information
  • Background
    • udev - dynamic device management
       
    • udev provides a dynamic device directory containing only the files for
      actually present devices. It creates or removes device node files in
      the /dev directory, or it renames network interfaces.

     

  • Reference Link: 
    • man udev

 

Prerequisite
  1. Login to your TargetUbuntu01 or TargetUbuntu02 VM, as username instructor
    • For those of you that do not have access to my class, TargetUbuntu01 and TargetUbuntu02 VMs are ubuntu Operating Systems.

     

  2. Become the root user.
    • sudo su -

 

 

Section 1: Determining your IP Address and Network Interface
  1. Determine Network Inteface
    • ifconfig -a

       

  2. Example: Valid IP Address.  Interface is wrongly named.
    • The below screen shot is an example of eth2 having a valid DHCP IP Address, but the interface is not named eth0.
      • Typically this can be corrected in two places:
        1. /etc/network/interfaces
        2. /etc/udev/rules.d/70-persistent-net.rules

     

  3. Example: No IP Address.  Wrongly named Interface.
    • Complete Sections 2 and 3 to correct both issues.

 

Section 2: How to configure the eth0 interface to use DHCP
 
  1. Configured DHCP for eth0
    • cd /etc/network
    • vi interfaces

     

  2. Analyzing the /etc/network/interfaces file
    • Keep the 3 lines in the blue rectangle.
      • Typically eth0 will be your default name for your interface in a DHCP environment. (This pertains to only one NIC card with a single interface.)

       

    • Delete the 2 lines in the red rectangle.
      • Since we want the default interface to use DHCP to acquire an IP address AND we want that interface to be named eth0, delete the two lines in the red rectangle.

     

  3. Saving the file (:wq!)
    • Press both your Shift-Key and the colon-key at the same time.
    • Type "w" and "q"
    • Press both your Shift-Key and the 1-key at the same time.

 

Section 3: How to rename eth[1-9..] to eth0
  1. cd /etc/udev/rules.d/.

     

  2. vi 70-persistent-net.rules

     

  3. Notice all the different interface names: eth0, eth1 and eth2.

     

  4. Quit out of the file (:q!)

     

  5. Backup the 70-persistent-net.rules file.
    • cp /etc/udev/rules.d/70-persistent-net.rules /var/tmp/
      • It is always a really good idea to backup files that you intended to delete.

     

  6. rm /etc/udev/rules.d/70-persistent-net.rules

     

  7. reboot
    • The "reboot" command will be necessary to rebuilt all logical interface names in the /sys/class/net directory.

 

Section 4: Check Your Work
  1. On Your TargetUbuntu02 VM
    • Login as user "instructor"

     

  2. Start up a Terminal Window

     

  3. ifconfig -a
    • Verify Interface Name and IP Address.
      • The interface is now named to eth0.
      • eth0 also has a valid DHCP IP address.

     

Proof of Lab
  1. Do a screen print of Section 4, Step 3. 
  2. Paste to a word document
  3. Submit to Moodle.


Help ComputerSecurityStudent
pay for continued research,
resources & bandwidth