Why is IP Address listed with this notation I mean the ip is only why it haves /24?, and then whatever what subnet that is on should be someone else's worries, no?

3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether f8:b1:56:ba:ae:ee brd ff:ff:ff:ff:ff:ff
inet brd scope global eth0

If I want to reach on some interface (ethX) on another computer I could add in the routing table of that computer:

ip route add dev ethX
ip route add dev ethX
ip route add dev ethX
ip route add dev ethX

right? So what does /24 really have to do with my address on my NIC? It seems it only has to do with routing, no? So why list it in ip addr?

Is on the same "net" as or are these two completely different IP addresses?

  • it's probably listed because you configured it that way u.u 172.18.X.X is a private address space, so you can configure whatever you want there. Jun 1, 2015 at 12:45
  • 1
    What is your question exactly ? do you want to know the meaning of "/24" ?
    – Ob1lan
    Jun 1, 2015 at 12:46
  • Why downvote? The question is legit, no?
    – JohnyTex
    Jun 1, 2015 at 12:59
  • 1
    @JohnyTex check this en.wikipedia.org/wiki/Classless_Inter-Domain_Routing Jun 1, 2015 at 13:10
  • I tried to clarify.
    – JohnyTex
    Jun 1, 2015 at 13:29

5 Answers 5


Some IP address basics

IP addresses are internally represented as a 32 bit value. The topmost N bits identify the network, the rest of the number identifies the host in the network.

Let's look at two examples IPs, let's first look at the 32 bits:


You can rewrite the IP in an easier readable way by splitting it into 8 bit groups (bytes) and writing each binary in decimal format:

10101100 00010010 00000000 10010110
10101100 00010010 00000001 10010110
grouped and decimal:

The question now is "are these IP addresses on the same network"? That depends on the network configuration. Let's take for example the network mask

11111111 11111111 11111111 00000000

(The ones are for the network, the zeroes are for the host.)

Laying that over the two IPs you see that both IP addresses are on different networks. If the mask where, they would be on the same network.

Different network:
11111111 11111111 11111111 00000000
10101100 00010010 00000000 10010110
10101100 00010010 00000001 10010110
Same network:
11111111 11111111 00000000 00000000
10101100 00010010 00000000 10010110
10101100 00010010 00000001 10010110

As with the IP addresses the network masks can also be written in decimal dotted format: or If you now need to write the full IP and network mask like or this is a lot of stuff to write. A shorter writing is not giving the network mask but the number of 1s in the network mask: or As you know, the 1s are always the topmost bits, so it is clear what "/24" or "/20" means.

Some routing basics

If you have not yet read my answer for the use of MAC addresses you might want to do so now.

In short: if the computer sends an IP packet, he is first checking if the destination IP address is on the same network as the computer itself (the source IP). If so, the computer can send the packet directly to the network and the destination computer can receive it. If the destination IP is not on the same network, then the computer cannot reach the target directly but needs to send the packet to the next router. Routing tables tell the router for which networks he shall connect which router (e.g. "if network, then router"). That router again will check if it can directly reach the destination IP or if it needs to forward the packet to the next router.

If you want to take a look at the routing table of your computer, you can use ip route.

Keep in mind that on the receiver side the network mask is not relevant. or are both and if the computer receives a packet for he will consume it. The network mask is only used on sender's side. If computer A sends a packet from address a.a.a.a/n to computer B with address b.b.b.b/m then the sender A will compare the topmost n bits of the source address a.a.a.a and the topmost n bits of b.b.b.b. If both are equal, then a.a.a.a and b.b.b.b are on the same network (and n must equal m) and the packet can be sent directly. If they are not, then the networks are not equal (it does not mind that n might not equal m) and the packet must be sent a router who will forward the packet.

Understanding "ip route" output

Let's take for example a computer with two NICs:

default via dev eth1 proto static metric 1024 via dev eth0 dev eth1 scope link metric 1000 dev eth0 proto kernel scope link src dev eth1 proto kernel scope link src

The lines 3 to 5 are derived from the IP addresses configured on the NICs (ip addr). They tell the computer that if a packet to send matches for example network it shall be sent on eth0 (which is configured to IP address in my case). The second line is a specific route that I added. It says that packets to shall be sent to on eth0. The first line is giving the default gateway/router to use for packets that do not match any other given network.

Who decides how what a network is?

On top level RFC3330 defines that not all IP addresses are for broad use but that some ranges are reserved for special purposes. One example is the network The most prominent address in that range is (name: localhost) which identifies your own computer. This IP of course is only useful on your own computer because every packet sent to that network never leaves your computer. Taking all possible IP addresses and removing the reserved ranges you still have a pool of networks that are available. That big pool is managed by the ICANN. The next hierarchy level are five regional internet registries (like RIPE NCC). They get IP address ranges from the ICANN and sell them to their own customers - the local internet registries. These sell them to end customers (e.g. companies).

The decision how to split the complete IP address range is up to each manager of the pool. Let's say you are ICANN and manage the range If now RIPE NCC asks for some IP addresses you can give them or or up to The same is true for RIPE NCC and the local internet registries. They can provide big or small networks. In the good old times the registries where quite reluctant and so there still exists big universities or companies with broad address ranges that they never needed completely. Some universities got /8 networks, so they have 24 bits for the host. That means they can address more than 16 million computers. If they only have some thousands of computers than it means that millions of IP addresses are reserved for that customer but never used - what a waste. So lately you are not getting big ranges anymore, you must argue if you really need the big range.

Anyway how you decide to sell the IP address ranges (networks) you must keep in mind that the big routers in the internet need to know how to reach almost any of the existing networks. If you sell very small networks you might end up with and being in Europe, and being in Asia and and being in Africa. That means that the router will end up with a lot of small network entries in the routing table. If you were giving to Europe, to Asia and to Africa you would only have three entries for bigger networks in the routing table.

But that all is not our problem, it's the business of the internet registries. Not quite, because...

When and how do I need to setup a network?

In case you run a company's router you might get a range and give these IP addresses to your computers as you like. But in this case all computers should be on the same physical network (no routers between). This might give bad performance for big networks, so you might want to split the networks. If you have for example two buildings, then you could allocate to building one and to building two.

Private IP addresses

In case you are running a broadband router or you run a company's router you might have seen private network IP addresses like The IP address you gave ( is such a private IP address (you can easily check with your new knowledge about network masks). These are used if you got N public IP addresses (in case of a normal ISP N=1) from your local internet registry but have M>N devices which need an IP address. In this case the router has one public IP address (used for all traffic to and from the internet) and also a private network with private IP addresses. In your case the router just took the private network and gives IP addresses from that network to each of your PCs.

But what if someone else's router also takes Surprisingly that is not a problem. This is because is a private address range. You will never see IP addresses of that range in the public internet. If you send a packet to the internet, giving as source address, then the router will replace the with the public IP address that the ISP gave you. If the router receives a packet sent to the public IP address it determines to which of your computers it shall send the packet and changes the destination IP address to the private network IP address of your computer.

  • I guess I do not understand what a "net" is really. I mean the IP is mapped to a mac address, right? And subnet are used in routing tables like so: dev eth0. Here it says that all those IP's should go into the net that is on eth0, right? So the net ought to be on eth0?
    – JohnyTex
    Jun 1, 2015 at 14:43
  • Is on the same net as or are these two completely different addresses?
    – JohnyTex
    Jun 1, 2015 at 14:45
  • 1
    @JohnyTex I added some stuff to my answer, hope it's clearer now. subnets are used in routing tables, right. A routing entry could be ",, eth0" meaning that packets sent to the network shall be sent to the router on eth0. Normally providing eth0 would not be necessary. Jun 1, 2015 at 15:38
  • 1 and are still the same IP address Again I extended my answer, hoping it is clearer now. Jun 1, 2015 at 15:52
  • 2
    @JohnyTex If n!=m you would have a network misconfiguration. Having two computers with A and B would work, but it will cause problems if you add another computer with C B and C would send directly to A (same network), but A would need to send to C over a router (different network). This inconsistency will cause problems. Jun 2, 2015 at 15:14

Certainly, you could make every host have a point-to-point connection with the router. That way, however, all traffic would have to pass through the router. Obviously, this is terribly inefficient.

If you tell your computer that “all IP addresses from to are directly reachable on this link” (192.168.0.X/24), it can use more efficient local network transports to communicate directly with destinations on the same network.


it's never someone else's worries.

It's a good thing to know the subnet an IP address belongs to.

Imagine that you are subnetting using /25. In that case and seems to be on the same subnet because they are consecutive but they are on different subnets.

It makes neccesary to state the addresses as and So you know where are each one of them.

This is a simple example but it could get worse if the range to is again subnetted, for example using /26.

  • 172.16/12 comes from the old class B space, where the canonical netmask was /16. Except classful IP allocation hasn't been used on the Internet since 1993. en.wikipedia.org/wiki/Classful_network
    – user
    Jun 1, 2015 at 13:13
  • So it is for informational purposes only then?
    – JohnyTex
    Jun 1, 2015 at 13:28
  • 1
    @JohnyTex Yes. The system is letting you know its IP address and the subnetting used.
    – jcbermu
    Jun 1, 2015 at 13:31
  • I don't understand what subnets have to do with the address? If I can reach the same address on multiple inclusive subnets anyway?
    – JohnyTex
    Jun 1, 2015 at 13:43
  • @JohnyTex I recommend you to read a guide on subnetting like this: techopedia.com/6/28587/internet/…
    – jcbermu
    Jun 1, 2015 at 13:49

CIDR notation is a syntax for specifying IP addresses and their associated routing prefix. It appends a slash character to the address and the decimal number of leading bits of the routing prefix, e.g., for IPv4, and 2001:db8::/32 for IPv6.

IP/CIDR     Δ to last IP addr       Mask              Hosts (*)     Size    
a.b.c.0/24    +        256          1 C    

Source/Reference Here


Part after the slash is how many subnet mask bits to use. Example: is is using 24 of the 32 bits to create the subnet.

in binary it looks like this:


So, if you want to know who you are, you are some one under but wich one, and how to get to you.. etc..

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .