Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

windows server 2003 DNS/website redirection

Posted on 2010-09-16
21
Medium Priority
?
705 Views
Last Modified: 2012-05-10
i am testing on a 2003 server, this is not a production box.

assuming my firewall doesnt have the ability to block a website, i decided to try blocking a website via DNS.  obviously the server i am running has DNS configured on it.

i had no problems at all creating a forward lookup, named it google and set the ip to all 0s or 1.2.3.4...it worked, i tried to navigate to google.com and it didnt work.

let's say i wanted to take this a step further and redirect any google.com lookups to yahoo.com.

is that possible, using DNS on the server?

thanks.
0
Comment
Question by:tomdlgns
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 5
  • 4
  • +1
21 Comments
 
LVL 10

Expert Comment

by:ddiazp
ID: 33694459
Yes it is,

Create a new CNAME (alias) record.

Name it www.google.com and point it to www.yahoo.com
0
 
LVL 10

Expert Comment

by:ddiazp
ID: 33694472
make sure the forward lookup zone google.com also has a cname to www.yahoo.com
0
 

Author Comment

by:tomdlgns
ID: 33694490
ok, trying that now.

thanks.
0
Looking for the Wi-Fi vendor that's right for you?

We know how difficult it can be to evaluate Wi-Fi vendors, so we created this helpful Wi-Fi Buyer's Guide to help you find the Wi-Fi vendor that's right for your business! Download the guide and get started on our checklist today!

 

Author Comment

by:tomdlgns
ID: 33694526
ok, i tried that and i didnt have any luck, i might not be doing it right.

do i create a new forward lookup zone or add it to my existing home.local zone?
0
 
LVL 10

Expert Comment

by:ddiazp
ID: 33694567
you need to add the google.com forward lookup zone if you don't have it already
0
 
LVL 10

Expert Comment

by:ddiazp
ID: 33694577
Right click 'Forward Lookup Zones' and click on 'Add new forward lookup zone'.


Follow the little wizard and name it google.com
0
 

Author Comment

by:tomdlgns
ID: 33694583
and what should i set as the ip?  anything that wont resolve, right?
0
 
LVL 9

Accepted Solution

by:
Aeriden earned 800 total points
ID: 33694609
This method will likely not work because while the CNAME record is used and will cause www.google.com to resolve to the IP address of Yahoo!, the Yahoo! server's will check the hostname passed as part of HTML (I just verified that www.yahoo.com doesn't work when the website is referenced via IP address alone).
0
 

Author Comment

by:tomdlgns
ID: 33694620
thanks Aeriden.  thats the issue i was afraid of.

there has to be a way to do this with windows dns, right?

0
 
LVL 1

Expert Comment

by:AlwaysOn_IT
ID: 33694666
One way you could get this to work, would be to set up a web server on your network, and configure the web server to redirect to www.yahoo.com.  Then you could just make cnames to point google and any other site to your web server, where it would then be redirected to yahoo.com.  Pretty easy to do the redirect part in IIS.
0
 

Author Comment

by:tomdlgns
ID: 33694677
interesting.  i don't know enough about IIS and web servers to do this.

could you create a quick and dirty edu?

or link me to a good one online?

thanks.
0
 
LVL 9

Expert Comment

by:Aeriden
ID: 33694681
I am not aware of the Microsoft DNS providing hostname redirects (forwarding redirect).  You could use IIS internally, have www.google.com resolve to the local IP address of IIS, have the web server to do a redirect.
0
 

Author Comment

by:tomdlgns
ID: 33694685
well, i am glad that two of you both pointed to IIS, that is a good sign.

thanks.
0
 
LVL 9

Assisted Solution

by:Aeriden
Aeriden earned 800 total points
ID: 33694750
One approach...  After IIS is installed, create a default.aspx page (in the c:\inetpub\wwwroot folder) that has the following:

<%@ Page language="c#" AutoEventWireup="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
  <title>Redirector</title>
</HEAD>
<body topMargin="0" rightMargin="0" leftMargin="0">
  <%
  if(Request.ServerVariables["SERVER_NAME"].ToLower() == "www.google.com")
  {
    Response.Redirect("http://www.yahoo.com");
  }
  %>
</body>
</HTML>

And then have the web.config contain:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
        <compilation defaultLanguage="c#" />
    </system.web>
</configuration>
0
 

Author Comment

by:tomdlgns
ID: 33694759
assuming yahoo is the only redirect, that would work.

if i wanted to do multiple sites i assume there is a better way?
0
 
LVL 9

Assisted Solution

by:Aeriden
Aeriden earned 800 total points
ID: 33694781
Just add more of the following blocks after the Google one:

  if(Request.ServerVariables["SERVER_NAME"].ToLower() == "www.anotherdomain.com")
  {
    Response.Redirect("http://www.redirecteddomain.com");
  }
0
 

Author Comment

by:tomdlgns
ID: 33694840
gotcha.

thanks.
0
 
LVL 1

Expert Comment

by:AlwaysOn_IT
ID: 33694993
Aeriden looks like he has the right ticket.
0
 

Author Comment

by:tomdlgns
ID: 33701075
thanks again for all the help guys.

i re-read this last night when i got home and i think there is still something that i am missing.

i can figure out how to create the web server, but how would it know to redirect certain sites?

meaning, when a user types in google.com in their browser, how does the PC redirect google.com to the web server?

i might not be phrasing my question properly.  before i butch it up even more, let me know if you guys know what i am asking.

thanks.
0
 
LVL 10

Expert Comment

by:ddiazp
ID: 33706355
Your local DNS server will have to have a forward lookup zone for each domain you want to redirect, and they all should point to your webserver,

PCs will query your local DNS so from the DNS management console you can administrate the first layer of redirection, then you apply the script above to redirect them to the other site
0
 

Author Comment

by:tomdlgns
ID: 33706364
thanks, that makes sense.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question