Description

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.


Symptoms

Sflow does not work with me0 as the agent IP, when there is an alternate route to the collector via a network port.


Topology
(xe-0/0/4)EX8200(me0)-------(ge-0/0/0)EX4200(ge-0/0/23)--------Server with sflow utility
  • EX8200's xe-0/0/4 - sflow interface

  • EX8200's me0 - 192.168.148.10

  • Ex4200 - Layer3 router

  • Collector IP  - 192.168.18.166

Sflow configuration

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;
     }
}
}

Sflow sample counter is increasing, but the packets will not go out of me0. 
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 

Solution

The route lookup for the collector at the kernel and PFE are different, which is the cause of this issue. 

  • Route in kernel pointing to me0; as intended: >
    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

  • Route in PFE (The only matching route is the default route which points to a network port)
    [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.

  1. Assume the collector IP is IP1. Add a static route to IP1, as the best route via me0 to reach the collector.

  • Add an additional static receive route, which should be the second best route to the collector.

For example:

[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