Difference between Network Address and Router Address

6

I've been reading about IP addressing and came up with the following conclusions-

  • A subnet mask divides an IP address into network address and host address.
  • A network address always ends with a series of 0's like (mostly for all subnets) such as 123.0.0.0, 123.45.0.0 and 123.45.67.0.

  • Routers act as intermediate stations to transfer data to the correct network.

    Now, I have the following questions-

  • What actually is network address ? Does it identify any real world host or Router? i.e. are addresses like 123.0.0.0, 123.45.0.0 or 123.45.67.0 actually assigned to any routers or hosts.
  • If they are assigned to routers then why is my local lan router identified as 192.168.0.1 which is not a network address (it doesn't have a trailing 0) and not as any other network address such as 192.168.0.0.

    EDIT

    Does it work this way,
    Suppose a request for 123.23.45.27 comes to a router, the router applies the subnet mask to it and suppose comes out with the network address as 123.23.0.0, so now it will check it's routing table for network address as 123.23.0.0 and refer to the corresponding router address entry that is capable of handle this request and that router further handles the requests.
    Are my following assumptions true-

  • A router finds the Network address from the IP address and checks its routing table.
  • The routing table contains entries in the form of Network Address vs Router address and then a matched router address is picked up for forwarding the request.
  • All request's for IP address in the range 123.23.0.1 to 123.23.255.255 will be mapped to network address 123.23.0.0 and will be sent to the same router for further routing.

    Kindly help.

Shivam Aggarwal

Posted 2016-04-13T15:30:01.413

Reputation: 189

[sf] duplicate: What is the network address (x.x.x.0) used for?

– DavidPostill – 2016-04-13T15:39:53.167

@DavidPostill Sorry to say but the question is much different. My main question is whether network address is actually assigned to any physical address or not. – Shivam Aggarwal – 2016-04-13T15:42:30.573

If you actually read the link you would see the answer is no, so it does answer both your questions. – DavidPostill – 2016-04-13T15:43:08.277

"are addresses like 123.0.0.0, 123.45.0.0 or 123.45.67.0 actually assigned to any routers or hosts." No. – DavidPostill – 2016-04-13T15:45:23.327

"If they are assigned to routers" they are not assigned to anything. – DavidPostill – 2016-04-13T15:45:51.840

"the first address in a subnet refers to the subnet itself and is used for routing purposes." x.x.x.0 is the first address in a subnet. – DavidPostill – 2016-04-13T15:46:56.017

Then what is the use of network address, why don't we directly give out router addresses ? – Shivam Aggarwal – 2016-04-13T15:47:43.537

Please read all of the answers in the link I already gave you. All your comments so far have been answered there. It says exactly what it is used for. – DavidPostill – 2016-04-13T15:51:56.977

I've added some edit's to my question. Please review. – Shivam Aggarwal – 2016-04-13T16:35:59.067

Much better duplicate target: How does IPv4 subnetting work?

– Dan Henderson – 2016-04-13T16:42:35.653

A network address always ends with a series of 0's. No, it does not. A network mask does, but there are way more masks than /8, /16 and /24. – Hennes – 2016-04-13T16:43:08.097

@DanHenderson I've already read that beautiful answer :D. Can you please tell me if my assumptions in the edit are correct ? – Shivam Aggarwal – 2016-04-13T16:44:19.240

Also, what is a router address, did you mean a gateway? (which may or may not be a router). – Hennes – 2016-04-13T16:44:21.580

@Hennes No, I meant that is a router assigned the network address or is given a separate addresss – Shivam Aggarwal – 2016-04-13T16:45:18.137

The router is not assigned the network address. Nothing is assigned to that. The router usualy gets its own IP inside the network address range. – Hennes – 2016-04-13T16:52:27.257

@Hennes Got it thanks. Yep I've already read that beautiful answer. Can you please review my edit and tell me it I'm correct. – Shivam Aggarwal – 2016-04-13T16:55:23.363

2@Shivamaggarwal Your first assumption is correct. Your second and third assumptions may not be quite phrased exactly right, but they lead me to believe that you (mostly) understand subnetting correctly, even if you're not necessarily explaining it well. (If you said those 3 sentences to someone who doesn't understand IPv4 subnetting, I think they could still misinterpret what you said and reach an incorrect conclusion.) – Dan Henderson – 2016-04-13T16:58:26.187

@DanHenderson Great, you understood it pretty well. I'd be really glad if you could please add, remove or modify any of my assumptions for a better understanding. Thanks :D. – Shivam Aggarwal – 2016-04-13T17:02:54.640

1

@Shivamaggarwal I could go into more detail, but it would have to be in an answer, it would take me all day, and in the end it would really just be a duplication of all the same information you can already find in http://serverfault.com/q/49765/305280. But I can quickly tell you that A network address always ends with a series of 0's is definitely incorrect. For example, you can have a 26-bit subnet mask, which for 192.168.1.200 will yield a network address of 192.168.1.192.

– Dan Henderson – 2016-04-13T18:45:21.520

Answers

5

A subnet mask divides an IP address into network address and host address.

Correct. Apply the mask and you can see which part belongs to the network, and the reminder is the host address.

e.g. mask 255.255.255.0 and 1.2.3.4 would yield

IP:   00000001.00000010.00000011.0000100  (1.2.3.4. in binary)
Mask: 11111111.11111111.11111111.0000000  (mask in binary)
      -----------------------------------
Net:  00000001.00000010.00000011.0        (1.2.3.0)

A network address always ends with a series of 0's like (mostly for all subnets) such as 123.0.0.0, 123.45.0.0 and 123.45.67.0.

It often does, but part of that is habitual. I could use a netmask of 255.255.255.128 (Binary 11111111.11111111.11111111.1000000) to get smaller subnets. And 10.20.30.128 would be a network address, with 10.20.30.129 the first possible IP on it, 10.20.30.130 the second possible etc etc.

And for 10.20.30.0 to 10.20.30.127 the broadcast IP would be 10.20.30.127.

Routers act as intermediate stations to transfer data to the correct network.

Correct. They look at their routing table. If know have a specific route then they apply it. If not they forward it to their standard place. This is where the default gateway comes in.

Now, I have the following questions- What actually is network address ? Does it identify any real world host or Router? i.e. are addresses like 123.0.0.0, 123.45.0.0 or 123.45.67.0 actually assigned to any routers or hosts.

No. Network address are usually not assigned. They could be but then things would break down in most cases because the network address used to be used as the broadcast address before this got changed to the highest address in the network. Different implementations of IP stack would make using the network adress fun.

You might get away with it in very specific circumstances. E.g. on a specifc OS and with specific routers. But once you start to mix things, upgrade drivers or send things outside of your control (e.g. onto the Internet) you are going to have job security while debugging...

If they are assigned to routers then why is my local lan router identified as 192.168.0.1 which is not a network address

That is merely a normal IP. 192.168.0.0/16 is usually used as a /24, with usuable IPs from 192.168.0.1 though 192.168.255.254 (65536-2 IPs). With the first IP usually reserved and the last IP reserved (as broadcast address).

Most SoHo setups take the RFC1918 range of 192.168.0.0/16, split in into 256 smaller subnets (/24) and assign the router the first or the last usable IP.

This makes a lot of sense when you design a network. One of the first things you need to plan the a way off the local network, and giving that the first IP got to be custom. But that is pure custom. Giving the router and IP of 192.168.1.42 is equally valid.


Suppose a request for 123.23.45.27 comes to a router, the router applies the subnet mask to it and suppose comes out with the network address as 123.23.0.0, so now it will check it's routing table for network address as 123.23.0.0 and refer to the corresponding routing table entry that is capable of handle this request and that router further handles the requests.

Are my following assumptions true?

A router finds the network address from the IP address and checks its routing table.

True.

The routing table contains entries in the form of network address vs Router address and then a matched router address is picked up for forwarding the request.

Not sure about the versus. It contains network addresses. Briefly it does this:

  • If the routers was the destination then the packet is handled up.
  • If the router was not the destination then a router will check if it has a specific entry for a that host. Of it has it will forward it based on that.
  • If the router was not the destination then a router will check if it has a specific entry for a network. If it has then it will forward it based on that.
  • If the router was not the destination and it has neither of those then it will forward it to the default gateway as set on that router

All request's for IP address in the range 123.23.0.1 to 123.23.255.255 will be mapped to network address 123.23.0.0 and will be sent to the same router for further routing.

Only for a /16. There are 30 possible network masks (excluding 0.0.0.0 and host-to-host specific ones) and only 3 of those end on the common round .0's

Hennes

Posted 2016-04-13T15:30:01.413

Reputation: 60 739

Awesome answer, clarified many things. There are two points where I am stuck. 1. Who carries the subnet mask, does it come along with the ip address(every ip address) or is it stored in the router (which is common for all incoming ip requests and the same is applied to all of them). 2. ' If they are assigned to routers then why is my local lan router identified as 192.168.0.1 which is not a network address' it would be really grateful if you could explain it with bit more simplicity. – Shivam Aggarwal – 2016-04-14T02:18:23.517

1

>

  • An IP datagram header does not contain the mask, because that is a routing distinction, so the router will perform a route lookup for the address specified. This involves searching the routers routing table, and selecting the Most Specific route available to that host. https://telconotes.wordpress.com/2013/09/09/how-a-router-selects-the-best-route/ . Routers exchange routes through a wide array of specialized protocols (RIP/OSPF/BGP/IGMP/etc) , so depending on who/how the router is configured to share route info from peers will affect the degree to which a route is available.
  • – Frank Thomas – 2016-04-14T03:14:04.577

    1the key takeaway here is that an address exists in every mask that includes it, all at the same time. 10.0.0.9 could be addressed by a router using the 10../8, 10../16, 10../24, 10../25, 10../26, 10../27, and 10../28 , and they will all take the exact same path. if you subnet to 29 bits, then there will be one more hop involved, but the point is that a mask is overlaid on an address; it is not a part of that address. from two hops away, hundreds of networks can be aggregated into a singe route to 11.0.0.0/8 and leave up to a router down stream to know how to physically reach 11.2.3.4. – Frank Thomas – 2016-04-14T03:23:07.913

    1 start="2">

  • you assign an Interface the address 192.168.0.1, and provide a mask so that the router can infer the "shape" of the network it is connected to, allowing the interface to calculate the Broadcast, host-range, and network ID of the interface's network. this is one common use of a net mask, but its only a shortcut. Historically, interface configuration is not the primary purpose of a Mask. Masks are really for the purpose of routing, so the place where they are important is in the routing table. So Masks are not "applied" to Routers, they are applied to Routes in the routers table.
  • < – Frank Thomas – 2016-04-14T03:31:14.817

    @FrankThomas so does the router keeps a record of the subnet mask? – Shivam Aggarwal – 2016-04-14T05:07:12.880

    1it keeps one subnet mask per route in its route table, yes. I'm not certain what you mean though. what specific subnet mask instance are you asking about? – Frank Thomas – 2016-04-14T05:16:09.097

    @FrankThomas thanks for answering all my questions :D. Suppose that a router gets a packet to be delivered to an IP address 123..45.67.89 then what subnet mask will be used to find the network address/host for this IP address ? Will the default subnet be used or some predefined subnet, which is stored in the router. Also in your comment what does " one subnet mask per route mean". Kindly explain. – Shivam Aggarwal – 2016-04-14T06:20:09.637

    The router looks up the address in its routing table, and selects the most specific route (see my link in the comment above on how that is handled). The router doesn't need to know the mask except to tell whether a route contains the destination. Every route is to a destination, and the mask tells the router what destinations are available on a given route. Once the route is selected the packet is sent out the routes specified exit interface. The only think the mask is for, is to define the destinations available on a route the router knows. the client does not send this info at all. – Frank Thomas – 2016-04-14T11:46:52.917

    2

    An IP network consists of a range of IP addresses, such that it defines a:

    Network ID (or Address) (eg 10.0.0.0/8): An address that can refer to the network as a whole. This is used by routers to route traffic between networks that are many hops apart. This address cannot be used by anything except routers routing tables (it is NEVER assigned to an interface; you cannot ping it, etc), for the purpose of finding a pathway between two networks. A network address must have an accompanying Subnetwork Mask to describe its scope (for instance there are hosts in the 4.0.0.0 network in New York City and in LA, so the netmask must be present to determine the correct path). Just remember, when thinking about Network Addresses, your perspective should be "I have lots of networks, how to I interconnect them all? I don't know or care whats in those networks. just how to get to and from them."

    Broadcast Address (eg 10.255.255.255): an address that will send traffic to all hosts on the network automatically.

    Host Addresses (eg 10.0.0.1 - 10.255.255.254): the unicast addresses that hosts use. A router on the 10. network has a unicast address (10.0.0.1?) and that router is said to "Service the 10.0.0.0/8 network". to be clear however, the router neither defines the network, nor Is the network; the network exists without it, but is unreachable from the outside world.

    Gateway Address (eg 10.0.0.1): the address of a router on the same network, which connects to other networks. All inter-connected networks have a "Default Gateway" which is used if the computer does not specifically know of a router that can reach a remote network.

    Note that I'm using 10.0.0.0 in my examples, because its easy to type, but these ideas are pervasive across networks of all sizes.

    Frank Thomas

    Posted 2016-04-13T15:30:01.413

    Reputation: 29 039

    Thanks alot for a brief answer. So does it mean that a network address is just a virtual address and is never assigned to a physical device such as a router. – Shivam Aggarwal – 2016-04-13T16:12:31.470

    1that is correct. A network address exists in a router's route table, and says "any traffic destined for a host in 10.0.0.0/8 should be sent out network card 2". Think about the routers at the core of the internet. They have to decide what path to send a packet out, and their choices may affect what continent the traffic is sent to, so it may have to know thousands or millions of networks in order to make that choice. Then you start gettig into "Route Aggregation" which lets a router say "these million networks are in North America, and those million are in Africa". – Frank Thomas – 2016-04-13T16:16:46.897

    Okay. Now subnet mask's are used with what ? Is subnet mask stored inside a router or is it transmitted with the IP address everytime a request is made ? – Shivam Aggarwal – 2016-04-13T16:23:46.970

    I've added some edits to my question. Please read them and tell if it's correct ? – Shivam Aggarwal – 2016-04-13T16:36:46.463

    1You appear to have a general grasp of the concepts. One important thing to note, a subnetmask does always end in a contigious string of 0's, but ONLY WHEN EXPRESSED IN BINARY. Otherwise Classfull masks will always end in a decimal 0, but non-classfull masks (CIDR or Subnet) often end with other numbers. for instance 255.255.255.248 is a valid subnet mask for a class C network, subnetted into 32 subnetworks of 6 hosts each. in such a case, 192.168.0.8 would be the network Id/address, with hosts between 192.168.0.9-14 and a broadcast address of 192.168.0.15. – Frank Thomas – 2016-04-13T19:57:01.710

    1

    A subnet mask divides an IP address into network address and host address.

    Correct.

    A network address always ends with a series of 0's like (mostly for all subnets) such as 123.0.0.0, 123.45.0.0 and 123.45.67.0.

    It ends with some number of zero bits. If there are eight of them, that will make the last octet a zero.

    What actually is network address ? Does it identify any real world host or Router? i.e. are addresses like 123.0.0.0, 123.45.0.0 or 123.45.67.0 actually assigned to any routers or hosts.

    They're assigned to the network. That's why they're called network addresses.

    If they are assigned to routers then why is my local lan router identified as 192.168.0.1 which is not a network address (it doesn't have a trailing 0) and not as any other network address such as 192.168.0.0.

    They're not assigned to routers, they're assigned to networks. That's why they're called network addresses.

    Does it work this way, Suppose a request for 123.23.45.27 comes to a router, the router applies the subnet mask to it and suppose comes out with the network address as 123.23.0.0, so now it will check it's routing table for network address as 123.23.0.0 and refer to the corresponding router address entry that is capable of handle this request and that router further handles the requests.

    That's not right. How would the router know the subnet mask associated with that IP address? The router knows the subnet masks of its routes, but not necessarily of arbitrary addresses.

    The router finds all routes that match 123.23.45.27. If there are more than one of them, the router typically prefers the most specific match, that is, the one for the smallest network. If there are ties there, then various metrics (or load balancing rules) are used.

    A router finds the Network address from the IP address and checks its routing table.

    Nope. It can't do that. How would it know the subnet mask?

    The routing table contains entries in the form of Network Address vs Router address and then a matched router address is picked up for forwarding the request.

    Close. The routing table contains entries in the for of network address, subnet mask, and next hop which can be an address or an interface. For example, suppose this router is the last router before the host, the route can't hold the address of the next router -- there isn't one.

    All request's for IP address in the range 123.23.0.1 to 123.23.255.255 will be mapped to network address 123.23.0.0 and will be sent to the same router for further routing

    All IPs in that range will follow that route if that route is the most specific route for that range.

    David Schwartz

    Posted 2016-04-13T15:30:01.413

    Reputation: 58 310

    Thanks for the point to point answers. But now who carries the subnet mask. Does it come along with every ip address or it stored in the router and applied to all ip address coming to it. – Shivam Aggarwal – 2016-04-14T02:20:17.367

    @Shivamaggarwal The router doesn't know the subnet mask, nor does it need to. The router doesn't have to get the packet to the right subnet. (Unless it just happens to be one of the routers specifically tasked with getting the packet to the right subnet, in which case it is configured with the subnet mask by the operator of that network.) It just has to get the packet going in the right direction by finding the most specific matching route that it has. – David Schwartz – 2016-04-14T10:52:31.537

    Say the router is owned by AT&T and the destination is a Comcast customer with 5 static IP addresses (assigned a block of 8 with 1 for Comcast's router, subnet address, and broadcast leaving 5 for customer devices). Why does AT&T's router need to know the size of the Comcast customer's subnet? Of course it doesn't, it just needs to get the packet to the right network. It does that by finding the longest matching route in its routing table, which will be a route advertised by Comcast that covers many, many subnets. – David Schwartz – 2016-04-14T10:56:01.163