Port forwarding help
Friends,
The networking setup in my office is as follows.
One Ubuntu machine with 2 NIC is made as a gateway
eth1 : The Public interface which is connected to the modem
The IP no 192.168.1.1 is assigned(dhcp) in eth1 interface
We have static IP address provided by the ISP (117.218.X.X)
eth0 : The Local interfaces connecting to internal
(static IP assigend as 192.168.0.78)
machines(192.168.0.x/255.255.255.0)
Now, a web application has been developed in LAMP and hosted in the machine 192.168.0.48 and is available to around 50 computers in our office.
We would like to this machine 192.168.0.48 as a public server so that the sub offices (around 200 nos) can access the application. I think port forwarding the procedure and adding the following rules to the iptables will work ( Am I correct?)
#iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j DNAT --to 192.168.0.48:80
#iptables -A FORWARD -p tcp -d 192.168.0.48 -j ACCEPT
This is the iptables rules of the gateway
===============================================
:PREROUTING ACCEPT [19:1629]
:INPUT ACCEPT [8:693]
:OUTPUT ACCEPT [3:178]
:POSTROUTING ACCEPT [1:73]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Thu Jul 30 12:24:51 2015
# Generated by iptables-save v1.4.21 on Thu Jul 30 12:24:51 2015
*filter
:INPUT ACCEPT [22:1237]
:FORWARD ACCEPT [5:420]
:OUTPUT ACCEPT [18:762]
-A FORWARD -i eth1 -j ACCEPT
COMMIT
=============================================================
If I am wrong, correct and guide me [It is urgent pls]
|