Subdomain points to public IP, when used internal it doesn't load, only externally, what can be done? - networking

We created a subdomain for a website hosted in our internal server. In GoDaddy we set up the subdomain to point to the public IP address, but when we try to access the link internally it doesn't load (because it needs the internal IP to access it) What can be done in this case?

You obviously need to provide different information to internal DNS clients than those publicly available to the world. For that you need to have internal DNS server or DNS proxy that will respond with internal IP address, and your internal clients need to be configured to use that internal DNS server. Specific steps to achieve all this depend on your environment.
The other option is to create another DNS record (for example subdomain-internal.example.com) that will point to private IP address, and use that from internal network (of course, you might need to configure your webserver to respond to that hostname also)

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.

Google router IP vs Google public IP

I am trying to get the big picture although my primary domain is not networking.
Some question's narrowed down for which I'm not getting enough/proper answers online
Is the IP that is resolved by the DNS server when I hit www.google.com is same as any of the Google router's Gateway IP?
Do bigger companies like Amazon do port forwarding?
If point 2 is true, I suppose they must be port forwarding with only 443 (https) port which means, to use multiple static IP across different data centers, they need to have that many routers. So, if they have N static IP address which resolves to a website, then they must be having N routers right? Is this a fair assumption?
A gateway IP refers to a device on a network which sends local
network traffic to other networks. it sits between you and internet,or other network . its like a watchman.
Question 1 : google.com has multiple ip addresses lets say then , Yes, that is possible, and will need to be two A records. This is called Round-Robin DNS. Clients will semi-randomly use one of the two addresses.
question2: yes port forwarding happens more often than we think. ALL VPC's (virtual private clouds like AWS , GCP , Azure etc) use this as they dont want to expose servers/internal resources to the internet.
depending on the port number , particular service is exposed to requesting client. lets say we want to make a website public , then we explicitly expose port 80(http) 443(https) so that web crawlers and users can see them.
Port forwarding, sometimes called port mapping, allows computers or
services in private networks to connect over the internet with other
public or private computers or services.
google https://www.google.com:444/ wont work because they did not expose port 444 on their cloud router
but https://www.google.com:443/ will work because the server corresponding to google.com has explicitly left it open.
How IP is resolved:
Step 1 - Send a Request to Resolve a Domain Name
When you type www.google.com into a browser, in order to load the webpage, your computer asks for the IP address. Computers do not know in advance where they can find the necessary information, so they try searching through the DNS cache and for available external source. proceed from lower level caches to root/main servers.
Step 2+3 - Try to resolve an IP Locally
Before going externally, your computer loads the local DNS cache database to see if you already requested the IP for that domain name. Every computer has a temporary cache with the most recent DNS requests and attempts to connect to online sources. if required record is present locally its called "CACHE HIT" and query stops.
However A computer’s local DNS cache database does not always contain the necessary data to resolve a domain name this is called a "CACHE MISS" . In that case, the request goes further to your Internet Service Provider (ISP) and its DNS server.
Step 4 - ISPs Ask Outside DNS Servers to Provide an IP Address iff Cache miss
ISP DNS resolvers are configured to ask other DNS servers for correct IP address mapping until they can provide data back to the requester. These are iterative DNS queries.
When a DNS client sends such a request, the first responding server does not provide the needed IP address. Instead, it directs the request to another server that is lower in the DNS hierarchy, and that one to another until the IP address is fully resolved. There are a few stops in this process.
hierarchy looks like this (just for reference):
Root domain nameservers. Root servers themselves do not map IP addresses to domain names. Instead, they hold the information about all top-level domain (TLD) nameservers and point to their location. TLD is the rightmost section of a domain name... Root servers are critical since they are the first stop for all DNS lookup requests.
TLD nameservers. These servers contain the data for second-level domains, such as ‘phoenixnap’ in phoenixnap.com. Previously, the root server pointed to the location of the TLD server. Then, the TLD server needs to direct the request toward the server that contains the necessary data for the website we are trying to reach.
Authoritative nameserver. Authoritative servers are the final destination for DNS lookup requests. They provide the website’s IP address back to the recursive DNS servers. If the site has subdomains, the local DNS server will keep sending requests to the authoritative server until it finally resolves the IP address.
Step 5 - Receive the IP Address
Once the ISP’s recursive DNS server obtains the IP address by sending multiple iterative DNS queries, it finally returns it to your computer. The record for this request now stays cached on the hard drive. The browser can then fetch this IP from the cache and connect it to the website’s server.
ALL this happens in less than 1 second, most of the times. if you just registered a new domain it might take few hours to propagate this DNS cache globally hence newly registered websites do not show up sometimes.
About companies owning multiple IPs
Big companies have pool of IPs reserved for example 123.234.xxx.xxx which means a company has reserved 255*255 ips. they are mapped on a VPC(virtual private cloud)
and accessible vis a subnet masking and CIDR feature, like your EC2 instances on AWS
Is the IP that is resolved by the DNS server when I hit www.google.com is same as any of the Google router's Gateway IP?
For sure it should, but it is mostly a Google management question that only they will be able to answer right. The thing is that we must understand how DNS query's work for this.
Let's take a look of it:
Device A requests the IP address through a DNS query of the device B.
To do this, it uses the network port 53 (Domain) on which it will ask, depending on which DNS server is being used at the time, which is usually the home router. Then the router will ask the ISP's DNS server, which will respond with a cached response, or the query with another server on top of it if it does not have one; All this process is followed until a reliable cache response is reached or until the authoritative response server is reached, that is, the name server that manages the domain in question.
Only the authoritative response server contains the reliable information of which IP of the domain which is going to be reached.
I suppose that within Google's servers and its network they use Google's own DNS servers, which are 8.8.8.8 and 8.8.4.4 where the DNS records are obtained and consulted by caching from many sites.
In general terms Google's IP will change depending on where you are, I made a DIG query to Google's authoritative servers, however, I received a result based on location to improve the route and loading time of the site which was 142.250.73.238.
Do bigger companies like Amazon do port forwarding?
Yes, they do. To handle queries with load balancers or similar and even for caching dns requests.
If point 2 is true, I suppose they must be port forwarding with only 443 (https) port which means, to use multiple static IP across different data centers, they need to have that many routers. So, if they have N static IP address which resolves to a website, then they must be having N routers right? Is this a fair assumption?
This has multiple answers. By the way, they actually can do a secure DNS query.
if they have N static IP address which resolves to a website, then they must be having N routers right?
They don't have to, but if they want to they can.
"Is this a fair assumption?"
No, the IP's doesn't depend on a router, the router only routes to a computer/server which can have multiple IP's. By the other hand, each thing (computer, server, etc... must have an IP which can be also a WAN IP).

DNS architecture configuration in a splitted network

I'm currently configuring DNS in my network with Bind9.
This network is splitted in VLANs and it should have 2 DNS zones : an internal zone (internal servers, users VLAN...) and an external zone (DMZ).
Of course the DNS mustn't give internal records to an external request.
I have just configured my DNS master (storing external and internal records) in "internal servers" VLAN and I'm asking myself how to deal with this problem :
-> My DNS master will not reply to an external request since it is in the internal zone (though 802.11Q is enabled), even with external records. Is it right?
-> My DNS mustn't be in the DMZ.
-> If I configure a slave on the DMZ to manage the external zone, who will just store external records, then I have to configure another slave to replicate the master (so 3 servers...).
Initially I just planned to configure 2 servers, a master and a slave which would just be a full replicate.
Am I missing something? Is there any better solution?
The architecture that you will follow depends on what you want to serve and where (internal clients, external both)?
In general, yes you need internal DNS servers these will have at least all the necessary entries for you internal network.
As for the servers in DMZ who will have access to them and from which path? If you need access to them from the internal network directly through firewall, it makes sense to have entries for them also in your internal dns servers.
If you serve also from servers in DMZ to external users you have two solutions either you declare them in public DNS if the external users are from internet or you should have another DNS server on your DMZ.
The key point here is to think who will visit your server and from which path, then it will become kind of obvious how you will configure DNS for them.

How Hide private dedicated server at home

I installed a dedicated server at home which works fine. I host several services like mysql, apache, websocket, etc... The problem: people who go to my website will know my personal ip address. I hidded my ip under a type A DNS but there is no problem for people to get my real ip.
So how can i fully hide my ip address. Are there some services that provide this? Proxy? Vpn?
This is a tricky question. You cannot truly hide the public-facing IP address of a server if you intend it to be accessed by the public, because they need the IP to route to you.
If you use a public proxy, that proxy will have to know your real IP.
If you use a private proxy, then anyone who wants to visit your site will need to know the IP address of the proxy server, which is probably also owned by you.
If you expose all the services only on the internal network, then you can VPN into your home network to get your services, but then nobody else be able to use your services. Also, the VPN server's IP address will need to be public to anyone you want to give access to.

How can we set up a domain name in our own dns server?

I want to host my website from my home using a server and I also want to know if I can register my own domain name using my DNS server! If yes it would be really helpful on how to do so!
Thank you very much!
Setting up a home web server is simple. If you do it though, check and make sure that your ISP allows you to do so. Here is my recommendation to begin:
Register your domain name with godaddy.com, register.com or whomever you choose (ie.www.xyz.com)
Determine whether you will have a public dynamic IP address (will change constantly) or a static ip address (usually have to pay for this from your ISP)
DNS Setup
a. If you are using a public dynamic IP address (which I am sure you are in this case), then set up a dynamic dns free account (go here - http://www.dyndns.com/services/dns/dyndns/). You will need to set up a username and password, which you will later use on the DynDNS Updater you will need to install on your Windows web server. Create the zone for your domain (ie. xyz.com is a zone you create).
b. If you are using a static IP address, then make sure the name servers are 'Parked' with your domain provider, then set up a forward to the public static IP address of your home network (from here, you just set up port forwarding in your router/gateway to your web server and you should be done)
Web Server Configuration
I. set up a 'static' ip address on your network card which will manage the incoming connections. Make sure that IIS is listening for requests through this IP address via IIS Manager.
II. If you are going to use the dynamic dns configuration for DNS, then download the DynDNS Updater app to your windows server and it will manage the connection between your web server dns and dynamic dns servers (this is cool and easy)
III. Set up a test index.html in IIS Manager for your 'Default Site'. Open a web browser and open 'http://localhost' to make sure you can access the site.
IV. Make sure your Windows firewall allows traffic through port 80.
Router / Gateway Configuration - go to 'Port Forwarding', and forward all requests via port '80' to the static ip address of your webserver (ie. Allow Incoming Port '80' to 192.168.x.x')
From your web server, Go to 'http://www.whatismyip.com and see what your public ip address is.
Once your IIS is set up, your port forwarding has been configured, and dynamic dns is updated, ping the domain you registered 'ie. www.xyz.com' and see if it matches the IP address of your web server public ip.
From outside your local area network, try to access your domain 'http://www.xyz.com'. If success, then you are good to go. If no success, review all these steps again.

Resources