LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-16-2009, 10:08 PM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Rep: Reputation: 54
Redirect all traffic to IP nn to internal IP xx


Lets say I have 24 external IP addresses of 120.120.120.1-120.120.120.24 on one server, and on that server I have an internal IP of 192.168.1.10 (VMware "host only" network or internal NAT).

I want all traffic directed at 120.120.120.20 to go to the internal IP 192.168.0.10, and I want all traffic coming out of that IP come out as from 120.120.120.20.

So basically, guess this would be a simple NAT.

How would I do this in iptables, what are the commands?

I'd also like to fine tune it where I block most traffic and only allow a few ports.

I also want to be able to block IPs, that part I know how.

Could someone point me in the right direction for writing a rule like this?

Thanks.
 
Old 03-17-2009, 05:20 PM   #2
kristrev
LQ Newbie
 
Registered: Mar 2009
Posts: 10

Rep: Reputation: 0
Hi,

I recomned this page, it has very good explanation of iptables. But in summary, you will use PREROUTING rules for configuring the direction of the traffic.
 
  


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
redirect traffic tim_24 Linux - Networking 4 05-27-2007 11:39 PM
Redirect All Traffic Through SSH wwnexc Linux - Networking 2 03-14-2007 05:37 AM
redirect traffic tim24 Linux - Networking 5 04-06-2006 10:45 AM
Traffic redirect friki Linux - Software 2 11-04-2004 04:59 PM
Redirect traffic to internal IP? xmutex Linux - Networking 1 08-13-2001 10:29 AM

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

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