0

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:

eth1.96
ip: 192.168.3.2/24
The gateway of this vlan is 192.168.3.1

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

2
  • 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 192.168.3.0/24 vlan97 192.168.4.0/24 vlan98 192.168.5.0/24 Jul 6 '17 at 13:43
1

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:

net.ipv4.conf.all.rp_filter=0

To activate those rules, do:

sudo sysctl -p
3
  • 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
0

See the ip route command.

If you ran ip route list you would not see 192.168.3.0 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 192.168.3.0/24 dev eth1 via 192.168.3.1
3
  • 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.