nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Blocking port in iptables

This is a discussion on Blocking port in iptables within the Linux software forums, part of the Linux Getting Started category; hi i'm trying to block icmp applying this rule iptables -A INPUT -p icmp -s \! 192.168.2.26 -j DROP i ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Linux software

Linux answers from nixCraft.


Linux software General questions and discussion about Redhat/Fedora Core/Cent OS, Debian and Ubuntu Linux related to softwares should go here.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 17-07-2006, 03:35 PM
Senior Member
User
 
Join Date: Jul 2006
Posts: 145
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 4
asim.mcp is on a distinguished road
Default Blocking port in iptables

hi

i'm trying to block icmp applying this rule
iptables -A INPUT -p icmp -s \! 192.168.2.26 -j DROP
i want to allow this host 192.168.2.26 except all, but this rule don't work it block also icmp request from this host.

Any Help...

Regards
Asim
Reply With Quote
  #2 (permalink)  
Old 17-07-2006, 06:22 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,706
Thanks: 11
Thanked 243 Times in 183 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

So you are applying rules on host having ip 192.168.2.26?
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
  #3 (permalink)  
Old 17-07-2006, 07:18 PM
Senior Member
User
 
Join Date: Jul 2006
Posts: 145
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 4
asim.mcp is on a distinguished road
Default

sorry a client machine having this ip.
but the default INPUT is DROP
Reply With Quote
  #4 (permalink)  
Old 17-07-2006, 10:00 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,706
Thanks: 11
Thanked 243 Times in 183 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

If default INPUT and OUTPUT policy is drop then you should use following rules for ICMP ping request:
Code:
SERVER_IP="192.168.1.50"
CLIENT="192.168.1.10"
iptables -A INPUT -p icmp --icmp-type 8 -s  $CLIENT -d $SERVER_IP -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

iptables -A OUTPUT -p icmp --icmp-type 0 -s $SERVER_IP -d $CLIENT -m state --state ESTABLISHED,RELATED -j ACCEPT
See following url for more info: http://www.cyberciti.biz/nixcraft/vi...-icmp-ping.php
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
USB Port Blocking / Read only Acces on Windows rajuk Windows Xp/2000/2003 server administration 4 08-06-2008 11:13 PM
blocking streaming zafar466 CentOS / RHEL / Fedora 0 12-04-2008 03:37 AM
MSN and yahoo messanger blocking through IPTABLES surmandal Linux software 1 31-03-2007 12:04 AM
iptables rules blocking ftp hammooda Linux software 7 23-09-2006 04:24 PM
Blocking ports in linux raj Linux software 1 10-07-2006 07:31 PM


All times are GMT +5.5. The time now is 03:05 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38