Configure IIS hostname when using DNS - windows

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:
But when I access the "oneplan.dev.ad.trw.com" I get the IIS welcome page:
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.

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:
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.
First open the properties for the network connection, highlight the IPv4 option and click properties:
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:
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.
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.
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.

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)

Related

set browser to open local address instead of internet address

I use 2 NICs card on my windows, one of the local and another one is connected to the internet, now my question is how can I set the specific browser to open just the Local website instead of the internet? I set the route command to route the IP address that I want to open locally but when I check the logs I find the IP open with internet NIC instead of Local NIC
There two methods of getting this done as per your request the first method would work for you:-
The first method:-
we can use static route route but we have to obtain the IDs for our NICs by running the command below:-
netsh interface ipv4 show interfaces
The above command will get you the NIC ID
Add a persistent route by using the command below in CMD this will lock the specified traffic from a specific network to the specified network interface using the NIC IDx see syntax command below via CMD.
route -p add local_subnet mask local_subnet_mask 172.132.45.201 IF
interface_ID
For example command below, please change the values as per your environment or network:-
route -p add 192.168.0.6 mask 255.255.255.255 172.132.45.201 IF 13
The Second Method:
You will need to edit your hosts file that will enable you to override the DNS for a domain on a specific machine.
Modifying your hosts file causes your machine to look directly at the IP address that you specify
Modifying the hosts file involves adding entries to it to the file . Each entry contains the IP address to which you want the site to resolve.
192.168.190.4 www.local_domain.com
192.168.190.4 local_domain.com
13.14.15.16 www.external_domain.com
13.14.15.16 external_domain.com
Below are the steps to edit the hosts file in Windows 10/11 and Windows Server 2012 and newer versions (you didn't specify which version of Windows).
Press the Windows key.
Type Notepad in the search field.
In the search results, right-click Notepad and select Run as administrator.
From Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts
Make the necessary changes to the file.
Select File > Save to save your changes.
For Windows, you may have to reboot your computer and this will work independently of the NIC setup.

How to clear DNS cache of internet provider

I changed the dns of my website and i noticed that it still not applied yet but after awhile I opened my website using VPN from other country and the dns was changed to my new server.
How to clear the local internet cache of the internet provider ?
So, a really good way to check if a DNS is updated globally is to use googles DNS checker tool. You can get to it through this link
https://dns.google.com/
Go to that website and type in the url of your website, and make sure that it has the correct IP address.
If that worked, you can be confident it is a problem with your local cache. You can use the google server dns instead of the default server your computer comes with, which will match the server you just checked with the website.
For WINDOWS 10:
Open Control Panel
Click Network and Internet
Click Network and Sharing Center
Click Change adapter settings
Right-click the network interface connected to the internet and select properties
Select and check the internet protocol version 4 (TCP/IPv4) option
Click the properties button
Click use the following DNS server
type 8.8.8.8 for preferred and 8.8.4.4 for alternate (these are the addresses to google dns servers, the ones you just checked with the webstite earlier)
For mac:
Go to system preferences
Select network
Click on advanced
Select DNS
Select the default dns server ip address and click - at the bottom of the DNS servers box
Click on the + sign at the bottom on the DNS servers box and enter
8.8.8.8 and 8.8.4.4
Click ok
Click apply
Credit:
https://www.windowscentral.com/how-change-your-pcs-dns-settings-windows-10
https://www.my-private-network.co.uk/kbhome/how-to-set-google-dns-on-your-mac-os-x-computer/
Google is generally very quick in updating their DNS, so it should be more than a few minutes till your server is up and running with the new DNS.

Instead of IP Address use Hostname in IIS 7

I have a simple project in asp.net mvc3 I publish in my local PC and using my IP Address to open it. I try to use the hostname that I set in the IIS but it will not open the project. How to use hostname in IIS7?. Anyone knows?.
To add a hostname in IIS7 follow this procedure from Microsoft:
Open IIS Manager. For information about opening IIS Manager, see
Open IIS Manager (IIS 7).
In the Connections pane, expand the Sites
node in the tree, and then select the site for which you want to
configure a host header.
In the Actions pane, click Bindings.
In the
Site Bindings dialog box, select the binding for which you want to
add a host header and then click Edit or click Add to add a new
binding with a host header.
In the Host name box, type a host header
for the site, such as www.contoso.com.
Click OK.
To add an
additional host header, create a new binding with the same IP
address and port, and the new host header. Repeat for each host
header that you want to use this IP address and port.
This configuration means requests received by IIS for this hostname will be sent to the specific site you have configured.
However you need a configuration for requests to actually arrive to this IIS Server and this is where DNS is used.
Your server can be found via its IP(s) address(es). Here you want your server to be found via a hostname, so you need a configuration somewhere which says your hostname points to your server IP.
If this is for an intranet site, ask your network team.
If this is for an internet/extranet website, you need to buy a domain name, and your provider will allow you to make the DNS configuration.
If this is for local (windows) use only, you can bypass DNS by using the hosts file. Check this page for example. The hosts file allows you to tell your local computer to point a hostname to the IP of your choice.

How can I access a website on a Local Network in an OSX environment

So I have a website that I created locally but I would like to have other team members access it. I would also like to test my site using my iPhone for testing purposes. Th thing is when I check the Xip.io (LAN only) option (shown in the image below) a URL is displayed in the empty box below it. The problem is that when I use that URL the Xip.io URL in the browser of my iPhone. Nothing displays. Is there an easier way to make my website accessible from other machines locally? Is there a file that I need to edit or are my changes correct?
Thanks
Update
I'm using my internal IP. I can access my site with my laptop but other computers connected to my network cannot access my website. I figure that maybe I need to make a change to my httpd.conf file?
Found a solution! Since I'm working in OSX
Here are my steps:
Go to System preferences Selected Network
Select Wifi (since I'm connected via Wi-fi)
Clicked on the Advanced button
Click on the TCP/IP Tab
Copy or write down the IPv4 Address:
Then
Go to to PHPAdmin
Select the database tab
Select your database
clicked on the options table
under option_name Change both values (siteurl and home ) in column option_value to the IPv4 Address you copied from System preferences
Opened MAMP Pro
entered the same IPv4 Address in the Host IP Address Field
Restart server
Helped me
I'm not sure if I understood correctly, but you can use the app Fing - network tools on your phone to scan the network and get all IP addresses on it, your computer should be one of them (on regular protection networks).
What I think what happened is that that URL is not resolved correctly on other devices, you are probably giving them your external ip, try to use the app I mentioned, find your computer and attempt to connect to the IP address you find in that app. That IP will be your internal ip address, which is what you need.

Virtualmin deployment warning on Digital Ocean

I seem to be getting this error on Digital Ocean:
"Your system's primary IP address appears to have changed from xxx.xx.xx.xxx to xx.xx.x.x. Virtual servers using the old address may be unreachable or serve the wrong web content."
This is on a fresh install of virtualmin on digital ocean.
Do you know how to resolve this?
Turns out that the best way to solve this was by making sure the hostname was correct. And a reboot was done on the webmin module once everything was set up.
Deploying a custom image on a new droplet, Virtualmin/Webmin on the image notices a new IP address assigned to the droplet. When this happens, on the first login to Virtualmin/Webmin shows above error message on the page -
To fix this error you should change the IP address of your server. Below are the steps on how to change the IP address in Webmin:
How to change the IP address in Webmin
Step 1. We logged into Webmin clicked on Networking menu on the left panel.
Step 2. Here we just click on Network Configuration.
Step 3. Then select Network Interfaces for setting up new IP address configuration.
Step 4. Here we click on enp0s3 network interface for new IP address configuration.
(it can be named in many ways, including eth0, enp0s1, ig0 and so on, and your system may have more than one adapter)
Step 5. Now, here we have five changes for new IP address configuration.
-> Select Yes to enable the Network Interface and activated on boot.
-> Select Static Configuration option in the IPV4 address section.
-> After selecting the static configuration, we enter the static IP address on IPV4 Address field.
-> Then enter Subnet Mask on Netmask field (eg: 255.255.255.0).
-> Finally enter the Broadcast address (eg: 192.168.1.255). Most probably Broadcast address is taken by the system automatically.
After all, save the settings.
Step 6. Then, go to Routing and Gateways, select the previously configured interface name from the dropdown and enter the correct Gateway IP address in the field.
Step 7. Click Save and go back to the main screen.
Step 8. Click on Apply Configuration button.
We verified the IP Address of the system just by running the below command.
Linux command: ifconfig
If you face any issue to login into your Webmin due to IP change, please follow the below steps to fix that error
Step 1. Check the log file /var/log/webmin/miniserv.log to identify the problem.
Step 2. If the new IP address is not configured in /etc/webmin/miniserv.conf file then we need to add it.
Step 3. Log into Webmin and go to Addresses and Networking -> Change IP Addresses, and there we can change references to the old IP address to the new one.
Step 4. Finally rebooted the server.
That’s it, now the problem fixed.

Resources