Gert
Posts: 168
Joined: Wed Oct 24, 2012 10:19 pm

What's the '/number' after static ip in dhcpcd.conf

Fri Jul 29, 2016 4:48 am

Hi All,

Trying to understand the content of the static ip line in dhcpcd.conf.
What is the meaning of the number behind the ip address?

I.e. the '/24' in the below example?

Code: Select all

interface eth0
static ip_address=10.0.1.60/24
static routers=10.0.1.1
static domain_name_servers=8.8.8.8 8.8.4.4
man dhcpcd.conf gives the same content but does not explain it.

Thanks,
Gert

User avatar
Pilosopong Tasyo
Posts: 116
Joined: Wed Apr 06, 2016 11:43 am
Location: /root

Re: What's the '/number' after static ip in dhcpcd.conf

Fri Jul 29, 2016 5:28 am

It's called the CIDR netmask. You'll find more technical information when you use your favorite search site and enter (for example):
what is the number after the slash in an ip address?
in the search field.
Give a man a ghoti and he'll eat for a day; teach him how to ghoti and he'll eat for life. Ghoti?! - http://i.imgur.com/mAfBUdi.png
How To Ask Questions The Smart Way - http://www.catb.org/esr/faqs/smart-questions.html

tekim
Posts: 13
Joined: Fri Sep 28, 2012 7:14 pm
Location: U.K.

Re: What's the '/number' after static ip in dhcpcd.conf

Fri Jul 29, 2016 3:44 pm

Greetings,

A less technical answer: The value after the slash defines the number of most significant ones in the subnet mask. So /24 is the same as writing FF.FF.FF.00

As always I maybe quite wrong.

Cheers

drgeoff
Posts: 10538
Joined: Wed Jan 25, 2012 6:39 pm

Re: What's the '/number' after static ip in dhcpcd.conf

Fri Jul 29, 2016 4:06 pm

tekim wrote:Greetings,

A less technical answer: The value after the slash defines the number of most significant ones in the subnet mask. So /24 is the same as writing FF.FF.FF.00

As always I maybe quite wrong.

Cheers
I have never seen an IP address or subnet mask written in hexadecimal.

User avatar
DougieLawson
Posts: 38553
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: What's the '/number' after static ip in dhcpcd.conf

Fri Jul 29, 2016 8:51 pm

tekim wrote:A less technical answer: The value after the slash defines the number of most significant ones in the subnet mask. So /24 is the same as writing FF.FF.FF.00
It's more usual to write netmasks as dotted decimal.

/24 means the first 24 bits of the address are the mask. So that's 11111111111111111111111100000000 or in dotted decimal 255.255.255.0. The bottom eight bits of the 32 bit address are the host address.

There's a detailed discussion starting at: http://www.tcpipguide.com/free/t_IPSubn ... ncepts.htm

It gets more interesting with IPv6 where the addreses are 128 bits and masks are usually /56 or /64.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

I'll do your homework for you for a suitable fee.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: What's the '/number' after static ip in dhcpcd.conf

Fri Jul 29, 2016 8:55 pm

drgeoff wrote:
tekim wrote:Greetings,

A less technical answer: The value after the slash defines the number of most significant ones in the subnet mask. So /24 is the same as writing FF.FF.FF.00

As always I maybe quite wrong.

Cheers
I have never seen an IP address or subnet mask written in hexadecimal.
tekim's answer is correct, although leaving the IP address in hex form isn't that common. That said there are some systems that use the hex form particularly for the netmask.

e.g. pulled from a SmartOS (Solaris derivative box)

Code: Select all

e1000g0: flags=1001000943<UP,BROADCAST,RUNNING,PROMISC,MULTICAST,IPv4,FIXEDMTU> mtu 1500 index 2
        inet 192.168.33.221 netmask ffffff00 broadcast 192.168.33.255
        ether d0:17:c2:88:64:a8
Of course if you're using IPv6 you'll see lots of hexadecimal.

Return to “Troubleshooting”