Linux command to remove virtual interfaces or network aliases

by Vivek Gite · 1 comment

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:
IPADDR_START=192.167.1.5
IPADDR_END=192.167.1.100
CLONENUM_START=0
NETMASK=255.255.255.0

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

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 1 comment… read it below or add one }

1 Ravi 02.10.10 at 12:34 pm

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=10.0.0.241 to
IPADDR_END=10.0.0.249 but not start the IP 10.0.0.242 how its possible

Ravi

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All