LinuxQuestions.org
Review your favorite Linux distribution.
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 08-09-2009, 09:02 AM   #1
divyashree
Senior Member
 
Registered: Apr 2007
Location: Bangalore, India
Distribution: RHEL,SuSE,CentOS,Fedora,Ubuntu
Posts: 1,386

Rep: Reputation: 135Reputation: 135
How to stop ping,


I want to know how to stop ping my system from other system by using iptables

I used the following,still ping working.

Quote:
[root@server1 ~]# iptables -A INPUT -s 172.24.0.0/16 -d 172.24.0.254 -p tcp --dport 5813 -j REJECT
[root@server1 ~]# iptables -A INPUT -s 172.24.0.0/16 -d 172.24.0.254 -p udp --dport 5813 -j REJECT

Last edited by divyashree; 08-09-2009 at 09:07 AM.
 
Old 08-09-2009, 09:23 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Ping uses a 'protocol' of its own, not tcp or udp. It's ICMP.

Check HERE for further info/help too

Sasha
 
Old 08-09-2009, 09:31 AM   #3
divyashree
Senior Member
 
Registered: Apr 2007
Location: Bangalore, India
Distribution: RHEL,SuSE,CentOS,Fedora,Ubuntu
Posts: 1,386

Original Poster
Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by GrapefruiTgirl View Post
Ping uses a 'protocol' of its own, not tcp or udp. It's ICMP.

Check HERE for further info/help too

Sasha
Bro,I think u didn't go through my question,I mentioned there what I had done,I used port 5813 for ICMP protocol there.
 
Old 08-09-2009, 09:37 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by divyashree View Post
Bro,I think u didn't go through my question,I mentioned there what I had done,I used port 5813 for ICMP protocol there.
Be careful who you "bro" ;-p

I don't know how to break it to you nicely but it seems you don't understand ICMP. Please see http://www.faqs.org/rfcs/rfc792.html. Note that blocking all ICMP types breaks networking RFC compliance, makes troubleshooting harder and if blocking ICMP is done for achieving "stealth" it's just misperception. Instead allow some Types and rate-limit them and log and block others.
 
Old 08-09-2009, 09:40 AM   #5
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Code:
iptables -A INPUT -p icmp -m icmp --icmp-type echo-request -j DROP
or
Code:
echo 1>/proc/sys/net/ipv4/icmp_echo_ignore_all
 
Old 08-09-2009, 10:16 AM   #6
divyashree
Senior Member
 
Registered: Apr 2007
Location: Bangalore, India
Distribution: RHEL,SuSE,CentOS,Fedora,Ubuntu
Posts: 1,386

Original Poster
Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by repo View Post
Code:
iptables -A INPUT -p icmp -m icmp --icmp-type echo-request -j DROP
or
Code:
echo 1>/proc/sys/net/ipv4/icmp_echo_ignore_all
repo, thanks a lot.Ur iptable helped me,but I want to know wheather any mistake in my iptables as I did.I taught to do like this for blocking different types of services with their ports.
 
Old 08-09-2009, 10:19 AM   #7
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
As Sasha already told you,
Pings use the ICMP protocol and doesn't use ports like TCP or UDP.

Last edited by repo; 08-09-2009 at 10:21 AM.
 
Old 08-09-2009, 10:43 AM   #8
divyashree
Senior Member
 
Registered: Apr 2007
Location: Bangalore, India
Distribution: RHEL,SuSE,CentOS,Fedora,Ubuntu
Posts: 1,386

Original Poster
Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by repo View Post
As Sasha already told you,
Pings use the ICMP protocol and doesn't use ports like TCP or UDP.
Actually I know that,but in case of opertaion with ftp/ssh/pop/imap/squid protocols I use the same type of rules using tcp and udp with --dport <port-used-by-protocol> and all works fine .
I am newer to iptables and I do as I am guided .So not gone deep.
Anyway thanks a lot.
 
  


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
how to stop ping response/count manuleka Linux - Newbie 1 07-02-2009 05:08 AM
Stop the ping command! nahawand Linux - Newbie 4 07-30-2007 01:23 AM
ping - How do I stop it? michshelly Linux - Newbie 7 04-26-2006 04:24 PM
how can i stop ping reply? Guru Mind Linux - Security 22 02-07-2006 05:24 PM
To Stop Ping Request Which Way Is Good nirav.jani Linux - Security 18 01-06-2005 09:46 AM

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

All times are GMT -5. The time now is 02:59 AM.

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