NicuVlad
NicuVlad

Reputation: 2601

Configure IIS hostname when using DNS

I need to use a host name for my internal tools so I made a request the DNS guy to add the "oneplan.dev.ad.trw.com" in the DNS server configuration.

After received that he did this: enter image description here

But when I access the "oneplan.dev.ad.trw.com" I get the IIS welcome page: enter image description here

And if I specify the port: oneplan.dev.ad.trw.com:6202. The page is displayed correctly.

What I need to to in order to make it work without the port in the URL? I can't use the default port 80 because I have multiple application on the same server.

Upvotes: 0

Views: 14570

Answers (2)

Terrence Ward
Terrence Ward

Reputation: 176

open c:\windows\system32\drivers\etc\hosts in notepad as administrator, make an entry:

10.27.233.121 oneplan.dev.ad.trw.com

go into a command window (windowskey+R to open run box and enter cmd) and type ipconfig /flushdns

Congrats, you've just overridden the DNS for that domain address and your computer specifically will always point to the new IP that you defined in the hosts file. Remember to clear it out once your domain is done propagating (your dns guy should have put an A record in the DNS handling the server)

Upvotes: 0

user3259797
user3259797

Reputation:

You have two options:

Option 1 - Explicit Host Names

Make sure none of the sites have a wildcard binding on port 80 - ensure they all have a unique Host Name specified. If they look like the following, you must added configure an explicit Host Name (e.g. dev.ad.trw.com or *.dev.ad.trw.com) under bindings:

enter image description here

Once this has been completed, you should be able to change the port of your new site from 6262 to 80 and IIS will route port 80 traffic to the appropriate site based upon Host Name.

Option 2 - Add IP Address to Network Card

In order to host 2 sites on port 80 on the same machine without explicit Host Names as suggested in Option 1, you need a new IP address added to the network interface. I'm not sure what version of windows you're running and whether your server has the windows GUI installed. If it does, just go into the network settings for the card and follow the instructions below. It's a fairly straight forward.

  1. First open the properties for the network connection, highlight the IPv4 option and click properties:

enter image description here

  1. On the properties page write down the IP Address and the Subnet Mask and then click the Advanced button on the bottom right (got cutoff in the screenshot:

enter image description here

  1. On the advanced properties page popup, click Add in the IP address section and enter a new IP address with the same 3 octets, and any number between 20 and 255 for the final octet (eg. 10.27.233.121 based on your screenshot above). For the subnet mask copy the subnet form the other IP address(es) configured on the machine (e.g. 255.255.255.0) and click ok to save the settings...and continue clicking OK until all of the properties dialogs are closed.

enter image description here

  1. Next go into IIS Manager, click on each of the sites on the server and select Bindings from the Actions panel on the right side. Make sure all sites are bound the original 10.27.233.21 IP address like the site in your screenshot. If you see any sites with a wildcard "*" for the IP Address, modify them to the 10.27.233.21 as well. Once that's done, open the site bindings settings for you site (same as your first screenshot) and configure its bindings the new IP address 10.27.233.121 and change port 6202 to port 80.

enter image description here

  1. To test that the configuration is working do the following (do this on the server): (1) launch Notepad with administrate privileges, (2) click open, (3) paste the following path into the "File Name:" textbox C:\Windows\System32\drivers\etc\host, (4) click ok to open the file, (5) hit enter at the bottom of the text file and paste the following - [IP Address][Tab][DNS Name], and (6) save the file:

10.27.233.121 oneplan.dev.ad.trw.com

If the site loads, you're all set. Delete the line we added to the Host file in the last step, and tell you server guy to modify the DNS record for oneplan.dev.ad.trw.com to point to 10.27.233.121.

Upvotes: 4

Related Questions