LinuxQuestions.org
Review your favorite Linux distribution.
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 05-05-2004, 06:08 AM   #1
nitin_kataria
LQ Newbie
 
Registered: Sep 2003
Posts: 16

Rep: Reputation: 0
Unhappy Ip Forwarding


Ip Forwarding
hey guys please help me out !!
i want to forward a request from my static/public IP to any of our LAN Ip Address i tried it using iptables , can anybody give me steps to write new iptable to do the stuff
 
Old 05-05-2004, 08:41 AM   #2
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
1 - routing must be enabled. edit /etc/sysctl.conf and change the following line
net.ipv4.ip_forward = 1

restart network.

here is an example for local http server (tcp 80):

static public ip of linux: 212.1.1.1
private ip of linux : 192.168.0.1

ip of local http server: 192.168.0.2

iptables -t nat -A PREROUTING -d 212.1.1.1 -p tcp --dport 80 -j DNAT --to 192.168.0.2

also SNAT must be defined for local server otherwise the packets come from internet wont return to sender:
iptables -t nat -A POSTROUTING -s 192.168.0.2 -j SNAT --to 212.1.1.1

i hope this example will help u
 
  


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
Mail Forwarding in postfix/maildrop/redhat (like yahoo mail forwarding) topcat Linux - Software 1 08-31-2007 12:10 PM
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
Simple Port Forwarding Firewall - not forwarding MadTurki Linux - Security 14 04-09-2006 12:08 PM
IP Forwarding Dhax Linux - Networking 2 03-20-2004 10:13 AM
port forwarding and packet forwarding syrtsardo Linux - Newbie 2 07-03-2003 10:37 AM

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

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