This article describes the issue with sflow, when the collector is reachable via me0 (management port) and and an alternate route is available to the collector via a network port.
Sflow does not work with me0 as the agent IP, when there is an alternate route to the collector via a network port.
(xe-0/0/4)EX8200(me0)-------(ge-0/0/0)EX4200(ge-0/0/23)--------Server with sflow utility
sflow { agent-id 192.168.148.10; polling-interval 5; sample-rate { ingress 10; egress 10; } source-ip 192.168.148.10; collector 192.168.18.166 { udp-port 6343; } interfaces xe-0/0/0.0 { sample-rate { ingress 1; egress 1; } } }
root> show sflow collector Collector Udp-port No. of samples address 192.168.18.166 6343 4484266 root> show sflow collector Collector Udp-port No. of samples address 192.168.18.166 6343 4484269 <----- Number of samples increasing
root> show sflow collector Collector Udp-port No. of samples address 192.168.18.166 6343 4484266 root> show sflow collector Collector Udp-port No. of samples address 192.168.18.166 6343 4484269
<----- Number of samples increasing
The route lookup for the collector at the kernel and PFE are different, which is the cause of this issue.
root# run show route 192.168.18.166 inet.0: 16 destinations, 16 routes (16 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 192.168.18.128/25 *[Static/5] 02:42:23 > to 192.168.148.11 via me0.0
[edit] root# run show pfe route ip Slot 0 IPv4 Route Table 0, default.0, 0x0: Destination NH IP Addr Type NH ID Interface ------------ --------------- -------- ----- --------- default 24.114.112.161 Unicast 1358 RT-ifl 0 ae0.0 ifl 67 <-- default route pointing towards a network port
You have to set a static receive route towards the collector for appropriate forwarding of the packet.
[edit routing-options static] root# show route 192.168.18.166/32 next-hop 192.168.148.11; <--- Best route via me0 route 192.168.18.164/30 receive; <--- Second best route towards collector
[edit routing-options static] root# show route 192.168.18.166/32 next-hop 192.168.148.11; <--- Best route via me0 route 192.168.18.164/30 receive;
<--- Second best route towards collector