Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 11-24-2004, 03:38 AM   #1
Registered: Jul 2003
Posts: 152

Rep: Reputation: 30
Help:iptables redirection


Here is the setting of my NAT server in my company.

The following command is to redirect
all client with ip:10.100.129.[anything] to the web server of the NAT.

/sbin/iptables -t nat -A PREROUTING -i eth1 -p tcp -s --
dport 80 -j REDIRECT --to-port 80

Is there any command to redirect
all client with ip:10.100.129[anything] to a web site e.g.

Thanks a lot.
Old 11-24-2004, 03:43 AM   #2
LQ Guru
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
use DNAT, I don't think you'll be able to direct the traffic to that particular directory, that's more of a web server configuration.
Old 11-24-2004, 07:47 AM   #3
Senior Member
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
Redirecting with iptables just works on ip numbers..

You won't be able to use iptables to redirect to a web page by name, just by ip number.. That's the job of a proxy server redirect. It works with url names..

As Demonbane mentioned, you could setup the webserver of the NAT box to redirect using the mod_proxy or mod_rewrite modules if you have apache..


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Redirection in Apache gonzo22 Linux - Networking 5 02-12-2005 09:54 AM
IPtables Redirection Exception? BoarderX Linux - Networking 7 09-22-2004 06:43 PM
redirection in C pantera Programming 2 08-11-2004 01:06 PM
redirection of ftp using iptables bacon22 Linux - General 1 03-10-2004 05:21 PM
Iptables, Port redirection... and I'm a nimrod finegan Linux - Networking 3 09-14-2003 01:48 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:20 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration