Page 1 of 1

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

Posted: Fri Jul 29, 2016 4:48 am
by Gert
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

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

Posted: Fri Jul 29, 2016 5:28 am
by Pilosopong Tasyo
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.

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

Posted: Fri Jul 29, 2016 3:44 pm
by tekim
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

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

Posted: Fri Jul 29, 2016 4:06 pm
by drgeoff
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.

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

Posted: Fri Jul 29, 2016 8:51 pm
by DougieLawson
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.

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

Posted: Fri Jul 29, 2016 8:55 pm
by mfa298
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.