nixCraft Linux Forum

nixCraft

Linux 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

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 07-17-2006, 04:35 PM
Member
User
 
Join Date: Jul 2006
Posts: 50
Rep Power: 0
asim.mcp
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
Sponsored Links
  #2 (permalink)  
Old 07-17-2006, 07:22 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,061
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 | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #3 (permalink)  
Old 07-17-2006, 08:18 PM
Member
User
 
Join Date: Jul 2006
Posts: 50
Rep Power: 0
asim.mcp
Default

sorry a client machine having this ip.
but the default INPUT is DROP
Reply With Quote
  #4 (permalink)  
Old 07-17-2006, 11:00 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,061
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 | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
Reply

Bookmarks


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 On

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 06-09-2008 12:13 AM
blocking streaming zafar466 CentOS / RHEL / Fedora 0 04-12-2008 04:37 AM
MSN and yahoo messanger blocking through IPTABLES surmandal Linux software 1 03-31-2007 01:04 AM
iptables rules blocking ftp hammooda Linux software 7 09-23-2006 05:24 PM
Blocking ports in linux raj Linux software 1 07-10-2006 08:31 PM


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


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

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