nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

iptables for webserver

This is a discussion on iptables for webserver within the Networking, Firewalls and Security forums, part of the Mastering Servers category; Hi, I've firewall with public ip, and webserver on private ip, i've map post 80 for from outside for my ...


Go Back   nixCraft Linux Forum > Mastering Servers > Networking, Firewalls and Security

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-09-2007, 06:08 AM
Member
User
 
Join Date: Jul 2006
Posts: 48
Rep Power: 0
asim.mcp
Unhappy iptables for webserver

Hi,

I've firewall with public ip, and webserver on private ip, i've map post 80 for from outside for my webserver, but when i try to access my website from local network it treat it as local which rule i'll have to define in firewall to finish this loop ??


Regards
Asim.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-09-2007, 05:15 PM
Senior Member
User
 
Join Date: Dec 2006
Location: /B!n@ry
My distro: openSuSE 10.2
Posts: 127
Rep Power: 0
B!n@ry
Send a message via MSN to B!n@ry
Default

Please give me the INTERFACES and IP's so that I can write the rule exactly for you.
__________________
LivE Free 0r DiE
L!nux rul3z aLL
Reply With Quote
  #3 (permalink)  
Old 08-09-2007, 05:18 PM
Senior Member
User
 
Join Date: Dec 2006
Location: /B!n@ry
My distro: openSuSE 10.2
Posts: 127
Rep Power: 0
B!n@ry
Send a message via MSN to B!n@ry
Default

iptables -A OUTPUT -i lo --dport 80 -j ACCEPT
__________________
LivE Free 0r DiE
L!nux rul3z aLL
Reply With Quote
  #4 (permalink)  
Old 08-09-2007, 05:19 PM
Senior Member
User
 
Join Date: Dec 2006
Location: /B!n@ry
My distro: openSuSE 10.2
Posts: 127
Rep Power: 0
B!n@ry
Send a message via MSN to B!n@ry
Default

I shall check it out and tell you. Maybe my last command isn't right
__________________
LivE Free 0r DiE
L!nux rul3z aLL
Reply With Quote
  #5 (permalink)  
Old 08-10-2007, 05:12 AM
Member
User
 
Join Date: Jul 2006
Posts: 48
Rep Power: 0
asim.mcp
Default

Thanks for your replay.

Actually i've a linux firewall with public ip, and my webserver is running on private ip so to access my webserver from outside i've inserted rule for port forwarding in linux iptables, so when it is ok when any query comes from internet of 80 for my webserver but if i try to access my site from my firewall machine it does not forward it to my webserver and consider it as local query.

Regards
Asim.
Reply With Quote
  #6 (permalink)  
Old 08-10-2007, 08:14 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 919
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

Quote:
Originally Posted by B!n@ry View Post
iptables -A OUTPUT -i lo --dport 80 -j ACCEPT
Naa it won't work as it open port 80 for loopback only

Code:
iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d WEB-SERVER-IP --dport 80 -j ACCEPT
@asim.mcp can you paste your existing iptables rules?
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #7 (permalink)  
Old 08-12-2007, 12:20 AM
Senior Member
User
 
Join Date: Dec 2006
Location: /B!n@ry
My distro: openSuSE 10.2
Posts: 127
Rep Power: 0
B!n@ry
Send a message via MSN to B!n@ry
Default

But nix about your solution, will it open the port for the Loop Back ? as the problem he is facing as I understood is from the loop back !!!

What do u say?
__________________
LivE Free 0r DiE
L!nux rul3z aLL
Reply With Quote
  #8 (permalink)  
Old 08-12-2007, 12:05 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 919
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

Quote:
Originally Posted by B!n@ry View Post
But nix about your solution, will it open the port for the Loop Back ? as the problem he is facing as I understood is from the loop back !!!

What do u say?
I'm assuming that loopback (lo) has unlimited access to all ports so above rule should work out
__________________
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
Iptables nixsen CentOS / RHEL / Fedora 2 11-29-2007 03:01 PM
iptables help vitaminme Networking, Firewalls and Security 1 09-04-2007 02:42 AM
IPTABLES Help asim.mcp Linux software 3 07-08-2006 02:53 AM
IPTABLES help vasanth Linux software 1 03-09-2005 09:15 AM


All times are GMT +5.5. The time now is 11:15 PM.


Powered by vBulletin® Version 3.7.3 - 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