[PLUG] Re: Web server setup

SWAPNIL postmaster at modular-infotech.com
Wed May 24 11:42:07 IST 2006


Hi ,

call ISP persons to configure ur ADSL Router in NAT mode.
then u can set ur external IP address to any Linux box which having IPTABLES
services installed
then make following changes in ur Linux box

edit /etc/sysctl.conf
change 0 to 1 in first options this will allow to packet forwarding
# Controls IP packet forwarding
net.ipv4.ip_forward =  1

edit /etc/rc.local
insert following lines in it after touch ....... line.
# Module to track the state of connections
modprobe ip_conntrack
# Load the iptables active FTP module, requires ip_conntrack
modprobe ip_conntrack_ftp
# Load iptables NAT module when required
modprobe iptable_nat
# Module required for active an FTP server using NAT
modprobe ip_nat_ftp

now try following commands on shell.
thease commands will work till next reboot of gateway system
accessing from outside network
iptables -t nat -A PREROUTING -p tcp -d xx.xx.xx.xx --dport 80  -j
DNAT --to-destination 192.168.1.1
accessing from internal network
iptables -t nat -A POSTROUTING -p tcp --dst 192.168.1.1 --dport 80  -j
SNAT --to-source yy.yy.yy.yy

where xx.xx.xx.xx is the static IP address of your router (Eth1) and
yy.yy.yy.yy is the internal IP address of the router (Eth0).

if u want permenantaly then try this
service iptables save
this will save all entries in following file for next reboot.
/etc/sysconfig/iptables
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
[0:0] -A PREROUTING -d xx.xx.xx.xx -p tcp -m tcp --dport 80 -j
DNAT --to-destination 192.168.0.1
[0:0] -A POSTROUTING -d 192.168.0.1 -p tcp -m tcp --dport 80 -j
SNAT --to-source yy.yy.yy.yy
COMMIT

Regards
Swapnil K.
System admin
Modular Infotech Pvt. Ltd.


----- Original Message -----
From: "Real Time Computers" <realtime_computers at yahoo.com>
To: "Pune GNU/Linux Users Group Mailing List" <plug-mail at plug.org.in>
Sent: Tuesday, May 23, 2006 11:54 PM
Subject: [PLUG] Re: Web server setup


> --- sudhanwa Jogalekar <sudhanwa.com at gmail.com> wrote:
>
> > On 5/19/06, Aditya Laghate <laghatea at gmail.com> wrote:
> > > Hi,
> > >
> > > I am trying to setup a web server. I shall explain the senario,
> > kindly let
> > > me know if you know
> > > how to go about it.
> > >
> > > Senario.
> > >
> > > 1) I have a public IP address: x.x.x.x
> > > 2) I have a bugzilla server running on the internal local network
> > on :
> > > a.a.a.a
> > >
> > > 3) I need people to access this bugzilla server from the public
> > address
> > > x.x.x.x
> > >
> > > How can I do that? Do I need to use the iptables, to route
> > traffic or
> > > does apache have a facility to serve pages from the internal
> > machine?
> > >
> >
> > I think setting up dynamic dns for your ip should solve your
> > problem.
> > There could be some other ways too, but thatdepends on the kind of
> > infrastructure you have.
> >
> > -Sudhanwa
> >
> >
> >
> >
> > > Let me know.
> > >
> > > Cheers
> > > Aditya
>
> Hi,
> How do you access Internet? Probably through ADSL router, I assume.
> Then go to 192.168.1.1 (router's IP no.) then go to menu similar to
> advanced - virtual server etc and then just forward the port no to
> internal address. for this to work NAT must be configured on the
> router. Interestingly you can forward another port (say smtp) to
> other PC running sendmail / qmail. You can have as many port
> forwarded as required.
>
> Off course you can use iptables. ie. configure Linux as  NAT gateway
> & then forward port 80 (or other) to internal host.
> Try using firestarter a GUI based utility to do this.
>
>
> Bye Rahul.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> --
> ______________________________________________________________________
> Pune GNU/Linux Users Group Mailing List:      (plug-mail at plug.org.in)
> List Information:  http://plug.org.in/cgi-bin/mailman/listinfo/plug-mail
> Send 'help' to plug-mail-request at plug.org.in for mailing instructions.





More information about the Plug-mail mailing list