LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-29-2013, 11:24 PM   #1
psycroptic
Member
 
Registered: Aug 2011
Location: USA
Distribution: ArchLinux - 3.0 kernel
Posts: 349

Rep: Reputation: Disabled
trying iptables ping rate limiting = ping timeouts, but tcpdump shows responses??


trying this at the top of my iptables INPUT chain to rate limit pings:

Code:
-A INPUT -p icmp --icmp-type echo-request -m limit --limit 3/s --limit-burst 1 -j ACCEPT
-A INPUT -p icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp --icmp-type 11 -j ACCEPT
-A INPUT -p icmp -j DROP

-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
disables pinging out from the current system (i.e. ping initiated from the local system shows no responses, and timeouts from each packet), even though tcpdump on the same system reports requests & responses normally:

Code:
23:18:03.703641 IP 172.16.16.1 > 172.16.16.254: ICMP echo request, id 418, seq 1, length 64
23:18:03.704189 IP 172.16.16.254 > 172.16.16.1: ICMP echo reply, id 418, seq 1, length 64
23:18:04.710797 IP 172.16.16.1 > 172.16.16.254: ICMP echo request, id 418, seq 2, length 64
23:18:04.711253 IP 172.16.16.254 > 172.16.16.1: ICMP echo reply, id 418, seq 2, length 64
23:18:05.710679 IP 172.16.16.1 > 172.16.16.254: ICMP echo request, id 418, seq 3, length 64
23:18:05.711205 IP 172.16.16.254 > 172.16.16.1: ICMP echo reply, id 418, seq 3, length 64
23:18:06.710719 IP 172.16.16.1 > 172.16.16.254: ICMP echo request, id 418, seq 4, length 64
23:18:06.711156 IP 172.16.16.254 > 172.16.16.1: ICMP echo reply, id 418, seq 4, length 64
any earthly idea why? doesn't make a lick of sense to me. external systems can ping in just fine.
 
Old 10-30-2013, 01:36 AM   #2
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
these rules do not block pings originated locally, look at the iptables counters if in doubt
 
Old 10-30-2013, 09:19 PM   #3
psycroptic
Member
 
Registered: Aug 2011
Location: USA
Distribution: ArchLinux - 3.0 kernel
Posts: 349

Original Poster
Rep: Reputation: Disabled
well, it seems like they were; changing to this:

Code:
-A INPUT -p icmp --icmp-type echo-request -m limit --limit 3/s --limit-burst 1 -j ACCEPT
-A INPUT -p icmp --icmp-type echo-request -j DROP
-A INPUT -p icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp --icmp-type 11 -j ACCEPT
works as expected.

a tutorial i found said to place a blanket ICMP -j DROP at the end of the icmp-related INPUT section. Apparently it was wrong.
 
Old 10-31-2013, 12:00 AM   #4
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
you'd better move this rule in the correct place:
Code:
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
I guess it is stated clear in your tutorial
 
Old 10-31-2013, 12:12 AM   #5
psycroptic
Member
 
Registered: Aug 2011
Location: USA
Distribution: ArchLinux - 3.0 kernel
Posts: 349

Original Poster
Rep: Reputation: Disabled
sorry that is above this
 
Old 10-31-2013, 12:25 AM   #6
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
since your solution works as expected you can also remove accepting rules for ICMPs 3 and 11, they do nothing here

maybe you can share a link to the tutorial that advices accept related connections only after rejecting rules?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
VMware Duplicated(DUP!) ping responses from hosts in the same LAN m4rtin Linux - Networking 2 07-02-2015 08:36 PM
Strange Ping Issue - Can't ping localhost but can ping others on LAN code_slinger Linux - Networking 15 03-30-2015 02:39 PM
I cannot ping with command 'ping IP' address but can ping with 'ping IP -I eth0' sanketmlad Linux - Networking 2 07-15-2011 05:32 AM
Rate limiting with Iptables on port 21 rino2003 Linux - Networking 1 12-26-2004 06:34 PM
HLDS on Debian = Ping Timeouts volvodriver Linux - Games 2 04-09-2004 08:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration