Linux command to remove virtual interfaces or network aliases

Q. How do I remove virtual interfaces such as eth0:1 or eth1:1?

A. Use ifconfig command. It is used to remove virtual interfaces or network aliases.

Ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed.

Type the command to remove eth0:1:
# ifconfig eth0:1 down

/etc/sysconfig/network-scripts/ifcfg-ethX-range0 file

To remove interface permanently edit network configuration file stored at /etc/directory. For Red Hat / Fedora Core file stored in /etc/sysconfig/network-scripts/ directory. For Debian or Ubuntu Linux just edit file /etc/network/interfaces and remove the entries. For example open file called /etc/sysconfig/network-scripts/ifcfg-eth1-range0
# vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0
You will see network aliases configuration:

Just comment out everything or just rename the file:
# mv /etc/sysconfig/network-scripts/ifcfg-eth0-range0 /etc/sysconfig/network-scripts/working.ifcfg-eth0-range0.backup
Just restart network service:
# service network restart

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 5 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
5 comments… add one
  • Ravi Feb 10, 2010 @ 12:34

    Thanks Vivek, Very informative article, I hope its easy to use virtual interface, can you suggest how do I disable the alias/virtual interfaces at boot time and up this after system boot when I want manully, or through /etc/init.d/network cmd, I have already found this range file option but did not get the range break, like IPADDR_START= to
    IPADDR_END= but not start the IP how its possible


  • Jim Jun 29, 2011 @ 23:17

    Little late with this but what the hey. You must be careful using ifconfig ethx:x down. If you run more than one virtual interface on a network card taking one out of the middle will move the list up. Say if you have 4 virtual interfaces of which the first is the real eth1. So if you take out eth1:2 then eth1:3 becomes eth1:2 and eth1:4 becomes eth1:3. This may confuse some scripts that deal with virtual interfaces. Beware.

  • James Cordell Mar 2, 2012 @ 10:11

    I find this does not work for me. I am trying to remove a virtual interface

    bond0:514 Link encap:Ethernet HWaddr 00:1F:F4:F6:DF:36
    inet addr: Bcast: Mask:

    # ifconfig bond0:154 down
    SIOCSIFFLAGS: Cannot assign requested address

    im on.
    Linux 2.6.18-92.1.22.el5 #1 SMP Tue Dec 16 11:57:43 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

  • sidharth Apr 4, 2012 @ 4:46

    I have some 3 nic cards on my system. I have removed all from /etc/sysconfig/network-scripts and want to assign a single ip to the system. But still in setup I can see 3 devices present. Please help..

    Thanks in advance

  • rollnthnder Dec 17, 2014 @ 21:15

    removing a sub-interface.
    when i remove the file /etc/sysconfig/network-scripts/ifcfg-eth1:0
    my system is hosed every time.
    what’s up with that?
    i can change the ip inside eth1:0 to and the command ip addr verifies that the eth1:0
    is gone. but removing the config file, ifcfg-eth1:0 kills my eth1 connection.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum