Noticed there is an option in DHCP for static routes, looks like it is using a server name and an IP that you assign, is this the same thing as adding an entry into the host record like we used to do back in the day if we wanted windows to use a certain resource?
-
You're mixing multiple concepts. I would suggest you read up on how TCP/IP works. – vidarlo Jul 18 '23 at 18:33
1 Answers
These are two different things. Setting entries in the hosts file overrides name lookups (ie. DNS). Static routes refers to IP routing.
Here is a brief overview of the process that can hopefully help with your research:
A computer is plugged into the network and communicates with the DHCP server to get an IP address and a variety of other options, including subnet mask and default gateway. Lets assume your IP/subnet is 10.0.0.215/24
, and your router is 10.0.0.1
.
That computer then tries to go to https://google.com. A few things happen here (some steps are omitted for simplicity).
- Your computer reaches out to the DNS server and asks where to find google.com.
- The DNS server responds with one or more addresses. Lets use
142.250.138.139
as an example. - Your computer sees that
142.250.138.139
is not within the10.0.0.215/24
subnet, and sends that packet to your router instead (10.0.0.1). - Your router then reaches out on the WAN to continue routing the packet through your ISP's network until it reaches the destination.
The hosts file overrides steps 1 and 2. Static routes override step 3.
Now lets say you have two networks: 10.0.0.0/24
and 192.168.1.0/24
. Router A (10.0.0.1
) doesn't know about 192.168.1.0/24
, but another router on your network does. We'll call this router B, and it is connected to both networks on 10.0.0.200
and 192.168.1.200
. If you want your computer at 10.0.0.215
to access computer B at 192.168.1.10
, you need a static route. Your computer somehow needs to know that it should send traffic destined for 192.168.1.0/24
to 10.0.0.200
instead of 10.0.0.1
. This is what the static routes option (DHCP option 33) can accomplish.
-
Thanks for the explanation, that makes sense and helped me understand. I am trying to figure out how to create a static entry for a given name since we have two different IP addresses for that device (10.10.10.12 and 10.10.9.12), each are on different vlans and cant cross, wanting to filter the clients DNS so they only see the one IP on their subnet. This way I dont have to create a host record for them. – Davids Learnin Jul 20 '23 at 12:58