Tutorial kali ini berhubungan dengan cara mengganti nama eth pada ubuntu,bisa juga diterapkan pada semua keturunan debian. Tutorial ini telah saya coba pada ubuntu 12.04 LTS (server).
baiklah langsung saja,konfigurasi yang akan dirubah berada dalam file "70-persistent-net.rules"dalam direkcori "/etc/udev/rules.d/".
sebelumnya,cek mac address lan card dengan perintah
$ ifconfig
Gunakan editor kesayangan anda, misalnya nano:
$ sudo su
#nano /etc/udev/rules.d/70-persistent-net.rules
isinya kurang lebih seperti ini :
# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:03.0 (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:fa:9d:a8", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:08.0 (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:5a:c0:06", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:03.0 (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:e1:82:ce", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
yang perlu diperhatikan adalah : ATTR{address}=="08:00:27:e1:82:ce" dan NAME=""
misalnya kita ingin menamai lancard dengan mac address "08:00:27:e1:82:ce" dengan nama LAN
maka ganti name pada mac address 08:00:27:e1:82:ce, kurang lebih menjadi seperti ini :
#reboot
karena nama interface sudah diganti, maka kita juga harus mengganti pengaturasn di "/etc/network/interfaces"
# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:03.0 (e1000)setelah itu restart komputer
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:e1:82:ce", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="lan"
#reboot
karena nama interface sudah diganti, maka kita juga harus mengganti pengaturasn di "/etc/network/interfaces"
$sudo su
#nano /etc/network/interfacesjika sebelumnya :
auto eth2rubah menjadi
iface eth2 inet static
address 172.16.1.2
netmask 255.255.255.0
gateway 172.16.1.1
dns-nameservers 172.16.1.1
auto lan
iface lan inet static
address 172.16.1.2
netmask 255.255.255.0
gateway 172.16.1.1
dns-nameservers 172.16.1.1
jangan lupa restart service networknya
# /etc/init.d/networking restart
Contoh :
Code:
nano /etc/udev/rules.d/70-persisten-net.rules
Code:
# This file was automatically generated by the /lib/udev/write_net_rules # program, run by the persistent-net-generator.rules rules file. # # You can modify it, as long as you keep each rule on a single # line, and change only the value of the NAME= key. # PCI device 0x1106:0x3065 (via-rhine) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4d:87:c6:b7", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1" # PCI device 0x1904:0x8139 (sc92031) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="20:00:9b:42:a0:c6", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # PCI device 0x10ec:0x8139 (8139too) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:bf:76:eb:34", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
rename aja