Configuring ethernet port in trunk mode

From Notes_Wiki

Home > CentOS > CentOS 6.x > Network configuration > Network interface configuration > Configuring ethernet port in trunk mode

There is new article on this at CentOS 8.x Configure ethernet port for 802.3 encapsulated trunk traffic communication

Assuming eth0 is to configured in trunk mode and VLAN 127 has to be used using 802.1q over eth0, follow these steps: (Note that device can be changed to eth1, eth2, etc. and vlan number can also be changed from 127. 127 is used just for illustration)

  1. Go to /etc/sysconfig/network-scripts
  2. Copy file 'ifcfg-eth0' to 'ifcfg-eth0.127'
  3. Set 'BOOTPROTO=none' in ifcfg-eth0
  4. Set 'DEVICE=eth0.127' and 'VLAN=yes' in ifcfg-eth0.127. You can also do normal interface configuration like
    BOOTPROTO=static
    ONBOOT=yes
    IPADDR=
    NETMASK=
    GATEWAY=
    DNS1=
    DNS2=
    and so on.
  5. Run service network restart. In case you do not see device eth0.127 up and working then try command 'vconfig eth0 add 127' and then again restart network.

Note that it is not same as aliasing where both eth0 and eth0:1 has same device name in routing. Using above procedure a different device with name eth0.127 gets created and we can use it in routing tables.


Home > CentOS > CentOS 6.x > Network configuration > Network interface configuration > Configuring ethernet port in trunk mode