Host command providing wrong twitter IP address - ip

I'm building a clone of the host command. I've tried finding the host of twitter.com and have received the same IP-Address both on my version and the real host command. The address is: 104.244.42.65.
For some reason, when I input this IP-Address into the browser, it says that there's no webpage with that IP address. Why is this happening?

The host command uses ICMP to detect if the DNS name of the host can be resolved and host is reachable. And you can resolve and reach the IP that resolved for twitter.com.
However, the web server of Twitter is probably configured to answer only if asked by DNS name and when your browser sends a HTTP GET request with the IP, the server does not respond.
Twitter gets tons of requests per minute. The surely use load-balancers that redirect "twitter.com" to multiple IP addresses and they don't want people to use particular IP addresses, which would mess up their load balancers.

Related

What's the different use IP directly and config the local host?

I try to use IP directly access a URL by HTTP protocol, there are two methods here:
Use the URL which the domain replace with its IP
Config the IP and domain pair in local host of system
When the http request arrived the server, from the point of the server view, what's the different between the both request?
There would be no difference to the server. It is up to the client to resolve domain names to their IP addresses and there are a few ways to do that. One is to use a DNS server, another is to use the hosts file.
To add on, the domain is most certainly sent in the HTTP request. The browser (or other HTTP client) is responsible for that. If you use the IP, then no domain will arrive at the server, meaning it will serve up whatever is configured as the default content for the IP. The domain info is what allows the server to server multiple domains on a single IP.
Consider a Client connects to a Server.
First thing your computer does, is to analize the address you input.
If you wrote an IP, nothing to do now. If you wrote a domain, it will 'resolve' domain.
Resolving domain (DNS) means to 'translate' your URL into an IP. When computer resolves the domain, it will only use the new IP it got.
Client is sending packages with meta-data, that includes where this package is from (client's ip), where it may reach (server's ip), destin port etc.
Domain is not included on network packages.
Only IPs are included.
That means the server could never know if user connected to it using a domain or its ip directly.

How to determine the IP of the server to which a client is connecting to? Is it possible?

I am now just starting to understand Httpcontexts and server side logic. Total beginner.
I have understood how to read the http requests from a client and get the remote IP etc.
I came across the hostname property.
I believe hostname and domain are completely different.
My undersanding is that stackoverflow is the domain name.
Given its widespread reach, stackoverflow can have multiple servers and hence multiple ip addresses.
So is there a way to determine to which server a client is requesting to in asp.net core 2.0?
You are correct that stackoverflow.com is a domain name. A domain name points to an IP address. That's called DNS. stackoverflow.com points to one single IP address not multiple. There's probably a load balancer at that IP address which then points you to an available server, which is internal you can't see that, but that's another story.
If you ping stackoverflow.com you get:
The whole point of DNS is to not use IP address but a domain name.
I'm not sure why you would want to see the IP. Maybe this stackoverflow question can help: Resolve HostName to IP

Connect to a domain without internet

I have a computer connected to my workplace AD domain where through this connection it has access to the internet and also can connect to a server located on that domain e.g 150.130.xxx.xxx. I wonder how I can keep the connection to the server whilst disabling internet connection so that this computer can connect to the server but not the internet. Any advice?
I found a way by changing the IP settings from "obtain an IP address automatically" to "use the following IP address" and giving it the actual IP address of my machine, then leaving the default gateway and preferred DNS server empty.
Another solution is to simply do route -f in cmd after you've connected to the network. This will prevent internet traffic from being sent to your router. This might be a little simpler than what youre doing - it essentially does the same thing, but all in one convienent little command.

Ip address DNS and Domains

I'm a little confused about IP addresses.
I know that every web domain has an ip address.
Does the IP address represent the physical machine / host the website files are stored on?
Therefore when DNS lookup is performed, the domain's IP address is returned to the client. The client then uses this ip to contact the server that the web files reside on.
Is my understanding correct?
Many thanks
You are correct.
It is kind of like how some companies may say Dial PIZZAHUT instead of saying, Dial 74992488. PIZZAHUT is easier to remember, but you actually are dialling the number.
You're talking about HTTP protocol. Yes, FQDN (web domain) is resolved to IP address by DNS server. Client will connect to server IP address. Since you're probably using HTTP 1.1, HTTP request will contain also FQDN. This information is used by web server to perform several checks, like SSL certificate validation or Virtualhost management (several domains on a single IP address).

Access website over local network from other devices?

I have a website that I'm running locally at localhost:8000. I'd like to access my site from other devices on my network. I've tried to visit the site via my computer's internal IP address via: 127.0.0.1:8000but this doesn't work. Is this possible?
Three most probable things:
Check if there is a network route between the client and the server machine (commands like PING and TRACERT will help);
Check if the server machine has a firewall. If it does, there must be a rule allowing (opening) connections through that port (8000) in TCP;
Most likely, the problem is one of the two above. If not, there's one last thing:
Make sure the web server (the one that serves localhost:8000) is bound to listen to all IP addresses (not only 127.0.0.1).
To know that, search for servername bind all ip addresses on google. E.g., for apache HTTPD, it'd be apache bind all ip addresses.
here is what I do in similar cases:
search rejetto hfs on google, it is single executable less than 1Mb size and download it into your server machine.
after starting it, follow menu->IP addresses. these are all your possible addresess on the server side.
these are your IP addresses to enter, and your port is 8000 as you mentioned.
most possible IP addresses you will find are in the format of following:
192.168.?.?
10.0.0.?
169.254.?.?
besided you will probably need to add a firewall rule for your server app.

Resources