On this page 11 sections
1. IPv4 address, mask and gateway
Example: PC1 uses 192.168.10.10/24 and gateway 192.168.10.1. The /24 prefix means the first 24 bits identify the network; the remaining 8 bits identify addresses within it.
The subnet mask determines which destinations are local. A default gateway is a router on the local subnet used to reach other networks. It need not use the first usable address, although this is a common convention.
In an ordinary IPv4 LAN subnet, the first address identifies the network and the last is the broadcast address. Neither is assigned to a host.
PC1 address: 192.168.10.10/24
Subnet mask: 255.255.255.0
Network: 192.168.10.0
Usable addresses: 192.168.10.1 - 192.168.10.254
Broadcast: 192.168.10.255
Default gateway: 192.168.10.1
To 192.168.10.20: send directly on the local network
To 192.168.20.20: send through the gateway2. Choose the right prefix
Example: a LAN needs 50 PCs and one router interface. Count 51 required addresses, then choose the smallest subnet that fits: /26, with 62 usable addresses.
For ordinary IPv4 LAN subnets, usable addresses = 2^(32 - prefix) - 2. Include gateways, servers and planned growth when sizing a subnet.
The formula has exceptions: /31 supports two endpoints on compatible point-to-point links, and /32 identifies one address, commonly a loopback or host route. Use /30 for the point-to-point planning example in this note.
Prefix Mask Total addresses Usable LAN addresses
/24 255.255.255.0 256 254
/25 255.255.255.128 128 126
/26 255.255.255.192 64 62
/27 255.255.255.224 32 30
/28 255.255.255.240 16 14
/29 255.255.255.248 8 6
/30 255.255.255.252 4 2
Need 51 addresses:
/27 -> 30 usable: too small
/26 -> 62 usable: fits3. Find a subnet by hand
Example: identify the network containing 192.168.10.77/26.
The mask is 255.255.255.192. In the changing octet, calculate 256 - 192 = 64. Subnet boundaries are therefore 0, 64, 128 and 192. Address 77 falls in the 64–127 block.
The network is 192.168.10.64, the broadcast is 192.168.10.127, and the usable range is 192.168.10.65–126. A gateway at 192.168.10.1 would be outside this host's subnet.
For larger networks, apply the increment in the octet where the mask changes. For example, /20 uses mask 255.255.240.0 and increments of 16 in the third octet.
Network First host Last host Broadcast
192.168.10.0/26 192.168.10.1 192.168.10.62 192.168.10.63
192.168.10.64/26 192.168.10.65 192.168.10.126 192.168.10.127
192.168.10.128/26 192.168.10.129 192.168.10.190 192.168.10.191
192.168.10.192/26 192.168.10.193 192.168.10.254 192.168.10.255
192.168.10.77 belongs to 192.168.10.64/26.4. Build a VLSM plan
Example: divide 192.168.50.0/24 among Sales, IT, a server LAN and a router link.
VLSM (Variable Length Subnet Mask) uses different prefix lengths within an address block. Allocate the largest subnet first, then use the next correctly aligned boundary. Never overlap allocations.
Sales needs 50 endpoints plus a gateway: /26. IT needs 20 plus a gateway: /27. The server LAN needs 10 plus a gateway: /28. The router link needs two addresses: /30.
This is a planning exercise separate from the two-LAN configuration below. The remaining addresses, .116–.255, stay unallocated; that range is not itself one CIDR subnet.
Purpose Network Mask Usable range Broadcast
Sales 192.168.50.0/26 255.255.255.192 .1 - .62 .63
IT 192.168.50.64/27 255.255.255.224 .65 - .94 .95
Servers 192.168.50.96/28 255.255.255.240 .97 - .110 .111
R1-R2 192.168.50.112/30 255.255.255.252 .113 - .114 .115
Suggested LAN gateways:
Sales: 192.168.50.1
IT: 192.168.50.65
Servers: 192.168.50.97
Router-link endpoints:
R1: 192.168.50.113/30
R2: 192.168.50.114/305. Configure two IPv4 LANs on R1
Example: connect one PC directly to each of R1's two Ethernet interfaces in a fresh lab. Split 192.168.10.0/24 into two /26 LANs. This is independent of the first note's /24 lab.
Use interface names supported by your router. Prompts identify the device and mode. Type only the text after the prompt. PC1> identifies the PC terminal; its actual prompt depends on the operating system.
- interface GigabitEthernet0/0: select the first LAN interface.
- ip address 192.168.10.1 255.255.255.192: assign the first LAN's gateway and /26 mask.
- description: label the interface's purpose.
- no shutdown: enable the interface.
Set PC1 to 192.168.10.10/26, gateway 192.168.10.1. Set PC2 to 192.168.10.70/26, gateway 192.168.10.65. In Packet Tracer, use each PC's Desktop > IP Configuration screen.
R1 routes between its connected LANs without a static route or routing protocol. Both router interfaces must be operational.
PC1 ---------------- R1 ---------------- PC2
Gi0/0 Gi0/1
LAN A: 192.168.10.0/26
PC1: 192.168.10.10/26
R1: 192.168.10.1/26
LAN B: 192.168.10.64/26
PC2: 192.168.10.70/26
R1: 192.168.10.65/26R1# configure terminal
R1(config)# interface GigabitEthernet0/0
R1(config-if)# description LAN_A_PC1
R1(config-if)# ip address 192.168.10.1 255.255.255.192
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# interface GigabitEthernet0/1
R1(config-if)# description LAN_B_PC2
R1(config-if)# ip address 192.168.10.65 255.255.255.192
R1(config-if)# no shutdown
R1(config-if)# end6. Verify IPv4 addressing
Example: PC1 must reach both its gateway and PC2 on the other LAN.
- show ip interface brief: check router addresses and up/up status.
- show ip route connected: confirm both /26 networks appear as connected routes.
- show ip interface GigabitEthernet0/0: inspect the interface prefix and IP settings.
- ping: test reachability; from PC1, test the gateway before PC2.
Expected: R1 has connected routes for 192.168.10.0/26 and 192.168.10.64/26. PC1 can reach 192.168.10.70 if both PCs have correct masks, gateways and permit ICMP.
R1# show ip interface brief
R1# show ip route connected
R1# show ip interface GigabitEthernet0/0PC1> ipconfig
PC1> ping 192.168.10.1
PC1> ping 192.168.10.707. Read an IPv6 address
Example: give LAN A prefix 2001:db8:10::/64 and LAN B prefix 2001:db8:20::/64. The 2001:db8::/32 block is reserved for documentation and labs; do not use it as public production addressing.
IPv6 uses 128 bits written as eight hexadecimal groups. Leading zeros in a group may be omitted. :: replaces consecutive all-zero groups and may appear only once per address.
A /64 is the standard size for an ordinary SLAAC-enabled LAN. IPv6 has no broadcast address, so do not apply the IPv4 minus-two formula. Use the example host addresses below rather than assigning special addresses such as the all-zero interface identifier.
Link-local addresses belong to fe80::/10 and work only on the local link. Routers do not forward them to another link. A host commonly uses the router's link-local address as its IPv6 gateway.
Expanded: 2001:0db8:0010:0000:0000:0000:0000:0001
Compressed: 2001:db8:10::1
Device/interface IPv6 address Gateway
R1 Gi0/0 2001:db8:10::1/64 --
PC1 2001:db8:10::10/64 fe80::1
R1 Gi0/1 2001:db8:20::1/64 --
PC2 2001:db8:20::20/64 fe80::2
R1 Gi0/0 link-local: fe80::1
R1 Gi0/1 link-local: fe80::28. Add IPv6 to the same router
Example: keep the IPv4 configuration and add IPv6 to both LANs. Running IPv4 and IPv6 together is called dual stack; each protocol has its own addressing and routing table.
- ipv6 unicast-routing: enable IPv6 packet forwarding between router interfaces.
- ipv6 address 2001:db8:10::1/64: assign the LAN A IPv6 address and prefix.
- ipv6 address fe80::1 link-local: explicitly set the interface's link-local address.
- show ipv6 interface brief: list IPv6 addresses and interface status.
- show ipv6 route connected: check connected IPv6 prefixes.
Set the PCs' static IPv6 addresses, /64 prefix lengths and link-local gateways from the plan above. In Packet Tracer, use Desktop > IP Configuration. An IPv6 address on an interface alone does not enable forwarding between LANs; R1 needs ipv6 unicast-routing.
R1# configure terminal
R1(config)# ipv6 unicast-routing
R1(config)# interface GigabitEthernet0/0
R1(config-if)# ipv6 address 2001:db8:10::1/64
R1(config-if)# ipv6 address fe80::1 link-local
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)# interface GigabitEthernet0/1
R1(config-if)# ipv6 address 2001:db8:20::1/64
R1(config-if)# ipv6 address fe80::2 link-local
R1(config-if)# no shutdown
R1(config-if)# endR1# show ipv6 interface brief
R1# show ipv6 route connected9. Test IPv6 and understand SLAAC
Example: PC1 should reach R1 at 2001:db8:10::1 and PC2 at 2001:db8:20::20 using the static plan.
- ping ipv6 2001:db8:20::20: test PC2 from R1.
- show ipv6 neighbors: inspect IPv6 neighbor mappings learned through Neighbor Discovery.
- show ipv6 interface GigabitEthernet0/0: inspect addresses and Router Advertisement settings.
IPv6 uses Neighbor Discovery, not ARP. On a PC, ping syntax varies by operating system; Packet Tracer accepts an IPv6 destination directly.
SLAAC (Stateless Address Autoconfiguration) lets a host form an address using a prefix advertised by a router. As an optional experiment, change PC1 to IPv6 Auto Config. With the usual IOS Ethernet defaults and this /64 configuration, R1 advertises the prefix. The generated address may differ from ::10; inspect it before testing. The host learns its default router through Router Advertisements, not DHCPv6.
Expected: PC1 reaches both IPv6 destinations. Do not use PC2's link-local address to test across R1: link-local traffic stays on its own link.
PC1> ping 2001:db8:10::1
PC1> ping 2001:db8:20::20R1# ping ipv6 2001:db8:20::20
R1# show ipv6 neighbors
R1# show ipv6 interface GigabitEthernet0/010. Common addressing mistakes
Example: PC1 reaches R1 but cannot reach PC2. Check host settings as well as router interfaces.
Wrong IPv4 mask: a PC using /24 instead of /26 may incorrectly treat the other LAN as local. Configure the planned mask consistently; do not rely on proxy ARP to hide the error.
Gateway outside the subnet: 192.168.10.70/26 should use 192.168.10.65 in this lab, not 192.168.10.1.
Overlapping router networks: each routed interface in this lab needs a distinct subnet. Recheck boundaries before assigning addresses.
Duplicate IP: every host address must be unique on its link. IPv6 Duplicate Address Detection can flag a duplicate and prevent use of that address.
IPv4 works, IPv6 fails: verify the IPv6 prefix, host gateway and ipv6 unicast-routing. The two protocols operate independently.
- show running-config: compare interface addresses against the plan.
- show ip route: inspect IPv4 routes.
- show ipv6 route: inspect IPv6 routes.
- copy running-config startup-config: save R1 after successful verification.
R1# show running-config
R1# show ip route
R1# show ipv6 route
R1# copy running-config startup-config11. Cisco references
Cisco — Configure IP Addresses and Unique Subnets for New Users:
https://www.cisco.com/c/en/us/support/docs/ip/routing-information-protocol-rip/13788-3.html
Cisco — IPv6 Addressing and Basic Connectivity:
https://www.cisco.com/c/en/us/td/docs/routers/ios/config/17-x/ip-addressing/b-ip-addressing/m_ip6-add-basic-conn-xe.html