At what layer in the protocol stack does DNS happen? [closed] - http

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
The community reviewed whether to reopen this question last month and left it closed:
Original close reason(s) were not resolved
Improve this question
Let's use a browser as an example. HTTP requests do not need to contain any IP addresses. So would www.example.com be translated into an IP address at the TPC layer?
EDIT
Seems like DNS is used to tell TCP which IP address to connect to. So does HTTP call DNS?
With this stack:
HTTP
DNS
TCP

DNS is a protocol that arguably sits at the application-level, but is a separate application in and of itself that makes use of the whole TCP/IP "stack". (LDAP is similar, if that helps "place" DNS.) It's a fundamental "phone book"-like directory for the Internet and has absolutely nothing specific to do with the HTTP protocol. DNS uses UDP and TCP transport to query other distributed DNS servers to answer client questions like "what IP addresses are associated with the name www.google.com?". Once a client application, like a web browser, has an IP address with which to connect, DNS is then out of the picture. The browser opens up a TCP connection to the IP address and then initiates the HTTP protocol over that TCP transport session to talk web stuff.

In OSI stack terms, DNS runs in parallel to HTTP in the Application Layer (layer 7).
DNS is in effect an application that is invoked to help out the HTTP application, and therefore does not sit "below" HTTP in the OSI stack.
DNS itself also makes use of UDP and more rarely TCP, both of which in turn use IP.

Application Layer - #7 of OSI
http://en.wikipedia.org/wiki/List_of_network_protocols_(OSI_model)
In response to your latest edit:
Doesn't DNS use UDP to send a response indicating any details of the requested IP (unless a certain size threshold is crossed 512bytes).

Well technically the client computer is the first to be "asked" which IP address should link to which domain name.
Which involves the term DNS resolver. Essentially it searches through previous queries which are cached on a clients computer and if it finds a match then it returns what would essentially be a normal DNS lookup (without leaving your local network to find an answer/address). You can actually edit this file on your own computer and the URL of your web browsers will actually show your changes.

I'd advise you to download and install wireshark. Run wireshark and visit some websites. You can see how DNS works. DNS (as already mentioned) is handled at the application layer. Almost all high level languages have libraries for the function 'gethostbyname'.
Python 3.3.3 (default, Nov 26 2013, 13:33:18)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.gethostbyname("stackoverflow.com")
'198.252.206.16'
Take a browser for example, after acquiring the host from the DNS server using some form of gethostbyname, a standard TCP socket connection is established and the browser/webserver communicate over HTTP.

Regarding the OSI it is the Application layer - layer 7

Related

Why is port forwarding not working in my network? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I'm trying to enable port forwarding in my router (ZTE F660) but for some reason it is not working at all. First I started my server application in my ubuntu machine and I fixed its ip address to 192.168.1.2. Then, I set the rules as following:
It did not work. So, I've tried to disabled the firewall on my router settings:
It did not work as well, then I've disabled the firewall of my host machine by typing:
sudo ufw disable
And it did not work. Then, I tried to use many different ports and it did not work! :(
I've tried to use some port forwarding testers (like this one: https://hidemy.name/en/port-scanner/) and it always says that the state of the port is "filtered". I called the provider of my internet and they said that the port forwarding should be running but they did not offer technical help. Can anyone help me with this? Can't think about anything else to do.
Your ISP is using CGN (Carrier-Grade NAT) because your WAN address is in the Shared address space (100.64.0.0/10). That is not public address space, and it is defined by RFC 6598, IANA-Reserved IPv4 Prefix for Shared Address Space:
Abstract
This document requests the allocation of an IPv4 /10 address block to
be used as Shared Address Space to accommodate the needs of Carrier-
Grade NAT (CGN) devices. It is anticipated that Service Providers will
use this Shared Address Space to number the interfaces that connect
CGN devices to Customer Premises Equipment (CPE).
Shared Address Space is distinct from RFC 1918 private address space
because it is intended for use on Service Provider networks. However,
it may be used in a manner similar to RFC 1918 private address space
on routing equipment that is able to do address translation across
router interfaces when the addresses are identical on two different
interfaces. Details are provided in the text of this document.
This document details the allocation of an additional special-use IPv4
address block and updates RFC 5735.
The address block is detailed in Section 7:
7. IANA
Considerations
IANA has recorded the allocation of an IPv4 /10 for use as Shared
Address Space.
The Shared Address Space address range is 100.64.0.0/10.
That address space is also found in the IANA IPv4 Special-Purpose Address Registry.
What that means is that you have a home/residential ISP agreement. The ISPs are using CGN to save their precious public addresses for businesses willing to pay for them. The ISP NAT would also need to be configured to forward the port to your WAN addressing the Shared space, but the ISP cannot do that because others behind the CGN may also want that port forwarded to them.
The ISP does not really care that this breaks what you want to do because your residential ISP contract contains a clause forbidding you from running services from your network to the public Internet. You will need a public address and ISP permission to do what you want, and that probably means a business contract. The proliferation of CGN is a big driver for hosting companies, and that is an alternative way to do it.

NAT traversal when one peer has static IP [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
If I have a server that is allocated a static IP, and that server sits behind a NAT controlled router will my server always be able to send a response directly back to the IP & Port of the sending client?
My server may be a game server or some other type of UDP based service, but it will always be inside a NAT controlled network, and reciving UDP packets from externally connected clients.
if server responds to that IP and port client will always receive response back ?
Yes - the router(s) in charge of the NAT will maintain state such that returned traffic is translated back to the correct, original client. This is true of any layer 3 traffic (protocol and port doesn't matter).
Consider the following:
Client IP Client public IP Server public IP
192.168.10.151 <-router-> 86.45.75.12 <-internet-> 125.12.67.35
Corresponding traffic flow:
1) Client request traffic:
---------------------------------------------------> arrives with source of 86.45.75.12
2) Server response traffic sent back to 86.45.75.12:
<--------------------------
3) Translated back to 192.168.10.151:
<-----------------------------------
The server will see traffic with a source of 86.45.75.12, and will send response traffic back to that IP. The router handling the NATing for the client will maintain state such that it knows response traffic coming from 125.12.67.35, going back to 86.45.75.12, will be correctly translated and routed to the original source, 192.168.10.151.

setting up a server for local small office [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 6 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I am very new in networking and setting up server. I have only used XAMPP to develop my site locally on my desktop computer. I did some researches and learn about all those network equipment online, but I found myself still confused about what I need to do to set up a server between computers. So I hope I can find the answers from experts. I have 4 computers in my office, and I am trying to create a local network that allows all 4 computers to access the files and localhost in the desktop computer.
1.) I have a modem and a router. My desktop computer and the other 2 computers are using wireless while my sister's computer is using cable that connects to the modem. In order for my sister and the other computers to access my files and localhost, do I need to plug all of the computers into a switch?
2.) I have read online that people set up port forwarding to allow others to access their website online. But right now I am just trying to make a local files and web server, do I need to set up port forwarding as well?
I am using Windows Vista and XAMPP. I couldn't solve any of the questions and confusion after 1 week of looking through online. So if anyone has a detailed guide for setting local file/web server, that will help me so much and thank you for your time as well.
1) You do not need a switch for setting up a server. An switch is just a device that basicly expands the amount cabled network connections you have. Most routers come often with 4 LAN ports and one WAN(probably conencted to your modem).
If you have lets say, 5 computers that needs a cabled connection. You will need a switch to be able to connect all those computers at the same time.
2) You only need to do port forwarding if you want others to connect from outside your local network. If you want to put a website up on a server, you will need to port forward port 80 (the port for http) to your servers local IP.
All port forwaring does is to say to your router that if it gets a packet of data with this port number to your public IP, then send it to this spesific local IP adress (your server with XAMPP). If you don't port forward, the router doesent know what local ip adress to send the packet of data to, then it just discards it, which means others cant access your website.
If you want to open your website from outside your local network, and have port forwarded your router. You probably want to setup a domain with DDNS (dynamic domain name system).
What that does is that people can write something like "www.google.com" instead of your public ip adress. A good site for that is: http://www.no-ip.com . Keep in mind that if you don't want to add a domain and just use the ip adress, your routers public IP address may change over time. Unless you have ordered a static IP address from your ISP (Internet service provider).
For your file server i would suggest a FileZilla FTP Server (FTP = File Transport Protocoll). Set this up on your server machine and follow this tutorial: https://www.youtube.com/watch?v=251TQq98zmo . Then after you have set up and configured your FTP server, you can connect your clients to the server.
I would suggest this guide to connect your other machines to the FTP server:
http://www.wintuts.com/Map-Network-Drive
Keep in mind if you want to access your FTP server from outside your network you will need to port forward both port 20 and 21. For security reasons i will strongly suggesting a password on your FTP server, unless you want anyone to connect to it.
Hope this helped!
-Kad
(PS: just comment on this post if something is unclear, or have further questions! :D )

Providing DHCP server's MAC to DHCP clients [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
Background info:
I have a set of proprietary embedded-linux network devices, one of which will be configured as a DHCP server and the rest will be DHCP clients.
I need to have the client-devices only accept DHCP lease offers from the server-device, ignoring any other leases offered by other DHCP servers on the same LAN. Similarly, I need to make the server-device only serve DHCP requests to this set of clients, ignoring any other DHCP requests which may appear in an unknown network environment. Essentially, I need to be able to provide a DHCP service for my own devices in a network environment which may already have a DHCP server.
All of my devices have the same first half of the MAC address which I intend to use as a filter.
I am using udhcpc and udhcpd which are included in BusyBox and am trying to avoid adding any other DHCP client/server packages to my devices due to limited storage availability, but I am open to modifying BusyBox code.
I had no trouble implementing the DHCP server restrictions by adding an option to udhcpd.conf, which I called chaddr_filter, containing a wildcarded MAC address the server should check the "Client Hardware Address (chaddr)" against. This seems to be working just fine and the server ignores any DHCP requests from other devices while serving my own.
The client-side filtering turns out to be a bigger challenge, due to a lack of a "Server Hardware Address" field in a DHCP packet.
So here's my question:
What's the best way to pass my server's MAC to my udhcpc client?
Currently it looks like there are no fields or options being passed from the DHCP server that contain the server's MAC (doesn't look like I can read it from Ethernet layer). I'd like to remain standards-compliant, so I'm looking through potential DHCP Options which I may use for this purpose.
I was hoping I could use "Option 54: Server identifier", but the RFC defines it as an IP address.
I'm thinking of putting the server's MAC in either "Option 60: Class-identifier" or "Option 43: Vendor specific information", is there a reason I shouldn't do this? Is there a better field for this?
I look forward to any suggestions.
Taken from wikipedia
DHCP uses the same two ports assigned by IANA for BOOTP: destination
UDP port 67 for sending data to the server, and UDP port 68 for data
to the client. DHCP communications are connectionless in nature.
Thus, you could filter on clients the incoming packets on port 68/udp accepting only those coming from a mac address whose first half is good.
FYI I was able to achieve the desired effect by using brctl and ebtables utilities to filter packets of interest on the clients.

How an application or website finds your ip? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
I think there are only two ways a application or a server could get your IP.
If it is an application, java/flash, I think it could check your network settings locally and send your IP back to the server. Then the server would know.
The other way it could find is that it could analyze the packet headers. Then find there your IP information.
But if I wanted it to stop doing it.
If it was analyzing locally my IP information I could stop that packet or change its information so the website would be confused about the IP information.
If it was analyzing the packet headers and if knew what packets it was analyzing because it wont analyze every packet, I could stop sending those packets.
Example:
Websites that checks your IP, how does it do it? If you are not downloading any application, you would exclude the 1. scenarion. Then the only possibility is that it was analyzing packet headers but what kind of packets?
It was not one question only but if anyone knows something about it, I would like to know too. :)
Thanks
You can't prevent a website to know your IP. If you do prevent it, it would be unable to answer your request. If you are really interested in anonymity have a look at proxy servers, especially at high anonymity proxies.
As soon as you establish a connection to a remote host, your IP address is revealed. You can not simply say, "I'd like to connect, and by the way, my IP address is 123.123.123.123".
The webserver will tell what ever script it executes, from which IP address the connection was established (and request made).
Your IP address is in every TCP segment. The remote web-server (to which your web browser makes the connection) will make this information available to the hosted site.
To send a different IP address, you have a couple of options. You could use a proxy server and have its IP address transmitted. Alternatively, you could use IP Spoofing, if you don't want to receive any information back!
You can't prevent a website from knowing the IP, that sent the request. At best you can route it through a proxy, so the website resolves the IP of the proxy server.
You should read up on TCP/IP. In short, TCP/IP packet contains the originating IP address, because it must conform to the IP protocol and send a valid IP header.

Resources