In my server I have two nics, eth0 that's a dedicated interface and eth1 that's has configured as trunk on my vmware. In eth1 I need to create multiple vlan's. I was able to do it but I can't redirect the traffics between each vlan. For example:

The gateway of this vlan is

When I do ping -I return unreachable network, seems that I am missing a route.

  • 2
    It's not entirely clear which addresses are assigned to which vlan, but what you have said seems to imply that the vlans are sharing the same /24 subnet. You should use different subnets for the vlans. Jul 6 '17 at 12:23
  • My vlans vlan96 vlan97 vlan98 Jul 6 '17 at 13:43

Besides setting up the NICs, VLANs and networks properly, for doing routing in your linux server you also need to add to your /etc/sysctl.conf the following lines:

The first for IP forwarding:

net.ipv4.ip_forward = 1

The second for disabling anti-spoofing rules, to be able to use several networks in the same NIC:


To activate those rules, do:

sudo sysctl -p
  • I did this but stil the same. This is my network config link Jul 6 '17 at 16:49
  • Your network config looks ok to me (although the addresses are different than the ones in your question). Could you please elaborate a bit on your setup; what is the network topology, what is virtual (vmware) and what is physical, what you expect to work but doesn't and the exact error message? Jul 6 '17 at 19:47
  • @AndréBolinhas Network config seems ok. Jul 6 '17 at 20:07

See the ip route command.

If you ran ip route list you would not see in your routing table.

You can create a route using:

ip route add [IP]/[PREFIX] dev [INTERFACE] via [GATEWAY]

There are more options, check man ip-route if you need more flexibility.

So for your example you need:

ip route add dev eth1 via
  • The OP has used a Debian tag. /etc/sysconfig is RH specific. Jul 6 '17 at 12:23
  • 1
    @RuiFRibeiro Removed the /etc/sysconfig mention, didn't realize that was RH specific.
    – Centimane
    Jul 6 '17 at 12:29
  • This is my network config link Jul 6 '17 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.