LinuxQuestions.org
Visit Jeremy's Blog.
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-27-2005, 01:04 AM   #1
Centinul
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Rep: Reputation: 30
Rule for internal ping on firewall


I'm trying to setup a rule that allows internal systems to ping the firewall and the firewall to ping the internal systems.

If I try pinging the firewall internally with a windows laptop I keep getting "Request Timed Out" errors. This also happens when I try to ping www.google.com


If I try and ping the internal interface on the firewall I get "Destination Port Unreachable" errors.

The firewall can ping out to the internet though. Although it can't be pinged from the outside which is what I want

Here are the rules I have setup for ping, please correct

Code:
# Allow firewall to ping out
$IPT  -A OUTPUT -o $EXTIF -p icmp --icmp-type 8 -m state --state NEW -j ACCEPT

# Allow internal systems to ping out
$IPT -A FORWARD -i $INTIF -p icmp --icmp-type 8 -m state --state NEW -j ACCEPT

# Allow firewall to ping internal systems
$IPT  -A OUTPUT -o $INTIF -s $INTNET -p icmp --icmp-type 8 -m state --state NEW -j ACCEPT

# NOTE I've ALSO TRIED THE ABOVE CODE LIKE THIS
#$IPT  -A OUTPUT -o $INTIF -d $INTNET -p icmp --icmp-type 8 -m state --state #NEW -j ACCEPT
Thanks!
 
Old 08-27-2005, 02:11 AM   #2
nixcraft
Member
 
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379

Rep: Reputation: 30
Your rule seems to be not correct.

I think in your following rule --icmp-type 8 creats problem, so you need NOT use that.
$IPT -A OUTPUT -o $EXTIF -p icmp --icmp-type 8 -m state --state NEW -j ACCEPT

See url for example, I has same problem but when I removed --icmp-type 8 (yah it is for ping-echo type) it works.
http://www.cyberciti.biz/nixcraft/vi...icmp-ping.html

http://www.cyberciti.biz/nixcraft/vi...-incoming.html

Hope this helps
 
Old 08-27-2005, 08:21 AM   #3
Centinul
Member
 
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Original Poster
Rep: Reputation: 30
I tried removing the --icmp-type match and it still didn't work.
 
Old 08-27-2005, 09:41 AM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
I'm not sure if this will do for you but here's how it looks in a script I use.....
Code:
# This rule will accept connections from local machines.
$IPTABLES -A INPUT -i lo -j ACCEPT
$IPTABLES -A INPUT -s 192.168.0.0/24 -d 0/0 -p all -j ACCEPT

# DROP bad packets.
$IPTABLES -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j LOG --log-prefix "TCP_FLAGS1 "
$IPTABLES -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP

$IPTABLES -A INPUT -p tcp --tcp-flags ALL ALL -j LOG --log-prefix "TCP_FLAGS2 "
$IPTABLES -A INPUT -p tcp --tcp-flags ALL ALL -j DROP

$IPTABLES -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j LOG --log-prefix "TCP_FLAGS3 "
$IPTABLES -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP

$IPTABLES -A INPUT -p tcp --tcp-flags ALL NONE -j LOG --log-prefix "TCP_FLAGS4 "
$IPTABLES -A INPUT -p tcp --tcp-flags ALL NONE -j DROP

$IPTABLES -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j LOG --log-prefix "TCP_FLAGS5 "
$IPTABLES -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP

$IPTABLES -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j LOG --log-prefix "TCP_FLAGS6 "
$IPTABLES -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP

# DROP icmp, but only after letting certain types through.
$IPTABLES -A INPUT -p icmp --icmp-type 0 -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type 3 -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type 11 -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type 8 -m limit --limit 1/second -j ACCEPT

$IPTABLES -A INPUT -p icmp -j LOG --log-prefix "ICMP_TYPE "
$IPTABLES -A INPUT -p icmp -j DROP
 
  


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
newbie - firewall rule danimalz Linux - Security 3 07-30-2005 07:25 AM
funny new firewall rule tom_from_van Linux - Security 3 07-19-2005 11:39 AM
APF Firewall Rule Help embsupafly Linux - Security 1 03-08-2005 11:00 PM
is this firewall rule safe? melinda_sayang Linux - Security 1 12-21-2004 07:44 AM
Need A Firewall Rule linuxboy69 Linux - Software 1 11-26-2003 04:29 PM

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

All times are GMT -5. The time now is 06:40 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