Description

This article provides an example for how to delete a flow entry on vrouter.

Solution

To delete a flow entry from vrouter flow table,  use the command, flow -i <flow id>

In the example below, the vrouter has 4 entries at the beginning. 

root@host:~# flow -l 
Flow table(size 80609280, entries 629760)

Entries: Created 184 Added 184 Deleted 260 Changed 260 Processed 184 Used Overflow entries 0
(Created Flows/CPU: 0 67 17 66 4 30)(oflows 0)

Action:F=Forward, D=Drop N=NAT(S=SNAT, D=DNAT, Ps=SPAT, Pd=DPAT, L=Link Local Port)
 Other:K(nh)=Key_Nexthop, S(nh)=RPF_Nexthop
 Flags:E=Evicted, Ec=Evict Candidate, N=New Flow, M=Modified Dm=Delete Marked
TCP(r=reverse):S=SYN, F=FIN, R=RST, C=HalfClose, E=Established, D=Dead

    Index                Source:Port/Destination:Port                      Proto(V)
-----------------------------------------------------------------------------------
    20296<=>285636       192.168.10.4:57729                                 17 (1)
                         192.168.10.2:53   
(Gen: 1, K(nh):21, Action:F, Flags:, QOS:-1, S(nh):21,  Stats:2/148,  SPort 52926,
 TTL 0, Sinfo 4.0.0.0)

    28088<=>223732       192.168.10.4:1319                                   1 (1)
                         192.168.10.3:0    
(Gen: 2, K(nh):21, Action:F, Flags:, QOS:-1, S(nh):21,  Stats:17/1666, 
 SPort 54049, TTL 0, Sinfo 4.0.0.0)

   223732<=>28088        192.168.10.3:1319                                   1 (1)
                         192.168.10.4:0    
(Gen: 2, K(nh):15, Action:F, Flags:, QOS:-1, S(nh):15,  Stats:17/1666, 
 SPort 56121, TTL 0, Sinfo 3.0.0.0)

   285636<=>20296        192.168.10.2:53                                    17 (1)
                         192.168.10.4:57729
(Gen: 1, K(nh):21, Action:F, Flags:, QOS:-1, S(nh):8,  Stats:0/0,  SPort 64724,
 TTL 0, Sinfo 0.0.0.0)

Now, delete flow 28088 with flow -i command.

root@host:~# flow -i  28088
root@host:~# flow -l 
Flow table(size 80609280, entries 629760)

Entries: Created 185 Added 185 Deleted 263 Changed 263 Processed 185 Used Overflow entries 0
(Created Flows/CPU: 0 67 17 66 4 31)(oflows 0)

Action:F=Forward, D=Drop N=NAT(S=SNAT, D=DNAT, Ps=SPAT, Pd=DPAT, L=Link Local Port)
 Other:K(nh)=Key_Nexthop, S(nh)=RPF_Nexthop
 Flags:E=Evicted, Ec=Evict Candidate, N=New Flow, M=Modified Dm=Delete Marked
TCP(r=reverse):S=SYN, F=FIN, R=RST, C=HalfClose, E=Established, D=Dead

    Index                Source:Port/Destination:Port                      Proto(V)
-----------------------------------------------------------------------------------
    20296<=>285636       192.168.10.4:57729                                 17 (1)
                         192.168.10.2:53   
(Gen: 1, K(nh):21, Action:F, Flags:, QOS:-1, S(nh):21,  Stats:2/148,  SPort 52926,
 TTL 0, Sinfo 4.0.0.0)

   223732<=>28088        192.168.10.3:1319                                   1 (1)
                         192.168.10.4:0    
(Gen: 2, K(nh):15, Action:F, Flags:, QOS:-1, S(nh):15,  Stats:21/2058, 
 SPort 56121, TTL 0, Sinfo 3.0.0.0)

   285636<=>20296        192.168.10.2:53                                    17 (1)
                         192.168.10.4:57729
(Gen: 1, K(nh):21, Action:F, Flags:, QOS:-1, S(nh):8,  Stats:0/0,  SPort 64724,
 TTL 0, Sinfo 0.0.0.0)

Noticed that flow -i will not delete reverse flow automatically. If you want to delete reverse flow as well, run the flow -i command again.

root@host:~# flow -i  223732
root@host:~# flow -l 
Flow table(size 80609280, entries 629760)

Entries: Created 186 Added 186 Deleted 266 Changed 266 Processed 186 Used Overflow entries 0
(Created Flows/CPU: 0 67 17 66 4 32)(oflows 0)

Action:F=Forward, D=Drop N=NAT(S=SNAT, D=DNAT, Ps=SPAT, Pd=DPAT, L=Link Local Port)
 Other:K(nh)=Key_Nexthop, S(nh)=RPF_Nexthop
 Flags:E=Evicted, Ec=Evict Candidate, N=New Flow, M=Modified Dm=Delete Marked
TCP(r=reverse):S=SYN, F=FIN, R=RST, C=HalfClose, E=Established, D=Dead

    Index                Source:Port/Destination:Port                      Proto(V)
-----------------------------------------------------------------------------------
    20296<=>285636       192.168.10.4:57729                                 17 (1)
                         192.168.10.2:53   
(Gen: 1, K(nh):21, Action:F, Flags:, QOS:-1, S(nh):21,  Stats:2/148,  SPort 52926,
 TTL 0, Sinfo 4.0.0.0)

   285636<=>20296        192.168.10.2:53                                    17 (1)
                         192.168.10.4:57729
(Gen: 1, K(nh):21, Action:F, Flags:, QOS:-1, S(nh):8,  Stats:0/0,  SPort 64724,
 TTL 0, Sinfo 0.0.0.0)