LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-13-2008, 07:02 AM   #1
Ronin_tekorei
Member
 
Registered: May 2006
Distribution: Fedora
Posts: 57

Rep: Reputation: 15
iptables - problem whit lan access to apache and ftp service


hello agian
now i come whit a problem on my iptables whit the internal lan and it permisions to access the service that of http, ftp and mail.
I have configure my servers of vsftpd, httpd and squiremail. The problem is that my internal lan connected to my server that working as transparent proxy squid and as webserver to the internet can not access this service, in other words, when i put in firefox www.cdeonline.net (my domain) on one of the lan machines it does not open, and stay waiting for the server, first i though it was a problem on my config, so i asked a friend in EE.UU. to tray and open it, he says it works fine, but for my lan and my server, when i tray to access www.cdeonline.net it does not open, it says it is wayting to the server of cdeonline.net. When i tray to access the ftp server it just stay loading and nothing more.
Please i add my iptables scrip so you can tell me whats wrong whit it, i think it should work but it is not... :P please, some one can help?
Code:
#!/bin/bash
#Internet
EXT_DEV="eth1"
EXT_NET="1.1.1.1/30"
EXT_IP="1.1.1.3"
#LAN
INT_DEV="eth0"
INT_NET="192.168.1.0/24"
INT_IP="192.168.1.254"
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
iptables -A INPUT -i lo -s 127.0.0.0/8 -j ACCEPT
iptables -A OUTPUT -o lo -s 127.0.0.0/8 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type any -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type any -j ACCEPT
iptables -A FORWARD -p icmp --icmp-type any -j ACCEPT
iptables -A INPUT -i $INT_DEV -s $INT_NET -j ACCEPT
iptables -A OUTPUT -o $INT_DEV -s $INT_NET -j ACCEPT
iptables -A OUTPUT -o $EXT_DEV -j ACCEPT
iptables -A FORWARD -i $INT_DEV -s $INT_NET -o $EXT_DEV -j ACCEPT
iptables -t nat -A PREROUTING -i $INT_DEV -s $INT_NET -p tcp --dport 80 -j REDIRECT --to-port 3128
iptables -t nat -A POSTROUTING -o $EXT_DEV -s $INT_NET -j SNAT --to-source $EXT_IP
iptables -A INPUT -i $EXT_DEV -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i $EXT_DEV -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i $EXT_DEV -m state --state NEW -m tcp -p tcp --syn --dport 53 -j ACCEPT
iptables -A INPUT -i $EXT_DEV -m state --state NEW -m udp -p udp --dport 53 -j ACCEPT
iptables -A INPUT -i $EXT_DEV -m state --state NEW -m tcp -p tcp --syn --dport 20 -j ACCEPT
iptables -A INPUT -i $EXT_DEV -m state --state NEW -m tcp -p tcp --syn --dport 21 -j ACCEPT
iptables -A INPUT -i $EXT_DEV -m state --state NEW -m tcp -p tcp --syn --dport 25 -j ACCEPT
iptables -A INPUT -i $EXT_DEV -m state --state NEW -m tcp -p tcp --syn --dport 465 -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp --syn --dport 80 -j ACCEPT
iptables -A INPUT -m state --state NEW -m udp -p udp --dport 80 -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp --syn --dport 443 -j ACCEPT
iptables -A INPUT -i $EXT_DEV -m state --state NEW -m tcp -p tcp --syn --dport 636 -j ACCEPT
iptables -A INPUT -i $EXT_DEV -m state --state NEW -m tcp -p tcp --syn --dport 993 -j ACCEPT
 
Old 01-13-2008, 10:32 AM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
If I understand this you are trying to access the web server with the domain name and or wan IP from an internal lan machine. If so then check this out.
http://www.linuxquestions.org/questi...highlight=dnat

Brian
 
Old 01-13-2008, 05:21 PM   #3
Ronin_tekorei
Member
 
Registered: May 2006
Distribution: Fedora
Posts: 57

Original Poster
Rep: Reputation: 15
ok, done. Thanks brian1 the solution was te DNAT of the ip to the internal ip. another problem resolve
 
Old 01-14-2008, 04:22 PM   #4
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
If you could please post the changes you added to resolve to help others in the future.

Brian
 
Old 01-17-2008, 09:03 AM   #5
Ronin_tekorei
Member
 
Registered: May 2006
Distribution: Fedora
Posts: 57

Original Poster
Rep: Reputation: 15
oh, sorry, in the heat of the momment i forget to put my changes so here it goes
Code:
#Redirection of packets to publicip from the internal network to the internal ip.
INT_DEV=eth0 #Internal Device
INT_IP=192.168.1.254 #The ip of yur server for the internal lan
EXT_IP=publicip #The ip that you use to connect to the internet
iptables -t nat -A PREROUTING -i $INT_DEV -d $EXT_IP -j DNAT --to-destination $INT_IP
 
Old 01-17-2008, 05:21 PM   #6
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Thanks for the info. Should help many others with same iptables issue.

Brian
 
  


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
Access problem whit userdir/public_html adapter Linux - Server 1 05-13-2007 07:46 AM
Problem whit my iptables Plutonium Linux - Security 5 01-14-2006 10:03 AM
Windows ftp service behind IPTABLES lscala Linux - Security 2 02-29-2004 07:30 PM
Allowing access to FTP server on LAN using IPTABLES - Help please sergio3986 Linux - Security 2 12-18-2003 12:22 PM
FTP from LAN by using IPTABLES fddi1 Linux - Networking 0 10-03-2001 06:59 AM

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

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