Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-12-2008, 05:16 AM
|
#1
|
|
LQ Newbie
Registered: Jan 2008
Posts: 9
Rep:
|
port forwarding to internal web-server using iptables
Hello,
Greetings to all!
We are re-configuring our network. We want to route all external traffic through a dual-NIC gateway machine which will be running squid along with iptables. The clients are currently directly connected to the internet ie on each of them, the ISP's router is set as the gateway. We want the clients to connect to the internet through the gateway machine. The gateway machine would, in turn, connect to the ISP's router.
I'm now halfway into the migration process. The squid machine is up and running and all the clients (now with internal IPs) can connect to the net. However,the problem is that, we also have two web-servers running on internal machines plus a DNS server on another machine which need to be accessible from outside. Before the re-configuration, all these machines had public IPs and hence were accessible from outside, but now, after their conversion to local addresses, this is no longer the case.
I want to use iptables to set up port forwarding at the gateway so that any TCP or DNS request automatically gets forwarded to the relevant machines.
Two questions are plaguing me however:
1)will it be necessary to actually set the (external)IPs of the web and dns servers on the gateway machine or will iptables trap the packets by simply observingthe IP adds of the packets when they are routed to the gateway machine from the ISP end?
2)what will be the NATting rules like? will it be something like:
#iptables -t nat -I PREROUTING -p tcp -i eth0 --dport 80 -j DNAT --to-dest\
192.x.x.x:80
Any help will be gratefully accepted.
Thanks in advance!
|
|
|
|
08-12-2008, 05:52 AM
|
#2
|
|
Senior Member
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,592
Rep: 
|
I feel yes this is true. You will need the live IP address of the web servers you have to be set up either on the servers running apache and put them directly online or on gateway and route the appropriate traffic on servers. The second option is better as this will encapsulate your web server from the external traffic and secure them.
This can be done using Iptables the same way you mentioned. But you will need to give some attention when making policies about the iptables rules to route the appropriate traffic to your web server and still other systems are on internet. This should not be very difficult but still being cautious will help.
|
|
|
|
08-12-2008, 10:26 AM
|
#3
|
|
Member
Registered: Jun 2006
Location: Johannesburg, South Africa
Distribution: Ubuntu, CentOS, Debian
Posts: 47
Rep:
|
You might also want to look at running squid in accelerator mode. You can also then filter out inappropriate requests as needed, for example someone trying to attack your webserver...
|
|
|
|
08-13-2008, 03:22 AM
|
#4
|
|
LQ Newbie
Registered: Jan 2008
Posts: 9
Original Poster
Rep:
|
Thanks, guys !
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:45 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|