How to Change Network Interface name on Ubuntu
To change Network Interface name on Ubuntu
Generally, a Network interface is named as either eth0, eth1, eth2 and etc. The network interface name depends on ethernet connections available and its number should vary from eth0 to eth1. Once Ubuntu 16.04 is installed, the network interface name gets changed from eth0 to ens33. It is quite easy to change the Network Interface name on your Ubuntu machine and this article can help you with that.
Changing the Network Interface name
You can verify your network interface name using ‘ ifconfig’ command or ‘ ip a’ command.
root@linuxhelp1:~# ifconfig
ens33 Link encap:Ethernet HWaddr 00:0c:29:31:3d:a8
inet addr:192.168.5.152 Bcast:192.168.5.255 Mask:255.255.255.0
inet6 addr: fe80::fde3:373:9789:718f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:218283 errors:0 dropped:0 overruns:0 frame:0
TX packets:134051 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:328932569 (328.9 MB) TX bytes:9267462 (9.2 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:241 errors:0 dropped:0 overruns:0 frame:0
TX packets:241 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:19860 (19.8 KB) TX bytes:19860 (19.8 KB)
Ubuntu has it network interface name as eth0 while in boot time it will automatically renamed to ens33 to verify this on use the below command.
root@linuxhelp1:~# dmesg | grep -i eth
[ 1.768429] e1000 0000:02:01.0 eth0: (PCI:66MHz:32-bit) 00:0c:29:31:3d:a8
[ 1.768435] e1000 0000:02:01.0 eth0: Intel(R) PRO/1000 Network Connection
[ 1.778278] e1000 0000:02:01.0 ens33: renamed from eth0
In order to change Network Interface name we require to edit grub configuration file as shown below.
root@linuxhelp1:~# vim /etc/default/grub
Add the following lines to it.
GRUB_CMDLINE_LINUX=" net.ifnames=0 biosdevname=0"
Next regenerate grub configuration file.
root@linuxhelp1:~# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.4.0-64-generic
Found initrd image: /boot/initrd.img-4.4.0-64-generic
Found linux image: /boot/vmlinuz-4.4.0-21-generic
Found initrd image: /boot/initrd.img-4.4.0-21-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Done
Now open the network interface file by running the following commnad.
root@linuxhelp1:~# vim /etc/network/interfaces
Add the following content to it.
auto eth0 iface eth0 inet static address 192.168.5.152 netmask 255.255.255.0 dns-nameservers 8.8.8.8 gateway 192.168.5.1
Now that’ s all just you need to reboot your system and check network interface name once again with ‘ ifconfig’ command
root@linuxhelp1:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:31:3d:a8
inet addr:192.168.5.152 Bcast:192.168.5.255 Mask:255.255.255.0
inet6 addr: fe80::fde3:373:9789:718f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:259066 errors:0 dropped:0 overruns:0 frame:0
TX packets:157287 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:390546979 (390.5 MB) TX bytes:10853428 (10.8 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:245 errors:0 dropped:0 overruns:0 frame:0
TX packets:245 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:20220 (20.2 KB) TX bytes:20220 (20.2 KB)
The network interface has been changed now. Changing the network interface was quite easy wasn' t it? Having your network interface changed may help you a lot.
Comments ( 0 )
No comments available