LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-14-2004, 10:06 PM   #16
ZliTroX
LQ Newbie
 
Registered: Aug 2004
Distribution: ...
Posts: 25

Original Poster
Rep: Reputation: 15

yes i did, but now i tested my own iptables script i posted and it worked same as that one. but still i cant access http from internet on my server

http://zlitrox.ath.cx
 
Old 09-14-2004, 10:11 PM   #17
ZliTroX
LQ Newbie
 
Registered: Aug 2004
Distribution: ...
Posts: 25

Original Poster
Rep: Reputation: 15
hmm but then i try to ftp from the http server to an external ftp site i came to my own ftp site on 192.168.0.3
 
Old 09-14-2004, 10:47 PM   #18
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
Sorry, due to rapid updating I missed the fact that you'd posted your script...

Quote:
# FTP, Port 21 Forwarded to FireWall
iptables -A FORWARD -j ACCEPT -p tcp --dport 21
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 21 -j DNAT --to 192.168.0.3:21
I think the -i eth1 is your problem - incoming packets that should be forwarded to the FTP server (i.e internet packets) will arrive via eth0. This is why your local FTP packets end up at your server instead of the correct site. Try changing that and the HTTP line to -i eth0 instead, and rerun the script.
 
Old 09-15-2004, 05:03 AM   #19
ZliTroX
LQ Newbie
 
Registered: Aug 2004
Distribution: ...
Posts: 25

Original Poster
Rep: Reputation: 15
Angry

i tried to change to eth0 but im yet connecting to my own ftp site then connecting to another external on internet. Then trying to access http server from internet doesn't either work.
 
Old 09-15-2004, 05:07 AM   #20
ZliTroX
LQ Newbie
 
Registered: Aug 2004
Distribution: ...
Posts: 25

Original Poster
Rep: Reputation: 15
now i see that, then i connect to an external ftp from my computer that routes traffic it works but not from windows computer or http server.

it must be something wrong in my script but i cant understand what it is.
 
Old 09-15-2004, 07:34 AM   #21
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
Quote:
It would be a new page here soon, this is first page up after apache installation.
Looks at least like your http server is visible (?)
 
Old 09-15-2004, 07:57 PM   #22
ZliTroX
LQ Newbie
 
Registered: Aug 2004
Distribution: ...
Posts: 25

Original Poster
Rep: Reputation: 15
Angry

hmm, what do you mean that it is visible? i cant connect to that one from internet (http://zlitrox.ath.cx)
 
Old 09-15-2004, 08:00 PM   #23
ZliTroX
LQ Newbie
 
Registered: Aug 2004
Distribution: ...
Posts: 25

Original Poster
Rep: Reputation: 15
ahh you can connect to it?
 
Old 09-15-2004, 08:12 PM   #24
ZliTroX
LQ Newbie
 
Registered: Aug 2004
Distribution: ...
Posts: 25

Original Poster
Rep: Reputation: 15
thanks for the help, it is like this. My router is right, but its only in local network i cant access http://zlitrox.ath.cx but i can surf on http://192.168.0.2 or add it in /etc/hosts that 192.168.0.2 = zlitrox.ath.cx

THANKS FOR YOUR HELP! sorry for being an dumb ass
 
Old 09-15-2004, 08:49 PM   #25
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
Yeah, that happens a lot - the router currently has the IP for zlitrox.ath.cx, and it has a web server for you to configure it, so it takes any port 80 packets to that IP (that come from the internal network) to be meant for itself. From outside, the web and ftp servers are working

Are you able to ftp outwards ok now?

Oh, and no-one is born with knowledge - we are all dumbasses at one point
 
Old 09-16-2004, 06:12 AM   #26
ZliTroX
LQ Newbie
 
Registered: Aug 2004
Distribution: ...
Posts: 25

Original Poster
Rep: Reputation: 15
hehe, yes i can ftp from my router and out, but if i ftp from another computer i will come to my routers ftp server.

isnt that wierd?
 
Old 09-16-2004, 06:25 AM   #27
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
That seems very unusual... paste your current firewall script up if you like, maybe we can see the problem. Otherwise, if you're not worried about it staying like that, good luck for the future
 
Old 09-16-2004, 06:29 AM   #28
ZliTroX
LQ Newbie
 
Registered: Aug 2004
Distribution: ...
Posts: 25

Original Poster
Rep: Reputation: 15
echo 1 > /proc/sys/net/ipv4/ip_forward

# by default, nothing is forwarded.
iptables -P FORWARD DROP

# Allow all connections OUT and only related ones IN
#iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT

# enable MASQUERADING
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# Open ports on router for server/services
iptables -A INPUT -j ACCEPT -p tcp --dport 21
iptables -A INPUT -j ACCEPT -p tcp --dport 80

# FTP, Port 21 Forwarded to FireWall
iptables -A FORWARD -j ACCEPT -p tcp --dport 21
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 21 -j DNAT --to 192.168.0.3:21

# HTTP, Port 80 Forwarded to FireWall
iptables -A FORWARD -j ACCEPT -p tcp --dport 80
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j DNAT --to 192.168.0.2:80
 
Old 09-16-2004, 06:43 AM   #29
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 21 -j DNAT --to 192.168.0.3:21

This line says "packets coming in on port 21 from eth1 should be sent to 192.168.0.3". Since eth1 is the connection to your local ethernet, your FTP packets are getting redirected to your own FTP service - I think you need to change -i eth1 to -i eth0. Same for the matching port 80 line... change them both and see if that fixes the problem. Let me know if you want me to test the external connection to HTTP as well.
 
Old 09-16-2004, 07:03 AM   #30
ZliTroX
LQ Newbie
 
Registered: Aug 2004
Distribution: ...
Posts: 25

Original Poster
Rep: Reputation: 15
i tried to change to eth1 but still didnt work.

i tried to comment out:
#iptables -A INPUT -j ACCEPT -p tcp --dport 21

# FTP, Port 21 Forwarded to FireWall
#iptables -A FORWARD -j ACCEPT -p tcp --dport 21
#iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 21 -j DNAT --to 192.168.0.3:21

but still didnt work...
 
  


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
An error occured getting IPtables status from the command /etc/rc.d/init.d/iptables s CrazyMAzeY Linux - Newbie 10 08-12-2010 05:25 AM
Iptables - Couldn't load target `ACCPET':/lib/iptables/libipt_ACCPET.so: z00t Linux - Security 3 01-26-2004 02:24 AM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 06:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 04:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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