Friday, August 29, 2008

Create sub-interfaces in Linux

You can easily create sub interfaces in Linux. As root issue the following commands
linux #ifconfig eth0:1
linux # ifconfig eth0:2
This creates two subinterfaces to the eth0 device.
To make the change peramanent you have to include the settings in /etc/rc.local file in your linux machine. Otherwise these changes are lost when the system is restarted.
In RedHat/Fedora machines you can copy /etc/network-scripts/network/ifcfg-eth0 to /etc/network-scripts/network/ifcfg-eth0:1 and /etc/network-scripts/network/ifcfg-eth0:2 .
This makes changes permanent in RedHat/Fedora. In the debian machines the file to change is /etc/network/interfaces.