2

I'm in need of some assistance troubleshooting a policy routing issue.

I have a linux host with multiple VLANs. I'm trying to create a unique routing table for each VLAN (20 in this example) and I can ping bidirectionally between the host and the router (default gateway) on VLAN20. However, when I send traffic to an off network IP, the ubuntu server is sending ARP requests for these IPs instead of sending the traffic through the gateway.

Ubuntu Host VLAN20: 192.168.20.50

Router interface VLAN20: 192.168.20.1

Created the table "vlan20"

$ cat /etc/iproute2/rt_tables
# # reserved values
# 255 local
254 main
253 default
220 vlan20
0 unspec #
#local
#1inr.ruhep

Created rule to send all traffic sourced from VLAN20 interface using table vlan20

$ ip rule show
0: from all lookup local
32765: from 192.168.20.50 lookup vlan20
32766: from all lookup main
32767: from all lookup default

routing all traffic to the router vlan20 interface

 $ ip route list table vlan20
default via 192.168.20.1 dev eth0.20
192.168.20.0/24 dev eth0.20  scope link

testing from linux host

ping 8.8.8.8 -I eth0.20
PING 8.8.8.8 (8.8.8.8) from 192.168.20.50 eth0.20: 56(84) bytes of data.                             
192.168.20.50 icmp_seq=1 Destination Host Unreachable

From Router VLAN20 interface

 9.568940 arp who-has 8.8.8.8 tell 192.168.20.50
 10.565495 arp who-has 8.8.8.8 tell 192.168.20.50

Route from Ubuntu kernel

# ip route get 8.8.8.8 dev eth0.20
8.8.8.8 dev eth0.20  src 192.168.20.50
cache

Thanks for your assistance! I haven't had any luck figuring this out.

1 Answers1

2

Your ping attempt is binding to the interface (by specifying -I eth0.20) - not the address, and there is no interface route.

If you add an output-interface rule to use the vlan20 table, it will use the next-hop gateway instead of attempting to make an ARP request. i.e.

ip rule add oif eth0.20 lookup vlan20

You will find a rather long explanation, and examples of this occurring in my other answer found here: https://stackoverflow.com/a/47613538/471825

kylehuff
  • 121