Netflow Forward

These scenarios show how to configure and use Netflow to collect and export TCP forwarded flows. Different NAT topologies are described.

../../../_images/topologyfwd.svg

Netflow Without NAT

Description

Simple scenario without NAT configuration.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.0.0.2/24
set interfaces ethernet eth0 flow egress selector TCP_SEL
set interfaces ethernet eth0 flow ingress selector TCP_SEL
set interfaces ethernet eth1 address 20.0.0.2/24
set system conntrack app-detect
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system netflow app-id
set system netflow destination 10.0.0.1
set system netflow engine-id 1111
set traffic selector TCP_SEL rule 1 protocol tcp

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address 10.0.0.1/24
set protocols static route 0.0.0.0/0 next-hop 10.0.0.2
set system conntrack app-detect
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Set the following configuration in DUT2 :

set interfaces ethernet eth0 address 20.0.0.1/24
set protocols static route 0.0.0.0/0 next-hop 20.0.0.2
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 4: Run command system conntrack clear at DUT1.

Step 5: Ping IP address 10.0.0.1 from DUT0:

admin@DUT0$ ping 10.0.0.1 count 1 size 56 timeout 1
Show output
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.206 ms

--- 10.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.206/0.206/0.206/0.000 ms

Step 6: Ping IP address 20.0.0.1 from DUT0:

admin@DUT0$ ping 20.0.0.1 count 1 size 56 timeout 1
Show output
PING 20.0.0.1 (20.0.0.1) 56(84) bytes of data.
64 bytes from 20.0.0.1: icmp_seq=1 ttl=64 time=0.299 ms

--- 20.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.299/0.299/0.299/0.000 ms

Step 7: Initiate a tcp connection from DUT1 to DUT2 and try to send some messages between both endpoints

admin@DUT2$ monitor test connection server 8080 tcp
admin@DUT1$ monitor test connection client 20.0.0.1 8080 tcp

Step 8: Run command system netflow show flows detailed at DUT0 and check if output matches the following regular expressions:

2\s+3\s+10.0.0.1:\d+\s+20.0.0.1:\d+\s*\d*\s*\d+[^\[]*\[L4:8080\]
Show output
------------------------------------------------------------------------------------------
Field       Description
------------------------------------------------------------------------------------------
#           Numeric flow identifier
hash        Hash of the flow
a           Shows if the flow is pending of being exported
iif         Input interface
oif         Output interface
src         Source IP:PORT
dst         Destination IP:PORT
protocol    Protocol identifier
nexthop     Next-hop [Layer 4:Port]
tos         Type of service identificator
tcpflags    TCP flags
options     Optional IP options
tcpoptions  TCP Options (MSS, Window Scaling, Selective Acknowledgements, Timestamps, Nop)
pkts        Packets counter
bytes       Bytes counter
ts_first    Timestamp of fist packet that passed through the flow
ts_last     Timestamp of last packet that passed through the flow


----------------------------------------------------------------------------------------------------------------------------------------------------
#  hash  a  iif  oif  src             dst             protocol  nexthop           tos  tcpflags  options  tcpoptions  pkts  bytes  ts_first  ts_last
----------------------------------------------------------------------------------------------------------------------------------------------------
1  9aa4  0  2    3    10.0.0.1:58152  20.0.0.1:8080   8080      0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  13    784    449       65
2  65de  0  3    2    20.0.0.1:8080   10.0.0.1:58152  58152     0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  11    680    448       65

Step 9: Run command system netflow show flows detailed at DUT0 and check if output matches the following regular expressions:

3\s+2\s+20.0.0.1:\d+\s+10.0.0.1:\d+\s*\d*\s*\d+[^\[]*\[L4:8080\]
Show output
------------------------------------------------------------------------------------------
Field       Description
------------------------------------------------------------------------------------------
#           Numeric flow identifier
hash        Hash of the flow
a           Shows if the flow is pending of being exported
iif         Input interface
oif         Output interface
src         Source IP:PORT
dst         Destination IP:PORT
protocol    Protocol identifier
nexthop     Next-hop [Layer 4:Port]
tos         Type of service identificator
tcpflags    TCP flags
options     Optional IP options
tcpoptions  TCP Options (MSS, Window Scaling, Selective Acknowledgements, Timestamps, Nop)
pkts        Packets counter
bytes       Bytes counter
ts_first    Timestamp of fist packet that passed through the flow
ts_last     Timestamp of last packet that passed through the flow


----------------------------------------------------------------------------------------------------------------------------------------------------
#  hash  a  iif  oif  src             dst             protocol  nexthop           tos  tcpflags  options  tcpoptions  pkts  bytes  ts_first  ts_last
----------------------------------------------------------------------------------------------------------------------------------------------------
1  9aa4  0  2    3    10.0.0.1:58152  20.0.0.1:8080   8080      0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  13    784    469       85
2  65de  0  3    2    20.0.0.1:8080   10.0.0.1:58152  58152     0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  11    680    468       85

Step 10: Run command system netflow show status at DUT0 and check if output matches the following regular expressions:

Protocol\sversion\s10\s\(ipfix\)
Export:.*Errors 0 pkts
sock0:\s127.0.0.1:2055,.*err: sndbuf reached 0, connect 0, cberr 0, other 0
Show output
ipt_NETFLOW 2.6, srcversion 4478226DE87DE64E62C28A3; dir
Protocol version 10 (ipfix), refresh-rate 20, timeout-rate 30, (templates 0, active 1).
Timeouts: active 1800s, inactive 15s. Maxflows 2000000
Flows: active 2 (peak 2 reached 0d0h0m ago), mem 492K, worker delay 25/250 [1..25] (48 ms, 0 us, 2:0 [cpu0]).
Hash: size 62967 (mem 491K), metric 1.00 [1.00, 1.00, 1.00]. InHash: 24 pkt, 1 K, InPDU 0, 0.
Rate: 0 bits/sec, 0 packets/sec; Avg 1 min: 0 bps, 0 pps; 5 min: 0 bps, 0 pps
cpu#     pps; <search found new [metric], trunc frag alloc maxflows>, traffic: <pkt, bytes>, drop: <pkt, bytes>
Total      0;      0     35      2 [1.00],    0    0    0    0, traffic: 24, 0 MB, drop: 0, 0 K
cpu0       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
cpu1       0;      0     35      2 [1.00],    0    0    0    0, traffic: 24, 0 MB, drop: 0, 0 K
cpu2       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
cpu3       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
Export: Rate 120 bytes/s; Total 2 pkts, 0 MB, 0 flows; Errors 0 pkts; Traffic lost 0 pkts, 0 Kbytes, 0 flows.
sock0: 127.0.0.1:2055, sndbuf 212992, filled 1, peak 1; err: sndbuf reached 0, connect 0, cberr 0, other 0

Netflow With SNAT

Description

Scenario with SNAT in DUT0 WAN interface (eth1).

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.0.0.2/24
set interfaces ethernet eth0 flow egress selector TCP_SEL
set interfaces ethernet eth0 flow ingress selector TCP_SEL
set interfaces ethernet eth1 address 20.0.0.2/24
set interfaces ethernet eth1 traffic nat source rule 1 address masquerade
set interfaces ethernet eth1 traffic nat source rule 1 selector TCP_SEL
set system conntrack app-detect
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system netflow app-id
set system netflow destination 10.0.0.1
set system netflow engine-id 1111
set traffic selector TCP_SEL rule 1 protocol tcp

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address 10.0.0.1/24
set protocols static route 0.0.0.0/0 next-hop 10.0.0.2
set system conntrack app-detect
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Set the following configuration in DUT2 :

set interfaces ethernet eth0 address 20.0.0.1/24
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 4: Run command system conntrack clear at DUT1.

Step 5: Ping IP address 10.0.0.1 from DUT0:

admin@DUT0$ ping 10.0.0.1 count 1 size 56 timeout 1
Show output
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.231 ms

--- 10.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.231/0.231/0.231/0.000 ms

Step 6: Ping IP address 20.0.0.1 from DUT0:

admin@DUT0$ ping 20.0.0.1 count 1 size 56 timeout 1
Show output
PING 20.0.0.1 (20.0.0.1) 56(84) bytes of data.
64 bytes from 20.0.0.1: icmp_seq=1 ttl=64 time=0.280 ms

--- 20.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.280/0.280/0.280/0.000 ms

Step 7: Initiate a tcp connection from DUT1 to DUT2 and try to send some messages between both endpoints

admin@DUT2$ monitor test connection server 8080 tcp
admin@DUT1$ monitor test connection client 20.0.0.1 8080 tcp

Step 8: Run command system netflow show flows detailed at DUT0 and check if output matches the following regular expressions:

2\s+3\s+10.0.0.1:\d+\s+20.0.0.1:\d+\s*\d*\s*\d+[^\[]*\[L4:8080\]
Show output
------------------------------------------------------------------------------------------
Field       Description
------------------------------------------------------------------------------------------
#           Numeric flow identifier
hash        Hash of the flow
a           Shows if the flow is pending of being exported
iif         Input interface
oif         Output interface
src         Source IP:PORT
dst         Destination IP:PORT
protocol    Protocol identifier
nexthop     Next-hop [Layer 4:Port]
tos         Type of service identificator
tcpflags    TCP flags
options     Optional IP options
tcpoptions  TCP Options (MSS, Window Scaling, Selective Acknowledgements, Timestamps, Nop)
pkts        Packets counter
bytes       Bytes counter
ts_first    Timestamp of fist packet that passed through the flow
ts_last     Timestamp of last packet that passed through the flow


----------------------------------------------------------------------------------------------------------------------------------------------------
#  hash  a  iif  oif  src             dst             protocol  nexthop           tos  tcpflags  options  tcpoptions  pkts  bytes  ts_first  ts_last
----------------------------------------------------------------------------------------------------------------------------------------------------
1  0e24  0  3    2    20.0.0.1:8080   10.0.0.1:54192  54192     0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  13    784    453       33
2  179b  0  2    3    10.0.0.1:54192  20.0.0.1:8080   8080      0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  14    836    453       33

Step 9: Run command system netflow show flows detailed at DUT0 and check if output matches the following regular expressions:

3\s+2\s+20.0.0.1:\d+\s+10.0.0.1:\d+\s*\d*\s*\d+[^\[]*\[L4:8080\]
Show output
------------------------------------------------------------------------------------------
Field       Description
------------------------------------------------------------------------------------------
#           Numeric flow identifier
hash        Hash of the flow
a           Shows if the flow is pending of being exported
iif         Input interface
oif         Output interface
src         Source IP:PORT
dst         Destination IP:PORT
protocol    Protocol identifier
nexthop     Next-hop [Layer 4:Port]
tos         Type of service identificator
tcpflags    TCP flags
options     Optional IP options
tcpoptions  TCP Options (MSS, Window Scaling, Selective Acknowledgements, Timestamps, Nop)
pkts        Packets counter
bytes       Bytes counter
ts_first    Timestamp of fist packet that passed through the flow
ts_last     Timestamp of last packet that passed through the flow


----------------------------------------------------------------------------------------------------------------------------------------------------
#  hash  a  iif  oif  src             dst             protocol  nexthop           tos  tcpflags  options  tcpoptions  pkts  bytes  ts_first  ts_last
----------------------------------------------------------------------------------------------------------------------------------------------------
1  0e24  0  3    2    20.0.0.1:8080   10.0.0.1:54192  54192     0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  13    784    496       76
2  179b  0  2    3    10.0.0.1:54192  20.0.0.1:8080   8080      0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  14    836    496       76

Step 10: Run command system netflow show status at DUT0 and check if output matches the following regular expressions:

Protocol\sversion\s10\s\(ipfix\)
Export:.*Errors 0 pkts
sock0:\s127.0.0.1:2055,.*err: sndbuf reached 0, connect 0, cberr 0, other 0
Show output
ipt_NETFLOW 2.6, srcversion 4478226DE87DE64E62C28A3; dir
Protocol version 10 (ipfix), refresh-rate 20, timeout-rate 30, (templates 0, active 1).
Timeouts: active 1800s, inactive 15s. Maxflows 2000000
Flows: active 2 (peak 2 reached 0d0h0m ago), mem 492K, worker delay 25/250 [1..25] (0 ms, 0 us, 2:0 [cpu3]).
Hash: size 62967 (mem 491K), metric 1.00 [1.00, 1.00, 1.00]. InHash: 27 pkt, 1 K, InPDU 0, 0.
Rate: 344 bits/sec, 0 packets/sec; Avg 1 min: 288 bps, 0 pps; 5 min: 76 bps, 0 pps
cpu#     pps; <search found new [metric], trunc frag alloc maxflows>, traffic: <pkt, bytes>, drop: <pkt, bytes>
Total      0;      0     74      4 [1.00],    0    0    0    0, traffic: 51, 0 MB, drop: 0, 0 K
cpu0       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
cpu1       0;      0     74      4 [1.00],    0    0    0    0, traffic: 51, 0 MB, drop: 0, 0 K
cpu2       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
cpu3       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
Export: Rate 118 bytes/s; Total 6 pkts, 0 MB, 0 flows; Errors 0 pkts; Traffic lost 24 pkts, 1 Kbytes, 2 flows.
sock0: 127.0.0.1:2055, sndbuf 212992, filled 1, peak 1; err: sndbuf reached 0, connect 0, cberr 0, other 0

Netflow With DNAT

Description

Scenario with DNAT in DUT0 LAN interface (eth0).

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.0.0.2/24
set interfaces ethernet eth0 flow egress selector TCP_SEL
set interfaces ethernet eth0 flow ingress selector TCP_SEL
set interfaces ethernet eth0 traffic nat destination rule 1 address 20.0.0.1
set interfaces ethernet eth0 traffic nat destination rule 1 selector TCP_SEL
set interfaces ethernet eth1 address 20.0.0.2/24
set system conntrack app-detect
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system netflow app-id
set system netflow destination 10.0.0.1
set system netflow engine-id 1111
set traffic selector TCP_SEL rule 1 protocol tcp

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address 10.0.0.1/24
set system conntrack app-detect
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Set the following configuration in DUT2 :

set interfaces ethernet eth0 address 20.0.0.1/24
set protocols static route 0.0.0.0/0 next-hop 20.0.0.2
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 4: Run command system conntrack clear at DUT1.

Step 5: Ping IP address 10.0.0.1 from DUT0:

admin@DUT0$ ping 10.0.0.1 count 1 size 56 timeout 1
Show output
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.238 ms

--- 10.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.238/0.238/0.238/0.000 ms

Step 6: Ping IP address 20.0.0.1 from DUT0:

admin@DUT0$ ping 20.0.0.1 count 1 size 56 timeout 1
Show output
PING 20.0.0.1 (20.0.0.1) 56(84) bytes of data.
64 bytes from 20.0.0.1: icmp_seq=1 ttl=64 time=0.353 ms

--- 20.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.353/0.353/0.353/0.000 ms

Step 7: Initiate a tcp connection from DUT1 to DUT2 and try to send some messages between both endpoints

admin@DUT2$ monitor test connection server 8080 tcp
admin@DUT1$ monitor test connection client 10.0.0.2 8080 tcp

Step 8: Run command system netflow show flows detailed at DUT0 and check if output matches the following regular expressions:

2\s+3\s+10.0.0.1:\d+\s+20.0.0.1:\d+\s*\d*\s*\d+[^\[]*\[L4:8080\]
Show output
------------------------------------------------------------------------------------------
Field       Description
------------------------------------------------------------------------------------------
#           Numeric flow identifier
hash        Hash of the flow
a           Shows if the flow is pending of being exported
iif         Input interface
oif         Output interface
src         Source IP:PORT
dst         Destination IP:PORT
protocol    Protocol identifier
nexthop     Next-hop [Layer 4:Port]
tos         Type of service identificator
tcpflags    TCP flags
options     Optional IP options
tcpoptions  TCP Options (MSS, Window Scaling, Selective Acknowledgements, Timestamps, Nop)
pkts        Packets counter
bytes       Bytes counter
ts_first    Timestamp of fist packet that passed through the flow
ts_last     Timestamp of last packet that passed through the flow


----------------------------------------------------------------------------------------------------------------------------------------------------
#  hash  a  iif  oif  src             dst             protocol  nexthop           tos  tcpflags  options  tcpoptions  pkts  bytes  ts_first  ts_last
----------------------------------------------------------------------------------------------------------------------------------------------------
1  9d43  0  3    2    20.0.0.1:8080   10.0.0.1:43068  43068     0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  11    680    390       31
2  789e  0  2    3    10.0.0.1:43068  20.0.0.1:8080   8080      0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  11    680    390       31

Step 9: Run command system netflow show flows detailed at DUT0 and check if output matches the following regular expressions:

3\s+2\s+20.0.0.1:\d+\s+10.0.0.1:\d+\s*\d*\s*\d+[^\[]*\[L4:8080\]
Show output
------------------------------------------------------------------------------------------
Field       Description
------------------------------------------------------------------------------------------
#           Numeric flow identifier
hash        Hash of the flow
a           Shows if the flow is pending of being exported
iif         Input interface
oif         Output interface
src         Source IP:PORT
dst         Destination IP:PORT
protocol    Protocol identifier
nexthop     Next-hop [Layer 4:Port]
tos         Type of service identificator
tcpflags    TCP flags
options     Optional IP options
tcpoptions  TCP Options (MSS, Window Scaling, Selective Acknowledgements, Timestamps, Nop)
pkts        Packets counter
bytes       Bytes counter
ts_first    Timestamp of fist packet that passed through the flow
ts_last     Timestamp of last packet that passed through the flow


----------------------------------------------------------------------------------------------------------------------------------------------------
#  hash  a  iif  oif  src             dst             protocol  nexthop           tos  tcpflags  options  tcpoptions  pkts  bytes  ts_first  ts_last
----------------------------------------------------------------------------------------------------------------------------------------------------
1  9d43  0  3    2    20.0.0.1:8080   10.0.0.1:43068  43068     0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  11    680    410       51
2  789e  0  2    3    10.0.0.1:43068  20.0.0.1:8080   8080      0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  11    680    410       51

Step 10: Run command system netflow show status at DUT0 and check if output matches the following regular expressions:

Protocol\sversion\s10\s\(ipfix\)
Export:.*Errors 0 pkts
sock0:\s127.0.0.1:2055,.*err: sndbuf reached 0, connect 0, cberr 0, other 0
Show output
ipt_NETFLOW 2.6, srcversion 4478226DE87DE64E62C28A3; dir
Protocol version 10 (ipfix), refresh-rate 20, timeout-rate 30, (templates 0, active 1).
Timeouts: active 1800s, inactive 15s. Maxflows 2000000
Flows: active 2 (peak 2 reached 0d0h0m ago), mem 492K, worker delay 25/250 [1..25] (80 ms, 0 us, 2:0 [cpu2]).
Hash: size 62967 (mem 491K), metric 1.00 [1.00, 1.00, 1.00]. InHash: 22 pkt, 1 K, InPDU 0, 0.
Rate: 0 bits/sec, 0 packets/sec; Avg 1 min: 273 bps, 0 pps; 5 min: 123 bps, 0 pps
cpu#     pps; <search found new [metric], trunc frag alloc maxflows>, traffic: <pkt, bytes>, drop: <pkt, bytes>
Total      0;      0    105      6 [1.00],    0    0    0    0, traffic: 73, 0 MB, drop: 0, 0 K
cpu0       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
cpu1       0;      0    105      6 [1.00],    0    0    0    0, traffic: 73, 0 MB, drop: 0, 0 K
cpu2       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
cpu3       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
Export: Rate 118 bytes/s; Total 10 pkts, 0 MB, 0 flows; Errors 0 pkts; Traffic lost 51 pkts, 3 Kbytes, 4 flows.
sock0: 127.0.0.1:2055, sndbuf 212992, filled 1, peak 1; err: sndbuf reached 0, connect 0, cberr 0, other 0

Netflow With SDNAT

Description

Scenario with SNAT in DUT0 WAN interface (eth1) and DNAT in DUT0 LAN interface (eth0).

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.0.0.2/24
set interfaces ethernet eth0 flow egress selector TCP_SEL
set interfaces ethernet eth0 flow ingress selector TCP_SEL
set interfaces ethernet eth0 traffic nat destination rule 1 address 20.0.0.1
set interfaces ethernet eth0 traffic nat destination rule 1 selector TCP_SEL
set interfaces ethernet eth1 address 20.0.0.2/24
set interfaces ethernet eth1 traffic nat source rule 1 address masquerade
set interfaces ethernet eth1 traffic nat source rule 1 selector TCP_SEL
set system conntrack app-detect
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system netflow app-id
set system netflow destination 10.0.0.1
set system netflow engine-id 1111
set traffic selector TCP_SEL rule 1 protocol tcp

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address 10.0.0.1/24
set system conntrack app-detect
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Set the following configuration in DUT2 :

set interfaces ethernet eth0 address 20.0.0.1/24
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 4: Run command system conntrack clear at DUT1.

Step 5: Ping IP address 10.0.0.1 from DUT0:

admin@DUT0$ ping 10.0.0.1 count 1 size 56 timeout 1
Show output
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.228 ms

--- 10.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.228/0.228/0.228/0.000 ms

Step 6: Ping IP address 20.0.0.1 from DUT0:

admin@DUT0$ ping 20.0.0.1 count 1 size 56 timeout 1
Show output
PING 20.0.0.1 (20.0.0.1) 56(84) bytes of data.
64 bytes from 20.0.0.1: icmp_seq=1 ttl=64 time=0.404 ms

--- 20.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.404/0.404/0.404/0.000 ms

Step 7: Initiate a tcp connection from DUT1 to DUT2 and try to send some messages between both endpoints

admin@DUT2$ monitor test connection server 8080 tcp
admin@DUT1$ monitor test connection client 10.0.0.2 8080 tcp

Step 8: Run command system netflow show flows detailed at DUT0 and check if output matches the following regular expressions:

2\s+3\s+10.0.0.1:\d+\s+20.0.0.1:\d+\s*\d*\s*\d+[^\[]*\[L4:8080\]
Show output
------------------------------------------------------------------------------------------
Field       Description
------------------------------------------------------------------------------------------
#           Numeric flow identifier
hash        Hash of the flow
a           Shows if the flow is pending of being exported
iif         Input interface
oif         Output interface
src         Source IP:PORT
dst         Destination IP:PORT
protocol    Protocol identifier
nexthop     Next-hop [Layer 4:Port]
tos         Type of service identificator
tcpflags    TCP flags
options     Optional IP options
tcpoptions  TCP Options (MSS, Window Scaling, Selective Acknowledgements, Timestamps, Nop)
pkts        Packets counter
bytes       Bytes counter
ts_first    Timestamp of fist packet that passed through the flow
ts_last     Timestamp of last packet that passed through the flow


----------------------------------------------------------------------------------------------------------------------------------------------------
#  hash  a  iif  oif  src             dst             protocol  nexthop           tos  tcpflags  options  tcpoptions  pkts  bytes  ts_first  ts_last
----------------------------------------------------------------------------------------------------------------------------------------------------
1  9726  0  3    2    20.0.0.1:8080   10.0.0.1:42982  42982     0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  11    680    394       30
2  ce2c  0  2    3    10.0.0.1:42982  20.0.0.1:8080   8080      0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  12    732    394       29

Step 9: Run command system netflow show flows detailed at DUT0 and check if output matches the following regular expressions:

3\s+2\s+20.0.0.1:\d+\s+10.0.0.1:\d+\s*\d*\s*\d+[^\[]*\[L4:8080\]
Show output
------------------------------------------------------------------------------------------
Field       Description
------------------------------------------------------------------------------------------
#           Numeric flow identifier
hash        Hash of the flow
a           Shows if the flow is pending of being exported
iif         Input interface
oif         Output interface
src         Source IP:PORT
dst         Destination IP:PORT
protocol    Protocol identifier
nexthop     Next-hop [Layer 4:Port]
tos         Type of service identificator
tcpflags    TCP flags
options     Optional IP options
tcpoptions  TCP Options (MSS, Window Scaling, Selective Acknowledgements, Timestamps, Nop)
pkts        Packets counter
bytes       Bytes counter
ts_first    Timestamp of fist packet that passed through the flow
ts_last     Timestamp of last packet that passed through the flow


----------------------------------------------------------------------------------------------------------------------------------------------------
#  hash  a  iif  oif  src             dst             protocol  nexthop           tos  tcpflags  options  tcpoptions  pkts  bytes  ts_first  ts_last
----------------------------------------------------------------------------------------------------------------------------------------------------
1  9726  0  3    2    20.0.0.1:8080   10.0.0.1:42982  42982     0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  11    680    436       72
2  ce2c  0  2    3    10.0.0.1:42982  20.0.0.1:8080   8080      0.0.0.0[L4:8080]  0x0  0x1b      0x0      0xf1000000  12    732    436       71

Step 10: Run command system netflow show status at DUT0 and check if output matches the following regular expressions:

Protocol\sversion\s10\s\(ipfix\)
Export:.*Errors 0 pkts
sock0:\s127.0.0.1:2055,.*err: sndbuf reached 0, connect 0, cberr 0, other 0
Show output
ipt_NETFLOW 2.6, srcversion 4478226DE87DE64E62C28A3; dir
Protocol version 10 (ipfix), refresh-rate 20, timeout-rate 30, (templates 0, active 1).
Timeouts: active 1800s, inactive 15s. Maxflows 2000000
Flows: active 2 (peak 2 reached 0d0h1m ago), mem 492K, worker delay 25/250 [1..25] (32 ms, 0 us, 2:0 [cpu3]).
Hash: size 62967 (mem 491K), metric 1.00 [1.00, 1.00, 1.00]. InHash: 23 pkt, 1 K, InPDU 0, 0.
Rate: 344 bits/sec, 0 packets/sec; Avg 1 min: 428 bps, 0 pps; 5 min: 182 bps, 0 pps
cpu#     pps; <search found new [metric], trunc frag alloc maxflows>, traffic: <pkt, bytes>, drop: <pkt, bytes>
Total      0;      0    138      8 [1.00],    0    0    0    0, traffic: 96, 0 MB, drop: 0, 0 K
cpu0       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
cpu1       0;      0    138      8 [1.00],    0    0    0    0, traffic: 96, 0 MB, drop: 0, 0 K
cpu2       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
cpu3       0;      0      0      0 [1.00],    0    0    0    0, traffic: 0, 0 MB, drop: 0, 0 K
Export: Rate 0 bytes/s; Total 14 pkts, 0 MB, 0 flows; Errors 0 pkts; Traffic lost 73 pkts, 4 Kbytes, 6 flows.
sock0: 127.0.0.1:2055, sndbuf 212992, filled 1, peak 1; err: sndbuf reached 0, connect 0, cberr 0, other 0