Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| 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. |
|
 |
04-20-2003, 09:13 PM
|
#1
|
|
LQ Newbie
Registered: Apr 2003
Posts: 1
Rep:
|
(IPTABLES) redirect web site to a file?
Is it possible to redirect ... www.whatever.com to a file on the local drive... for example, if they went to go to this particular website, instead of the page showing in the browser, a picture saying this website is off limits would appear in the browser?????
TIA
|
|
|
|
04-20-2003, 09:37 PM
|
#2
|
|
Senior Member
Registered: Oct 2002
Location: Belgium
Distribution: Debian, Free/OpenBSD
Posts: 1,123
Rep:
|
sure, if you own the domain name and configure apache so it shows that picture upon connection.
|
|
|
|
04-20-2003, 09:37 PM
|
#3
|
|
Guru
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,154
Rep:
|
index.html in the DocumentRoot of the VirtualHost
the index.html file can contain a picture or whatever message you want
|
|
|
|
04-21-2003, 01:21 AM
|
#4
|
|
Member
Registered: Jul 2002
Location: Ohio, USA
Distribution: Redhat, Gentoo, Solaris, HP-UX, etc...
Posts: 391
Rep:
|
Do I read this right, as you are trying to control outbound connections to external (banned) websites? Like proxying or a net-nanny thing, keeping the kids from looking at nasty things?
The answers so far have been for incoming connections to a website that you host.
I don't know if "linux-newbs" is the right forum for this kinda question. You may want to get it moved to "linux-security". (don't double-post, just ask the moderator to move it).
Last edited by jdc2048; 04-21-2003 at 01:22 AM.
|
|
|
|
04-21-2003, 01:43 AM
|
#5
|
|
Guru
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,154
Rep:
|
Oh I see what your saying now!
I think
try something like dans guardian or squidguard
Last edited by DavidPhillips; 04-21-2003 at 01:47 AM.
|
|
|
|
04-21-2003, 10:52 AM
|
#6
|
|
Guru
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280
Rep:
|
you could do this with iptables easily, let's say you dont want computers on your network to access whatever.com, i'd do an nslookup on whatever.com and lets say the ip of whatever.com is 1.2.3.4, here is what your iptable rule could look like:
iptables -t nat PREROUTING -d 1.2.3.4 -p tcp --dport 80 -j DNAT --to-destination 192.168.x.x
this will forward any incomming packets that are bound for 1.2.3.4 to 192.168.x.x ,if you have a web server running on 192.168.x.x then you can display whatever you want. if im wrong, someone correct me
|
|
|
|
04-21-2003, 12:19 PM
|
#7
|
|
Guru
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,154
Rep:
|
that looks right,
This could grow very big and be somewhat intensive unless you are just blocking the one, or a few sites.
squidguard or dans guardian will block sites based on name, or content. without adding each site manually.
|
|
|
|
04-21-2003, 01:09 PM
|
#8
|
|
Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,611
Rep:
|
The only hole I can see to shoot in that idea is that if the IP of whatever.com is dynamic
Cool
|
|
|
|
08-11-2008, 05:42 AM
|
#9
|
|
LQ Newbie
Registered: Jul 2008
Posts: 10
Rep:
|
This rule is not working any idea?
Hi robert,
Quote:
Originally Posted by Robert0380
iptables -t nat PREROUTING -d 1.2.3.4 -p tcp --dport 80 -j DNAT --to-destination 192.168.x.x
this will forward any incoming packets that are bound for 1.2.3.4 to 192.168.x.x ,if you have a web server running on 192.168.x.x then you can display whatever you want.
|
I have tried this rule but not able to run this command with argument PREROUTING and --dport.
I am getting error like this
Bad argument `PREROUTING'
Try `iptables -h' or 'iptables --help' for more information.
and plz also specify me that how ant I flush this rule if applied then.
I want to redirect mail.google.com to mail.aspl.in in my network.
Thanx in advance......
Last edited by bhargavbhai; 08-11-2008 at 05:44 AM.
Reason: some corrections
|
|
|
|
08-11-2008, 05:53 AM
|
#10
|
|
Senior Member
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,684
Rep:
|
append "-I" (or "-A") before PREROUTING
like:
iptables -t nat -I PREROUTING -d 1.2.3.4 -p tcp --dport 80 -j DNAT --to-destination 192.168.x.x
|
|
|
|
| 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 01:31 PM.
|
|
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
|
|