How to use both syn proxy and connlimit rules with iptables?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












2















I want to write both syn proxy and connlimit rules. I want to send packets to syn proxy first because of performance issue.



Here is rule sample.



#syn proxy rule 
iptables -t raw -A PREROUTING -i eth1 -p tcp -m tcp --syn -j CT --notrack
iptables -t filter -A FORWARD -i eth1 -p tcp -m tcp -m state --state INVALID,UNTRACKED -j SYNPROXY --sack-perm --timestamp --wscale 7 --mss 1460
iptables -t filter -A FORWARD -i eth1 -m state --state INVALID -j DROP

#connlimit rule
iptables -t filter -A FORWARD -i eth1 -p tcp -m tcp --syn -m connlimit --connlimit-above 100 -j DROP


Problem is that since syn packets (packet that open connection) can not go beyond syn proxy rule, they can not match connlimit. I am looking for alternative way to write connlimit so that it can work with synproxy.










share|improve this question
























  • An option is to use hashlimit beforehand in the raw table.

    – jofel
    Jan 23 '15 at 11:02











  • I want to process synproxy first so that a spoofed ip doesnt match connlimit rule. Only solution I found so far that to put connlimit rule mangle/postrouting.

    – ibrahim
    Jan 23 '15 at 13:10















2















I want to write both syn proxy and connlimit rules. I want to send packets to syn proxy first because of performance issue.



Here is rule sample.



#syn proxy rule 
iptables -t raw -A PREROUTING -i eth1 -p tcp -m tcp --syn -j CT --notrack
iptables -t filter -A FORWARD -i eth1 -p tcp -m tcp -m state --state INVALID,UNTRACKED -j SYNPROXY --sack-perm --timestamp --wscale 7 --mss 1460
iptables -t filter -A FORWARD -i eth1 -m state --state INVALID -j DROP

#connlimit rule
iptables -t filter -A FORWARD -i eth1 -p tcp -m tcp --syn -m connlimit --connlimit-above 100 -j DROP


Problem is that since syn packets (packet that open connection) can not go beyond syn proxy rule, they can not match connlimit. I am looking for alternative way to write connlimit so that it can work with synproxy.










share|improve this question
























  • An option is to use hashlimit beforehand in the raw table.

    – jofel
    Jan 23 '15 at 11:02











  • I want to process synproxy first so that a spoofed ip doesnt match connlimit rule. Only solution I found so far that to put connlimit rule mangle/postrouting.

    – ibrahim
    Jan 23 '15 at 13:10













2












2








2


1






I want to write both syn proxy and connlimit rules. I want to send packets to syn proxy first because of performance issue.



Here is rule sample.



#syn proxy rule 
iptables -t raw -A PREROUTING -i eth1 -p tcp -m tcp --syn -j CT --notrack
iptables -t filter -A FORWARD -i eth1 -p tcp -m tcp -m state --state INVALID,UNTRACKED -j SYNPROXY --sack-perm --timestamp --wscale 7 --mss 1460
iptables -t filter -A FORWARD -i eth1 -m state --state INVALID -j DROP

#connlimit rule
iptables -t filter -A FORWARD -i eth1 -p tcp -m tcp --syn -m connlimit --connlimit-above 100 -j DROP


Problem is that since syn packets (packet that open connection) can not go beyond syn proxy rule, they can not match connlimit. I am looking for alternative way to write connlimit so that it can work with synproxy.










share|improve this question
















I want to write both syn proxy and connlimit rules. I want to send packets to syn proxy first because of performance issue.



Here is rule sample.



#syn proxy rule 
iptables -t raw -A PREROUTING -i eth1 -p tcp -m tcp --syn -j CT --notrack
iptables -t filter -A FORWARD -i eth1 -p tcp -m tcp -m state --state INVALID,UNTRACKED -j SYNPROXY --sack-perm --timestamp --wscale 7 --mss 1460
iptables -t filter -A FORWARD -i eth1 -m state --state INVALID -j DROP

#connlimit rule
iptables -t filter -A FORWARD -i eth1 -p tcp -m tcp --syn -m connlimit --connlimit-above 100 -j DROP


Problem is that since syn packets (packet that open connection) can not go beyond syn proxy rule, they can not match connlimit. I am looking for alternative way to write connlimit so that it can work with synproxy.







rhel iptables firewall






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 30 '17 at 5:44







ibrahim

















asked Jan 23 '15 at 9:57









ibrahimibrahim

412312




412312












  • An option is to use hashlimit beforehand in the raw table.

    – jofel
    Jan 23 '15 at 11:02











  • I want to process synproxy first so that a spoofed ip doesnt match connlimit rule. Only solution I found so far that to put connlimit rule mangle/postrouting.

    – ibrahim
    Jan 23 '15 at 13:10

















  • An option is to use hashlimit beforehand in the raw table.

    – jofel
    Jan 23 '15 at 11:02











  • I want to process synproxy first so that a spoofed ip doesnt match connlimit rule. Only solution I found so far that to put connlimit rule mangle/postrouting.

    – ibrahim
    Jan 23 '15 at 13:10
















An option is to use hashlimit beforehand in the raw table.

– jofel
Jan 23 '15 at 11:02





An option is to use hashlimit beforehand in the raw table.

– jofel
Jan 23 '15 at 11:02













I want to process synproxy first so that a spoofed ip doesnt match connlimit rule. Only solution I found so far that to put connlimit rule mangle/postrouting.

– ibrahim
Jan 23 '15 at 13:10





I want to process synproxy first so that a spoofed ip doesnt match connlimit rule. Only solution I found so far that to put connlimit rule mangle/postrouting.

– ibrahim
Jan 23 '15 at 13:10










1 Answer
1






active

oldest

votes


















0














I was using the same rule (synproxy on a bridge) but realized that the normal tcp request would not work, i.e., after implementing the synproxy rules ALL syn request got blocked. I have monitored with tcpdump.
I wonder if your synproxy rules work as expected?






share|improve this answer























  • Yes. As I mentioned on my comment, I put the connlimit rules to mangle/postrouting chain and then both synproxy and connlimit worked.

    – ibrahim
    Feb 23 '15 at 12:27










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f180608%2fhow-to-use-both-syn-proxy-and-connlimit-rules-with-iptables%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














I was using the same rule (synproxy on a bridge) but realized that the normal tcp request would not work, i.e., after implementing the synproxy rules ALL syn request got blocked. I have monitored with tcpdump.
I wonder if your synproxy rules work as expected?






share|improve this answer























  • Yes. As I mentioned on my comment, I put the connlimit rules to mangle/postrouting chain and then both synproxy and connlimit worked.

    – ibrahim
    Feb 23 '15 at 12:27















0














I was using the same rule (synproxy on a bridge) but realized that the normal tcp request would not work, i.e., after implementing the synproxy rules ALL syn request got blocked. I have monitored with tcpdump.
I wonder if your synproxy rules work as expected?






share|improve this answer























  • Yes. As I mentioned on my comment, I put the connlimit rules to mangle/postrouting chain and then both synproxy and connlimit worked.

    – ibrahim
    Feb 23 '15 at 12:27













0












0








0







I was using the same rule (synproxy on a bridge) but realized that the normal tcp request would not work, i.e., after implementing the synproxy rules ALL syn request got blocked. I have monitored with tcpdump.
I wonder if your synproxy rules work as expected?






share|improve this answer













I was using the same rule (synproxy on a bridge) but realized that the normal tcp request would not work, i.e., after implementing the synproxy rules ALL syn request got blocked. I have monitored with tcpdump.
I wonder if your synproxy rules work as expected?







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 22 '15 at 3:05









JingJing

11




11












  • Yes. As I mentioned on my comment, I put the connlimit rules to mangle/postrouting chain and then both synproxy and connlimit worked.

    – ibrahim
    Feb 23 '15 at 12:27

















  • Yes. As I mentioned on my comment, I put the connlimit rules to mangle/postrouting chain and then both synproxy and connlimit worked.

    – ibrahim
    Feb 23 '15 at 12:27
















Yes. As I mentioned on my comment, I put the connlimit rules to mangle/postrouting chain and then both synproxy and connlimit worked.

– ibrahim
Feb 23 '15 at 12:27





Yes. As I mentioned on my comment, I put the connlimit rules to mangle/postrouting chain and then both synproxy and connlimit worked.

– ibrahim
Feb 23 '15 at 12:27

















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • 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%2funix.stackexchange.com%2fquestions%2f180608%2fhow-to-use-both-syn-proxy-and-connlimit-rules-with-iptables%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

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?