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 12-17-2009, 10:40 PM   #31
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92

Please send again "iptables-save"
Thanks.

I meant after you've made changes.

Last edited by nimnull22; 12-17-2009 at 11:48 PM.
 
Old 12-18-2009, 03:13 PM   #32
MikeHammer
Member
 
Registered: Dec 2009
Posts: 61

Original Poster
Rep: Reputation: 15
Thanks
Attached Files
File Type: txt ipt1.txt (4.9 KB, 12 views)
 
Old 12-18-2009, 04:18 PM   #33
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Ok, lets do some changes. Only for test purpose.
Do a copy of your script. Erase everything, and make new script with only:
Please note WITHOUT "-m tcp" - I don't know where did it come from.


:INPUT DROP
:FORWARD DROP
:OUTPUT DROP
-A PREROUTING -d 190.xxx.xxx.x89/32 -p tcp --dport 80 -j DNAT --to-destination 192.168.222.22:80
-A FORWARD -i eth0 -o eth2 -j ACCEPT
-A FORWARD -i eth2 -o eth0 -j ACCEPT

When you apply that script, nothing should work except for transit traffic.
Next do "iptables --zero" - it will zero counter.
Make sure with "iptables-save" that you have only rules you need.
Do echo "1" > /proc/sys/net/ipv4/ip_forward.
Check that counters is zero (all of them).

Then ask some one to do from outside: "telnet <server IP> 80"
We don't care if server will refuse telnet, we need to find out if it comes in.

Try.
 
1 members found this post helpful.
Old 12-18-2009, 04:20 PM   #34
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
After someone finishes telnet'ing, check counters.

Last edited by nimnull22; 12-18-2009 at 04:22 PM.
 
1 members found this post helpful.
Old 12-18-2009, 10:43 PM   #35
MikeHammer
Member
 
Registered: Dec 2009
Posts: 61

Original Poster
Rep: Reputation: 15
Ok, done.

Telneting, from a Windows client connected through wifi from a ISP that's NOT same which provides Internet to server on testing.
Result: "Could not open connection to the host, on port 80: Connect failed", it same in 2 intents.

I attach 3 files.

zero.txt, (iptables-save) After run script and echo 1 forward and before iptables --zero

zero1.txt, (iptables-save -c) After iptables --zero and before telneting

zero2.txt, (iptables-save -c) After telneting.

Thanks very much
Attached Files
File Type: txt zero.txt (699 Bytes, 16 views)
File Type: txt zero1.txt (723 Bytes, 10 views)
File Type: txt zero2.txt (743 Bytes, 40 views)
 
Old 12-18-2009, 11:26 PM   #36
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
No, you have done wrong.

There is no:

-A PREROUTING -d 190.xxx.xxx.x89/32 -p tcp --dport 80 -j DNAT --to-destination 192.168.222.22:80

in your iptables-save files.

I have asked you, check properly.
Second, counter have not been cleared, try to do: "iptables -Z"


Thanks
 
1 members found this post helpful.
Old 12-19-2009, 12:30 AM   #37
MikeHammer
Member
 
Registered: Dec 2009
Posts: 61

Original Poster
Rep: Reputation: 15
Now I cannot telneting, close to me nobody can do it at this hour... But as before it has not connected, I'll pass that and I'll send you all the rest...

The command "iptables -Z > file.txt" don't write nothing... and I saw "iptables-save -c" as the right command for counters.... Also "iptables-save -Z > file.txt" warn "- Z no options... " ... Any idea?

Last edited by MikeHammer; 12-19-2009 at 12:58 AM.
 
Old 12-19-2009, 09:19 AM   #38
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Quote:
Originally Posted by MikeHammer View Post
Now I cannot telneting, close to me nobody can do it at this hour... But as before it has not connected, I'll pass that and I'll send you all the rest...

The command "iptables -Z > file.txt" don't write nothing... and I saw "iptables-save -c" as the right command for counters.... Also "iptables-save -Z > file.txt" warn "- Z no options... " ... Any idea?
I'm waiting for files, they are interesting.

You just need to do telnet and nothing else, and after that send here output of "iptables-save". Counters will be zeroed after reboot, or all modules will be unloaded.
Forget about it. Do telnet and send file.


Thanks

P.S. telnet should not work, we use it for test purpose.

Last edited by nimnull22; 12-19-2009 at 09:33 AM.
 
1 members found this post helpful.
Old 12-19-2009, 11:11 PM   #39
MikeHammer
Member
 
Registered: Dec 2009
Posts: 61

Original Poster
Rep: Reputation: 15
Hi nimnull22,
I attach 2 files.

zero.txt, (iptables-save) After run script and echo 1 forward and iptables --zero

zero1.txt, (iptables-save) After telneting.

Again thanks

PS: I'm confused because I see that both zeros txt again it not shows nothing about -A PREROUTING -d 190.xxx.xxx.x89/32 -p tcp --dport 80 -j DNAT --to-destination 192.168.222.22:80
Now I send fire.txt that contains firewall script so you check... In the file sended you the sentence of script "-d 190.xxx.xxx.xx9/32" has been changed for privacy reasons... but in real script it's right IP...
Attached Files
File Type: txt zero.txt (703 Bytes, 35 views)
File Type: txt zero1.txt (716 Bytes, 18 views)
File Type: txt fire.txt (580 Bytes, 22 views)

Last edited by MikeHammer; 12-19-2009 at 11:35 PM. Reason: Add file
 
Old 12-19-2009, 11:43 PM   #40
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Yes, because PREROUTING goes to table NAT, sentence should start with:

IPTABLES -t nat -A PREROUTING -d 190.xxx.xxx.x89/32 -p tcp --dport 80 -j DNAT --to-destination 192.168.222.22:80

Look at your first script.

Thanks

P.S.

Add as well default policies:
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP

Last edited by nimnull22; 12-19-2009 at 11:56 PM.
 
1 members found this post helpful.
Old 12-19-2009, 11:46 PM   #41
MikeHammer
Member
 
Registered: Dec 2009
Posts: 61

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by nimnull22 View Post
Yes, because PREROUTING goes to table NAT, sentence should start with:

IPTABLES -t nat -A PREROUTING -d 190.xxx.xxx.x89/32 -p tcp --dport 80 -j DNAT --to-destination 192.168.222.22:80

Look at your firs script.

Thanks
Of course!!
 
Old 12-19-2009, 11:50 PM   #42
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
Add as well default policies:

$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP
 
1 members found this post helpful.
Old 12-19-2009, 11:58 PM   #43
MikeHammer
Member
 
Registered: Dec 2009
Posts: 61

Original Poster
Rep: Reputation: 15
zero.txt, (iptables-save) After run script and echo 1 forward and iptables --zero

zero1.txt, (iptables-save) After telneting.

Thanks
Attached Files
File Type: txt zero.txt (802 Bytes, 11 views)
File Type: txt zero1.txt (820 Bytes, 10 views)
 
Old 12-20-2009, 12:05 AM   #44
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
So, what about telnet?

Did it connect?
 
Old 12-20-2009, 12:06 AM   #45
MikeHammer
Member
 
Registered: Dec 2009
Posts: 61

Original Poster
Rep: Reputation: 15
"Could not open connection to the host, on port 80: Connect failed"
 
  


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
Iptables and DMZ scroogie Linux - Networking 2 02-28-2008 05:39 AM
iptables DMZ garnser Linux - Security 2 12-15-2007 12:14 AM
question about iptables (DMZ machine connect to other DMZ machine 's publuic IP) wingmak Linux - Security 1 01-20-2007 04:01 PM
iptables + DMZ Braytac Linux - Networking 3 10-06-2006 05:57 AM
IPTABLES and DMZ Host htimst Linux - Security 1 12-21-2001 07:04 AM

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

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