32 bits
/ 4 bytes
192.168.1.254
= 11000000.10101000.00000001.11111110
/24
after the IP number indicates 24
out of the 32
bits in an IP address correspond to the network portion. Possible values are 1 > n > 32
where n
is an integer. 🔥🔥🔥
192.168.1.0/24
Class | First octet | First octet numeric range |
---|---|---|
A | 0xxxxxxx | 0-127 (1-126) |
B | 10xxxxxx | 128-191 |
C | 110xxxxx | 192-223 |
D | 1110xxxx | 224-239 |
E | 1111xxxx | 240-255 |
A
class range is considered to start at 1
because 0
first octet is used reservedA
class range is considered to end at 126
because 127
first octet is used to test the network stack (l3) on the local deviceA
, B
and C
.D
are multicast addressesE
are reserved (experimental)Class | First octet | First octet numeric range | Prefix Length |
---|---|---|---|
A | 0xxxxxxx | 0-127 (1-126) | /8 |
B | 10xxxxxx | 128-191 | /16 |
C | 110xxxxx | 192-223 | /24 |
Class | Prefix Length | Netmask | Binary octets |
---|---|---|---|
A | /8 | 255.0.0.0 | 11111111 00000000 00000000 00000000 |
B | /16 | 255.255.0.0 | 11111111 11111111 00000000 00000000 |
C | /24 | 255.255.255.0 | 11111111 11111111 11111111 00000000 |
2^n - 2
🔥
where
n
= number of host bits
192.168.1.0/24
— 192.168.1.255/24
192.168.1.0
is the network address (network id) and 192.168.1.255
is the broadcast address172.16.0.0/16
— 172.16.255.255/16
172.16.0.0
is the network address (network id) and 172.16.255.255
is the broadcast address10.0.0.0/8
— 10.255.255.255/8
10.0.0.0
is the network address (network id) and 10.255.255.255
is the broadcast address192.168.1.0/24
/24
means 192.168.1
is the network portion and .0
is the host portion0
it means it is the network address0
s192.168.1.255/24
/24
net mask it would be the last octet .255
Consider the following network where the router interfaces are yet to be configured:
Router>enable
Router#show ip interface brief
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 unassigned YES unset administratively down down
GigabitEthernet0/1 unassigned YES unset administratively down down
GigabitEthernet0/2 unassigned YES unset administratively down down
Vlan1 unassigned YES unset administratively down down
Router#
G0/0
, G0/1
, G0/2
and G0/3
)OK?
column is a legacy field not used anymore.Method
: method by which the interface was assigned an IP addressStatus
: L1 Status of the Interface 🔥
shotdown
command. This is the default status of Cisco router interfaces.Protocol
: L2 Status of the interface 🔥
DOWN
at L1, L2 can’t operate 🔥Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface gi
Router(config)#interface gigabitEthernet 0/0
Router(config-if)#ip address 15.255.255.254 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
Router(config-if)#
interface gigabitEthernet 0/0
command to enter gigabitEthernet 0/0
interface configurationip address 15.255.255.254 255.0.0.0
to configure the IP address, we need to manually enter the subnet mask :fire:no shutdown
because Cisco router interfaces had the shutdown
command applied to them by default%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
indicates the physical layer status of the interface (Status
column)%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
indicates the L2 status of the interface (Protocol
column)We’ll do the same for the other 2 interfaces
Router(config-if)#interface gigabitEthernet 0/1
Router(config-if)#ip address 182.98.255.254 255.255.0.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
Router(config-if)#
Router(config-if)#interface gigabitEthernet 0/2
Router(config-if)#ip address 201.191.20.254 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/2, changed state to up
Router(config-if)#
Now we can verify our interfaces are configured and working as expected
Router(config-if)#do show ip interface brief
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 15.255.255.254 YES manual up up
GigabitEthernet0/1 182.98.255.254 YES manual up up
GigabitEthernet0/2 201.191.20.254 YES manual up up
Vlan1 unassigned YES unset administratively down down
Router(config-if)#