Add VLAN and IP Range


Add a VLAN and a range of IP numbers on that VLAN to a centos/redhat server.

Create a file like so.. (118 is the vlan id)
/etc/sysconfig/network-scripts/ifcfg-eth0.118

DEVICE=eth0.118
BOOTPROTO=STATIC
IPADDR=192.168.1.188
NETMASK=255.255.255.0
VLAN=yes
ONBOOT=yes

Then create an range file with teh vlan id like so..
/etc/sysconfig/network-scripts/ifcfg-eth0.118-range0

Change the 0 on the end to 1 or whatever if another already exists.

Enter the ip range details like so..

IPADDR_START=192.168.1.189
IPADDR_END=192.168.1.240
CLONENUM_START=1
NETMASK=255.255.255.0

Save the file and restart networking..

service network reload

Note: CLONENUM_START is the number of the virtual interface to start from. You can see what is currently used by running ifconfig then just increment the last eth0.118:x number by one in the file above.

  Tags:

Looking for great online sysadmin training in Linux, Security & Hacking and many others?

Back