How to know the IIS server ip for my website access - asp.net

I have deployed a website in my server, how i know which what my server IP is ?
if i know my server ip , i could access my website from outside

If you know your hostname you can use nslookup to get the ip adress. Alternatively you can find all the ip adresses on the network cards using ipconfig. So either:
nslookup hostname
Or
ipconfig /all
You could also use netstat -n to find the ip adress listening on port 80 (which is the default for http)

First, check with the IIS Console. Right click web site + properties. The tab named "Web Site" shows the "IP Address". This btw could be "All unassigned", so you'd have to do an ipconfig on the server, and deduct IPs explicitly used by other web sites.
Second, beware that this address could be mapped to some other [public] address at the level of a firewall / gateway / WSD device on between the server and the client.
Third (or first), using "ping" or "nslookup" as indicated in other replies, ensure that the name that will be used as part of the url matches the IP discovered above.

Simple way is to ping your hostname. E.g.,
ping microsoft.com
Note you'll need to do this from outside your server's netork, as you may get an internal private IP otherwise.

The IP of the server is the same IP as the host (machine) where it is located, if the server is in your LAN.
You will be able to access your website from outside if your proxys allows it.
I don't really understand what you are talking about saying "my server".

try ping servername and/or ping url

Do it in the code..
Request.ServerVariables("LOCAL_ADDR")
OR
String name = "";
name = Dns.GetHostName();
IPHostEntry ipEntry = Dns.GetHostByName(name);
foreach (IPAddress ipaddress in ipEntry.AddressList)
{
Response.Write("IP : " + ipaddress.ToString());
}

Related

Access server in local network through domain

i have problem with access to server with domains.
Test url: testpage.example.com.
Server is in local network with port fowarding (80, 443), configured as web server using caddy server as reverse proxy.
Case 1 (using Asus router):
Connected on local network behind router. Server is in the same network as my computer. Everything works like a charm in and out of my network.
Case 2 (using internet provider router):
Connected on local network behind router. Can't access server with domain. Works with direct IP. Outside network, works as in case 1.
I used same server.
Does anyone know why this problem occured? How can i solve it?
Thanks,
David
Two options I can think of:
You could add a record to whatever DNS server you're using in Case 2.
You could write a short script that runs whenever you change network connections to modify your hosts file accordingly.
This happens when the server you are trying to reach "testpage.example.com" resolves to your router's external IP address. Because your public IP address is the same as server's IP address (even though inside your home network you have different private IP addresses) your requests are lost in the ether.
As a workaround you can resolve the testpage.example.com manually on your local machine.
For Windows c:\windows\system32\etc\hosts
For Linux /etc/hosts
testpage.example.com 192.168.1.102 -> private IP of the machine serving the site.

Local DNS override works randomly with Bind

I have a Bind DNS server on my local network to get *.home resolution, and a forwarders section for every other domains. I also have a local web server which serve some subdomains of *.mydomain.com from the outside, with my ISP box redirecting ports 80/443 to it.
But from any computer within my local network, if I try to access any of the *.mydomain.com address, the IP address returned is my public IP address and the ISP box doesn't redirect the request to my server. I used a workaround by adding the subdomains *.mydomain.com with the local IP address of the server in /etc/hosts on each local computer but it's not perfect since I have to change it if I move a computer to another network, plus I can't do this on my non-rooted Android devices.
The perfect solution would be to have my local DNS overrinding the DNS entries for *.mydomain.com with the local IP instead of the public one. I tried some Bind9 configurations for this, some using the "response-policy" directive, some without it, but in every case, I get the external IP ~50% of the time and I can't figure out why. This happens on every computer I use (some are on Ubuntu, some with Windows), also on my Android phones.
Using dig #mydns subdomain.mydomain.com return the local IP so I assume that the Bind configuration is OK, but dig subdomain.mydomain.com (or ping) doesn't always return the proper IP. I also tried to disable forwarders for the subdomain like this :
zone "mydomain.com" {
type master;
file "/etc/bind/db.mydomain";
forwarders {};
};
I flushed the DNS cache of my computers and there is no other DNS server on my network so I don't understand how this can happen. I also tried to log requests on the Bind server and I don't see requests with the external IP address returned (only those with the internal). So where did these requests go through ?
I finally found out what the problem was : my custom DHCP/DNS server was configured for IPv4 only, but my ISP box also provide IPv6 capabilities, so all the DNS requests from the devices on the network where sent on both protocols and half of the time, the request was answered by the ISP box instead of my custom DNS.
I disabled IPv6 for now and the problem is gone. I'll configure it for my custom server later.

access local server from other networks

I created a localhost server using servlets.
I want to know how to access from other networks(other ip addresses).
what to do for that?
any answers will be helpful for me
you should use public ip address,instead of local ip address to access over the networks.
You can access it by giving IP address of your machine in your application url in place of localhost while accessing it from another machine in the same network.
you can use your ip address instead of localhost.and also need to configure firewall.The firewall can be configured by: choosing the Windows Firewall from the Control Panel, then click on Exceptions -> Add Port and enter name and number: your server, port and leave transport protocol as TCP.
e.g,
http://10.4.0.198:8080/project

Cannot access machine via DNS in the private network

I have a machine in my private network with IP 192.168.1.10
I have a DNS name, "toto.mydns.com", a DNS client is running on the machine.
I configured the router for Port forwarding.
I can access the machine when i am outside my home, when using a pulic IP address it works but when i am at home and i get a dynamic IP address trough DHCP from my router, i cannot use toto.mydns.com anymore, i must use 192.168.1.10 to access.
I would like to know if i need to configure something on the router for that ?
Thank you !
toto.mydns.com will resolve to your external public IP
There will almost certainly be nothing routing that IP through to your router, and thus through NAT to your internal address.
The easiest way to resolve this (Pun very much intended) is to have a hosts file entry on your computers running inside your network so that they resolve the same DNS address to the internal address.
A much harder, but more fun, way would be to set up your own DNS server inside your network, have the DHCP dish it out as the primary DNS server for your network and put in an entry for your internal address :D
Have fun...
Toto.mydns.com is accessible from outside,this DNS is assigned on a machine with a static IP address(sorry not dynamic),so the IP of this machine is 192.168.1.10.
Whrn i am at home in my private network i need to enter 192.168.1.10 and toto.mydns.com does not work.Any help???

how to call a website from cmd using a non registered domain name?

Usually When you ping a website (e.g Google.com) it replies with a specific IP
My question is: Is there anyway where you can call a website and replies with an IP you have set manually like 1.2.3.4
meaning if I ping google.com from my pc it will reply with 1.2.3.4
You can do this by adding the domain and IP to your host file. What OS are you running?
On Windows Server 2012 you will find the host file on %systemroot%\system32\drivers\etc
Add your domain and IP like this
64.49.219.194 www.domain.com
Try ping again.

Resources