(
Ubuntu Networking: ifconfig shows eth[1-9] instead of eth0 )
{ /etc/udev/rules.d/70-persistent-net.rules}
- 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:
- 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.
- Become the root user.
- sudo su -
Section 1:
Determining your IP Address and Network Interface |
- Determine Network Inteface
- 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:
- /etc/network/interfaces
- /etc/udev/rules.d/70-persistent-net.rules
- 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 |
- Configured DHCP for eth0
- cd /etc/network
- vi interfaces
- 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.
- 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 |
- cd /etc/udev/rules.d/.
- vi 70-persistent-net.rules
- Notice all the different interface names: eth0,
eth1 and eth2.
- Quit out of the file (:q!)
- 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.
- rm /etc/udev/rules.d/70-persistent-net.rules
- reboot
- The "reboot" command will be necessary to
rebuilt all logical interface names in the /sys/class/net directory.
Section 4:
Check Your Work |
- On Your TargetUbuntu02 VM
- Login as user "instructor"
- Start up a Terminal Window
- ifconfig -a
- Verify Interface Name and IP Address.
- The interface is now named to eth0.
- eth0 also has a valid DHCP IP address.
- Do a screen print of Section 4, Step 3.
- Paste to a word document
- Submit to Moodle.
|
|