How to change a network interface name on CentOS/RHEL 7

Posted In Network - By Tum. On Friday, March 6th, 2015 With 0 Comments

โดยทั่วไปแล้ว network interface ของ Linux จะมีชื่อว่า eth0 eth1 … ethx แต่เนื่องจากชื่อของ network interface ไม่ได้สื่อถึง hardware ของ network interface นั้น ทำให้เราไม่สามารถรู้ได้ว่า eth0 eth1 … เป็น hardware แบบไหน จึงทำให้เกิด naming rule สำหรับ network interface ขึ้นมาโดยการตั้งชื่อจะอิงตาม firmware, topology, และ location information

ใน CentOS/RHEL 6 ได้มีการนำ naming rule เข้ามาใช้งานแต่ไม่ได้เปิดใช้งานเป็น default แต่สำหรับ CentOS/RHEL 7 ได้มีการเปิดใช้งาน naming rule เป็นค่า default ดังนั้นเราจะเห็นชื่อ network interface แปลกขึ้นมาแทน eth0 eth1 …

หลักการตั้งขื่อใหม่เป็นดังนี้

  • 2 character หน้าจะหมายถึงชนิดของ interface
  • ส่วน character ที่เหลือมีความหมายดังนี้

ตัวอย่างชื่อ network interface
eno16777736 หมายถึง ethernet on board ที่มี index ของ device ที่ provided โดย firmware (BIOS/EFI) เป็น 16777736
ดูข้อมูลเพิ่มเติมของ network interface

การแก้ไข network interface name ให้กลับเป็น ethx สามารถทำได้ดังนี้

วิธีที่ 1
แก้ไขไฟล์ /etc/default/grub โดยเพิ่ม

วิธีที่ 2
ปิดการใช้งาน naming rule โดยการทำ symbolic link ไปยัง /dev/null

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

*