drop fin packet with iptables ruleiptables rules to block ssh remote forwarded portsHow to test if SYN and FIN are both dropped at the same time in hping3?iptables rule to block incoming/outgoing traffic to a Xen containerWhy is our firewall (Ubuntu 8.04) rejecting the final packet (FIN, ACK, PSH) with a RSTUFW/IPTables: how to securely allow authenticated git access with githubTranslating IPTables rule to UFWiptables mysterious DROP --sport 80 [ACK FIN]Iptables - Drop or Reject the whole connectionCan iptables automatically drop established session after certain seconds?Debugging iptables and common firewall pitfalls?

Theorem won't go to multiple lines and is causing text to run off the page

Should one double the thirds or the fifth in chords?

When and why did journal article titles become descriptive, rather than creatively allusive?

Do I really need diodes to receive MIDI?

What is a "listed natural gas appliance"?

How would adding a darkvision racial trait to Dragonborn affect balance?

Is Jon mad at Ghost for some reason and is that why he won't acknowledge him?

How to give very negative feedback gracefully?

To customize a predefined symbol with different colors

What does this colon mean? It is not labeling, it is not ternary operator

Identifying a transmission to myself

Father and Son and Grandsons

Sed Usage to update GRUB file

CRT Oscilloscope - part of the plot is missing

Moving the subject of the sentence into a dangling participle

SQL Server Management Studio SSMS 18.0 General Availability release (GA) install fails

Can fracking help reduce CO2?

For a benzene shown in a skeletal structure, what does a substituent to the center of the ring mean?

What actually is the vector of angular momentum?

Which industry am I working in? Software development or financial services?

Upside-Down Pyramid Addition...REVERSED!

In Endgame, why were these characters still around?

Was there ever a Kickstart that took advantage of 68020+ instructions that would work on an A2000?

How do I tell my manager that his code review comment is wrong?



drop fin packet with iptables rule


iptables rules to block ssh remote forwarded portsHow to test if SYN and FIN are both dropped at the same time in hping3?iptables rule to block incoming/outgoing traffic to a Xen containerWhy is our firewall (Ubuntu 8.04) rejecting the final packet (FIN, ACK, PSH) with a RSTUFW/IPTables: how to securely allow authenticated git access with githubTranslating IPTables rule to UFWiptables mysterious DROP --sport 80 [ACK FIN]Iptables - Drop or Reject the whole connectionCan iptables automatically drop established session after certain seconds?Debugging iptables and common firewall pitfalls?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Os is linux mint 19, i want to setup a rule in iptables to drop the incomming FIN packet as a response of the FIN_WAIT_2 state.
This for a given port. I want to test an application and need some connections staying in the FIN_WAIT_2 tcp state.
Firewall is ufw










share|improve this question




























    0















    Os is linux mint 19, i want to setup a rule in iptables to drop the incomming FIN packet as a response of the FIN_WAIT_2 state.
    This for a given port. I want to test an application and need some connections staying in the FIN_WAIT_2 tcp state.
    Firewall is ufw










    share|improve this question
























      0












      0








      0








      Os is linux mint 19, i want to setup a rule in iptables to drop the incomming FIN packet as a response of the FIN_WAIT_2 state.
      This for a given port. I want to test an application and need some connections staying in the FIN_WAIT_2 tcp state.
      Firewall is ufw










      share|improve this question














      Os is linux mint 19, i want to setup a rule in iptables to drop the incomming FIN packet as a response of the FIN_WAIT_2 state.
      This for a given port. I want to test an application and need some connections staying in the FIN_WAIT_2 tcp state.
      Firewall is ufw







      iptables firewall ufw






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 23 at 9:28









      reisreis

      11




      11




















          2 Answers
          2






          active

          oldest

          votes


















          0














          If you just want to drop the incoming FIN packet when you always initiate the shutdown of the connection, then a rule such as the following should suffice:



          iptables -I INPUT --protocol tcp --destination-port 1337 --tcp-flags FIN FIN -j DROP


          However this will mess up closing of connections by the other end of the connection. I don't think that it's possible to only drop the FIN if preceded by an ACK.






          share|improve this answer























          • At the client site the connection stays in FIN_WAIT1. This is one of the states i want the client to stay in for testing purpose.

            – reis
            Apr 24 at 5:34


















          0














          Unfortunately I haven't found any notes about checking the tcp flags in the ufw manual.



          In iptables your scenario can be implemented in some complex way using the ipset, but there are some limitations. I guess, your host is the tcp client, and server port number is 1234 (free to change it).



          # create the ipset list for fin_wait sockets.
          # every entry is tuple (local-ip,local-port,remote-ip)
          ipset create fin_wait hash:ip,port,ip timeout 3000

          # if local host sends the fin packet inside established connection
          # add entry into fin_wait list
          iptables -A OUTPUT
          -p tcp --tcp-flags FIN FIN
          --dport 1234
          -m conntrack --ctstate ESTABLISHED
          -j SET --add-set fin_wait src,src,dst --exist

          # if local host receives the fin packet for fin wait socket
          # drop it before tcp stack processing
          iptables -A INPUT
          -p tcp --tcp-flags FIN FIN
          --sport 1234
          -m set --match-set fin_wait dst,dst,src
          -j DROP


          For server there is difference.



          # create list for test clients
          ipset create test_clients hash:ip

          # add addresses of test clients
          ipset add test_clients 192.168.100.10

          # create list for clients in fin wait state
          # server ip,port is known, so ip,port type is enough
          ipset create fin_wait_clients hash:ip,port timeout 3000

          # if server receives fin from test client
          # add client's ip,port into set
          iptables -A INPUT -p tcp
          --dport 1234
          --tcp-flags FIN FIN
          -m set --match-set test_clients src
          -j SET --add-set fin_wait_clients src,src --exist

          # if server sends fin to test client as reply
          # block this fin
          iptables -A OUTPUT -p tcp
          --sport 1234
          --tcp-flags FIN FIN
          -m set --match-set fin_wait_clients dst,dst
          -j DROP


          Some notes:



          • Use ipset list fin_wait command to list the current blocked entries from iptables' point of view


          • Use ss -t4 state fin-wait-2 command to list sockets in fin wait 2 state


          • Order of rules is very important.


          • Better use the iptables-save / iptables-restore / iptables-apply tools to safety rule set changing.






          share|improve this answer

























          • i don't see the 'ss -t4 ...' part of the rule, should it be part of the rule? Can you please add a destination port for which the rule is valid?

            – reis
            Apr 23 at 13:39











          • ss -t4 state fin-wait-2 isn't a part of any rule, it's a separate command to list sockets in a host system. Most suitable set type is ip.port,ip, so there isn't way to use full 4-elements tuples and destination port, but you can add the server side port number with adding --dport <NUM> / --sport <NUM> into OUTPUT / INPUT rules.

            – Anton Danilov
            Apr 23 at 13:43












          • >>> I guess, your host is the tcp client, and server port number is 1234. I want to apply the rules at the server. So the incomming connection is at port 20000 in this case. I've added the rules but I don't see any blocked entries. Something wrong with INPUT and OUTPUT?

            – reis
            Apr 24 at 5:54












          • For server need other rules. I'll edit the answer to provide the rules for server too. I've written rules for client because you asked about client, not server.

            – Anton Danilov
            Apr 24 at 6:49












          • I've got a "bad argument 'test_clients' '" probably because of the line "-m set test_clients src"

            – reis
            Apr 24 at 8:04











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "2"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f964178%2fdrop-fin-packet-with-iptables-rule%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          If you just want to drop the incoming FIN packet when you always initiate the shutdown of the connection, then a rule such as the following should suffice:



          iptables -I INPUT --protocol tcp --destination-port 1337 --tcp-flags FIN FIN -j DROP


          However this will mess up closing of connections by the other end of the connection. I don't think that it's possible to only drop the FIN if preceded by an ACK.






          share|improve this answer























          • At the client site the connection stays in FIN_WAIT1. This is one of the states i want the client to stay in for testing purpose.

            – reis
            Apr 24 at 5:34















          0














          If you just want to drop the incoming FIN packet when you always initiate the shutdown of the connection, then a rule such as the following should suffice:



          iptables -I INPUT --protocol tcp --destination-port 1337 --tcp-flags FIN FIN -j DROP


          However this will mess up closing of connections by the other end of the connection. I don't think that it's possible to only drop the FIN if preceded by an ACK.






          share|improve this answer























          • At the client site the connection stays in FIN_WAIT1. This is one of the states i want the client to stay in for testing purpose.

            – reis
            Apr 24 at 5:34













          0












          0








          0







          If you just want to drop the incoming FIN packet when you always initiate the shutdown of the connection, then a rule such as the following should suffice:



          iptables -I INPUT --protocol tcp --destination-port 1337 --tcp-flags FIN FIN -j DROP


          However this will mess up closing of connections by the other end of the connection. I don't think that it's possible to only drop the FIN if preceded by an ACK.






          share|improve this answer













          If you just want to drop the incoming FIN packet when you always initiate the shutdown of the connection, then a rule such as the following should suffice:



          iptables -I INPUT --protocol tcp --destination-port 1337 --tcp-flags FIN FIN -j DROP


          However this will mess up closing of connections by the other end of the connection. I don't think that it's possible to only drop the FIN if preceded by an ACK.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 23 at 11:31









          wurtelwurtel

          3,038512




          3,038512












          • At the client site the connection stays in FIN_WAIT1. This is one of the states i want the client to stay in for testing purpose.

            – reis
            Apr 24 at 5:34

















          • At the client site the connection stays in FIN_WAIT1. This is one of the states i want the client to stay in for testing purpose.

            – reis
            Apr 24 at 5:34
















          At the client site the connection stays in FIN_WAIT1. This is one of the states i want the client to stay in for testing purpose.

          – reis
          Apr 24 at 5:34





          At the client site the connection stays in FIN_WAIT1. This is one of the states i want the client to stay in for testing purpose.

          – reis
          Apr 24 at 5:34













          0














          Unfortunately I haven't found any notes about checking the tcp flags in the ufw manual.



          In iptables your scenario can be implemented in some complex way using the ipset, but there are some limitations. I guess, your host is the tcp client, and server port number is 1234 (free to change it).



          # create the ipset list for fin_wait sockets.
          # every entry is tuple (local-ip,local-port,remote-ip)
          ipset create fin_wait hash:ip,port,ip timeout 3000

          # if local host sends the fin packet inside established connection
          # add entry into fin_wait list
          iptables -A OUTPUT
          -p tcp --tcp-flags FIN FIN
          --dport 1234
          -m conntrack --ctstate ESTABLISHED
          -j SET --add-set fin_wait src,src,dst --exist

          # if local host receives the fin packet for fin wait socket
          # drop it before tcp stack processing
          iptables -A INPUT
          -p tcp --tcp-flags FIN FIN
          --sport 1234
          -m set --match-set fin_wait dst,dst,src
          -j DROP


          For server there is difference.



          # create list for test clients
          ipset create test_clients hash:ip

          # add addresses of test clients
          ipset add test_clients 192.168.100.10

          # create list for clients in fin wait state
          # server ip,port is known, so ip,port type is enough
          ipset create fin_wait_clients hash:ip,port timeout 3000

          # if server receives fin from test client
          # add client's ip,port into set
          iptables -A INPUT -p tcp
          --dport 1234
          --tcp-flags FIN FIN
          -m set --match-set test_clients src
          -j SET --add-set fin_wait_clients src,src --exist

          # if server sends fin to test client as reply
          # block this fin
          iptables -A OUTPUT -p tcp
          --sport 1234
          --tcp-flags FIN FIN
          -m set --match-set fin_wait_clients dst,dst
          -j DROP


          Some notes:



          • Use ipset list fin_wait command to list the current blocked entries from iptables' point of view


          • Use ss -t4 state fin-wait-2 command to list sockets in fin wait 2 state


          • Order of rules is very important.


          • Better use the iptables-save / iptables-restore / iptables-apply tools to safety rule set changing.






          share|improve this answer

























          • i don't see the 'ss -t4 ...' part of the rule, should it be part of the rule? Can you please add a destination port for which the rule is valid?

            – reis
            Apr 23 at 13:39











          • ss -t4 state fin-wait-2 isn't a part of any rule, it's a separate command to list sockets in a host system. Most suitable set type is ip.port,ip, so there isn't way to use full 4-elements tuples and destination port, but you can add the server side port number with adding --dport <NUM> / --sport <NUM> into OUTPUT / INPUT rules.

            – Anton Danilov
            Apr 23 at 13:43












          • >>> I guess, your host is the tcp client, and server port number is 1234. I want to apply the rules at the server. So the incomming connection is at port 20000 in this case. I've added the rules but I don't see any blocked entries. Something wrong with INPUT and OUTPUT?

            – reis
            Apr 24 at 5:54












          • For server need other rules. I'll edit the answer to provide the rules for server too. I've written rules for client because you asked about client, not server.

            – Anton Danilov
            Apr 24 at 6:49












          • I've got a "bad argument 'test_clients' '" probably because of the line "-m set test_clients src"

            – reis
            Apr 24 at 8:04















          0














          Unfortunately I haven't found any notes about checking the tcp flags in the ufw manual.



          In iptables your scenario can be implemented in some complex way using the ipset, but there are some limitations. I guess, your host is the tcp client, and server port number is 1234 (free to change it).



          # create the ipset list for fin_wait sockets.
          # every entry is tuple (local-ip,local-port,remote-ip)
          ipset create fin_wait hash:ip,port,ip timeout 3000

          # if local host sends the fin packet inside established connection
          # add entry into fin_wait list
          iptables -A OUTPUT
          -p tcp --tcp-flags FIN FIN
          --dport 1234
          -m conntrack --ctstate ESTABLISHED
          -j SET --add-set fin_wait src,src,dst --exist

          # if local host receives the fin packet for fin wait socket
          # drop it before tcp stack processing
          iptables -A INPUT
          -p tcp --tcp-flags FIN FIN
          --sport 1234
          -m set --match-set fin_wait dst,dst,src
          -j DROP


          For server there is difference.



          # create list for test clients
          ipset create test_clients hash:ip

          # add addresses of test clients
          ipset add test_clients 192.168.100.10

          # create list for clients in fin wait state
          # server ip,port is known, so ip,port type is enough
          ipset create fin_wait_clients hash:ip,port timeout 3000

          # if server receives fin from test client
          # add client's ip,port into set
          iptables -A INPUT -p tcp
          --dport 1234
          --tcp-flags FIN FIN
          -m set --match-set test_clients src
          -j SET --add-set fin_wait_clients src,src --exist

          # if server sends fin to test client as reply
          # block this fin
          iptables -A OUTPUT -p tcp
          --sport 1234
          --tcp-flags FIN FIN
          -m set --match-set fin_wait_clients dst,dst
          -j DROP


          Some notes:



          • Use ipset list fin_wait command to list the current blocked entries from iptables' point of view


          • Use ss -t4 state fin-wait-2 command to list sockets in fin wait 2 state


          • Order of rules is very important.


          • Better use the iptables-save / iptables-restore / iptables-apply tools to safety rule set changing.






          share|improve this answer

























          • i don't see the 'ss -t4 ...' part of the rule, should it be part of the rule? Can you please add a destination port for which the rule is valid?

            – reis
            Apr 23 at 13:39











          • ss -t4 state fin-wait-2 isn't a part of any rule, it's a separate command to list sockets in a host system. Most suitable set type is ip.port,ip, so there isn't way to use full 4-elements tuples and destination port, but you can add the server side port number with adding --dport <NUM> / --sport <NUM> into OUTPUT / INPUT rules.

            – Anton Danilov
            Apr 23 at 13:43












          • >>> I guess, your host is the tcp client, and server port number is 1234. I want to apply the rules at the server. So the incomming connection is at port 20000 in this case. I've added the rules but I don't see any blocked entries. Something wrong with INPUT and OUTPUT?

            – reis
            Apr 24 at 5:54












          • For server need other rules. I'll edit the answer to provide the rules for server too. I've written rules for client because you asked about client, not server.

            – Anton Danilov
            Apr 24 at 6:49












          • I've got a "bad argument 'test_clients' '" probably because of the line "-m set test_clients src"

            – reis
            Apr 24 at 8:04













          0












          0








          0







          Unfortunately I haven't found any notes about checking the tcp flags in the ufw manual.



          In iptables your scenario can be implemented in some complex way using the ipset, but there are some limitations. I guess, your host is the tcp client, and server port number is 1234 (free to change it).



          # create the ipset list for fin_wait sockets.
          # every entry is tuple (local-ip,local-port,remote-ip)
          ipset create fin_wait hash:ip,port,ip timeout 3000

          # if local host sends the fin packet inside established connection
          # add entry into fin_wait list
          iptables -A OUTPUT
          -p tcp --tcp-flags FIN FIN
          --dport 1234
          -m conntrack --ctstate ESTABLISHED
          -j SET --add-set fin_wait src,src,dst --exist

          # if local host receives the fin packet for fin wait socket
          # drop it before tcp stack processing
          iptables -A INPUT
          -p tcp --tcp-flags FIN FIN
          --sport 1234
          -m set --match-set fin_wait dst,dst,src
          -j DROP


          For server there is difference.



          # create list for test clients
          ipset create test_clients hash:ip

          # add addresses of test clients
          ipset add test_clients 192.168.100.10

          # create list for clients in fin wait state
          # server ip,port is known, so ip,port type is enough
          ipset create fin_wait_clients hash:ip,port timeout 3000

          # if server receives fin from test client
          # add client's ip,port into set
          iptables -A INPUT -p tcp
          --dport 1234
          --tcp-flags FIN FIN
          -m set --match-set test_clients src
          -j SET --add-set fin_wait_clients src,src --exist

          # if server sends fin to test client as reply
          # block this fin
          iptables -A OUTPUT -p tcp
          --sport 1234
          --tcp-flags FIN FIN
          -m set --match-set fin_wait_clients dst,dst
          -j DROP


          Some notes:



          • Use ipset list fin_wait command to list the current blocked entries from iptables' point of view


          • Use ss -t4 state fin-wait-2 command to list sockets in fin wait 2 state


          • Order of rules is very important.


          • Better use the iptables-save / iptables-restore / iptables-apply tools to safety rule set changing.






          share|improve this answer















          Unfortunately I haven't found any notes about checking the tcp flags in the ufw manual.



          In iptables your scenario can be implemented in some complex way using the ipset, but there are some limitations. I guess, your host is the tcp client, and server port number is 1234 (free to change it).



          # create the ipset list for fin_wait sockets.
          # every entry is tuple (local-ip,local-port,remote-ip)
          ipset create fin_wait hash:ip,port,ip timeout 3000

          # if local host sends the fin packet inside established connection
          # add entry into fin_wait list
          iptables -A OUTPUT
          -p tcp --tcp-flags FIN FIN
          --dport 1234
          -m conntrack --ctstate ESTABLISHED
          -j SET --add-set fin_wait src,src,dst --exist

          # if local host receives the fin packet for fin wait socket
          # drop it before tcp stack processing
          iptables -A INPUT
          -p tcp --tcp-flags FIN FIN
          --sport 1234
          -m set --match-set fin_wait dst,dst,src
          -j DROP


          For server there is difference.



          # create list for test clients
          ipset create test_clients hash:ip

          # add addresses of test clients
          ipset add test_clients 192.168.100.10

          # create list for clients in fin wait state
          # server ip,port is known, so ip,port type is enough
          ipset create fin_wait_clients hash:ip,port timeout 3000

          # if server receives fin from test client
          # add client's ip,port into set
          iptables -A INPUT -p tcp
          --dport 1234
          --tcp-flags FIN FIN
          -m set --match-set test_clients src
          -j SET --add-set fin_wait_clients src,src --exist

          # if server sends fin to test client as reply
          # block this fin
          iptables -A OUTPUT -p tcp
          --sport 1234
          --tcp-flags FIN FIN
          -m set --match-set fin_wait_clients dst,dst
          -j DROP


          Some notes:



          • Use ipset list fin_wait command to list the current blocked entries from iptables' point of view


          • Use ss -t4 state fin-wait-2 command to list sockets in fin wait 2 state


          • Order of rules is very important.


          • Better use the iptables-save / iptables-restore / iptables-apply tools to safety rule set changing.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 24 at 8:09

























          answered Apr 23 at 12:05









          Anton DanilovAnton Danilov

          58625




          58625












          • i don't see the 'ss -t4 ...' part of the rule, should it be part of the rule? Can you please add a destination port for which the rule is valid?

            – reis
            Apr 23 at 13:39











          • ss -t4 state fin-wait-2 isn't a part of any rule, it's a separate command to list sockets in a host system. Most suitable set type is ip.port,ip, so there isn't way to use full 4-elements tuples and destination port, but you can add the server side port number with adding --dport <NUM> / --sport <NUM> into OUTPUT / INPUT rules.

            – Anton Danilov
            Apr 23 at 13:43












          • >>> I guess, your host is the tcp client, and server port number is 1234. I want to apply the rules at the server. So the incomming connection is at port 20000 in this case. I've added the rules but I don't see any blocked entries. Something wrong with INPUT and OUTPUT?

            – reis
            Apr 24 at 5:54












          • For server need other rules. I'll edit the answer to provide the rules for server too. I've written rules for client because you asked about client, not server.

            – Anton Danilov
            Apr 24 at 6:49












          • I've got a "bad argument 'test_clients' '" probably because of the line "-m set test_clients src"

            – reis
            Apr 24 at 8:04

















          • i don't see the 'ss -t4 ...' part of the rule, should it be part of the rule? Can you please add a destination port for which the rule is valid?

            – reis
            Apr 23 at 13:39











          • ss -t4 state fin-wait-2 isn't a part of any rule, it's a separate command to list sockets in a host system. Most suitable set type is ip.port,ip, so there isn't way to use full 4-elements tuples and destination port, but you can add the server side port number with adding --dport <NUM> / --sport <NUM> into OUTPUT / INPUT rules.

            – Anton Danilov
            Apr 23 at 13:43












          • >>> I guess, your host is the tcp client, and server port number is 1234. I want to apply the rules at the server. So the incomming connection is at port 20000 in this case. I've added the rules but I don't see any blocked entries. Something wrong with INPUT and OUTPUT?

            – reis
            Apr 24 at 5:54












          • For server need other rules. I'll edit the answer to provide the rules for server too. I've written rules for client because you asked about client, not server.

            – Anton Danilov
            Apr 24 at 6:49












          • I've got a "bad argument 'test_clients' '" probably because of the line "-m set test_clients src"

            – reis
            Apr 24 at 8:04
















          i don't see the 'ss -t4 ...' part of the rule, should it be part of the rule? Can you please add a destination port for which the rule is valid?

          – reis
          Apr 23 at 13:39





          i don't see the 'ss -t4 ...' part of the rule, should it be part of the rule? Can you please add a destination port for which the rule is valid?

          – reis
          Apr 23 at 13:39













          ss -t4 state fin-wait-2 isn't a part of any rule, it's a separate command to list sockets in a host system. Most suitable set type is ip.port,ip, so there isn't way to use full 4-elements tuples and destination port, but you can add the server side port number with adding --dport <NUM> / --sport <NUM> into OUTPUT / INPUT rules.

          – Anton Danilov
          Apr 23 at 13:43






          ss -t4 state fin-wait-2 isn't a part of any rule, it's a separate command to list sockets in a host system. Most suitable set type is ip.port,ip, so there isn't way to use full 4-elements tuples and destination port, but you can add the server side port number with adding --dport <NUM> / --sport <NUM> into OUTPUT / INPUT rules.

          – Anton Danilov
          Apr 23 at 13:43














          >>> I guess, your host is the tcp client, and server port number is 1234. I want to apply the rules at the server. So the incomming connection is at port 20000 in this case. I've added the rules but I don't see any blocked entries. Something wrong with INPUT and OUTPUT?

          – reis
          Apr 24 at 5:54






          >>> I guess, your host is the tcp client, and server port number is 1234. I want to apply the rules at the server. So the incomming connection is at port 20000 in this case. I've added the rules but I don't see any blocked entries. Something wrong with INPUT and OUTPUT?

          – reis
          Apr 24 at 5:54














          For server need other rules. I'll edit the answer to provide the rules for server too. I've written rules for client because you asked about client, not server.

          – Anton Danilov
          Apr 24 at 6:49






          For server need other rules. I'll edit the answer to provide the rules for server too. I've written rules for client because you asked about client, not server.

          – Anton Danilov
          Apr 24 at 6:49














          I've got a "bad argument 'test_clients' '" probably because of the line "-m set test_clients src"

          – reis
          Apr 24 at 8:04





          I've got a "bad argument 'test_clients' '" probably because of the line "-m set test_clients src"

          – reis
          Apr 24 at 8:04

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f964178%2fdrop-fin-packet-with-iptables-rule%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

          Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

          What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company