LinuxQuestions.org
Visit Jeremy's Blog.
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 04-06-2008, 12:06 AM   #1
genderbender
Member
 
Registered: Jan 2005
Location: US
Distribution: Centos, Ubuntu, Solaris, Redhat
Posts: 396

Rep: Reputation: 31
iptables to redirect ip


Hello, I'm running a web server on port 80 (IP is 192.168.1.1) and have 2 computers connected viw wifi (192.168.1.2, 192.168.1.3). I want all the computers to hit the webserver before they get access to the internet, in other words if 192.168.1.2 wants to get to www.google.com he'll be redirected to the 192.168.1.1 webpage.

Whats the best and easiest way to do this, IPtables seems most feasible but I've no idea how

Thanks
 
Old 04-06-2008, 01:53 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
The only way you can enforce the redirection (i.e. w/o the cooperation of the requesting computer) is to have your wireless router (or whatever is between these computers and the Internet) to do the redirection. I'm guessing that's not an option for you, but if it is, post back.

There are two ways for the requesting computers to do the redirection. One (which will work the same way on any OS) is to set up the browser(s) to use 192.168.1.1 as a proxy. One drawback to this solution is any user can change his own settings and defeat this.

The other option is to have the firewall redirect. This method will, of course, depend on the OS the computer is running. If the computer is running Linux, I believe the following rule will work.

Code:
iptables -t nat -A OUTPUT -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1

Last edited by blackhole54; 04-06-2008 at 01:55 AM. Reason: spelling
 
  


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
iptables redirect sanjibgupta Linux - Networking 3 05-18-2007 03:16 AM
iptables redirect patvrs Linux - Networking 15 08-02-2005 08:31 AM
iptables redirect _ben_deb_ Linux - Networking 7 11-13-2004 05:06 AM
iptables redirect slack Linux - Networking 0 06-17-2002 04:04 AM
iptables redirect bhartnett Linux - Networking 1 09-26-2001 09:11 PM

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

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