Configure trunk interface in linux centos7

centos7interfacelinux-networkingtrunkvlan

I have connected 2 trunk interface to server(centos 7 server) nic port for setup vlan tagging.

And have enabled 8021q module in server.

Configure two physical interfaces as bonding as below

Physical Interface 1: /etc/sysconfig/network-scripts/ifcfg-eno5

DEVICE=eno5
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond0
SLAVE=yes
USERCTL=no

Physical Interface 2: /etc/sysconfig/network-scripts/ifcfg-eno6

DEVICE=eno6
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond0
SLAVE=yes
USERCTL=no

bond0 config file: /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
NM_CONTROLLED=no
NAME=bond0
TYPE=Bond
BONDING_MASTER=yes
BONDING_OPTS="mode=802.1q miimon=100 lacp_rate=1 xmit_hash_policy=layer2 updelay=200 downdelay=200"

Then i created vlan tag interface for vlan communication

vlan 91 config: /etc/sysconfig/network-scripts/ifcfg-bond0.91

DEVICE=bond0.91
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
NM_CONTROLLED=no
VLAN=yes
VLAN_ID=91
ONPARENT=yes
PHYSDEV=bond0
IPADDR=192.168.91.1
PREFIX=24
NETWORK=192.168.91.0
GATEWAY=192.168.91.100

vlan 89 config: /etc/sysconfig/network-scripts/ifcfg-bond0.89

DEVICE=bond0.89
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
NM_CONTROLLED=no
VLAN=yes
VLAN_ID=89
ONPARENT=yes
PHYSDEV=bond0
IPADDR=192.168.89.11
PREFIX=24
NETWORK=192.168.89.0
GATEWAY=192.168.89.100

but at a time i can ping only one vlan either of two vlans.

Also enabled static route in centos serves side.(route and rule files for interfaces)

Any idea to configuration work properly?

Best Answer

Try this:

# echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
# sysctl -p