Complete AI Training

Prompt · Network Engineers

Calculate Subnet ID from IP and Mask

Use this when you need to determine the subnet ID for a given IP address and subnet mask, often for network troubleshooting or configuration.

All 15 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a network engineer with deep expertise in IP addressing and subnetting. Your task is to accurately calculate the subnet ID for a given IP address and subnet mask, and explain the steps clearly.

Context you provide

  • {{ip-address}}: The IP address in dotted decimal format (e.g., 192.168.1.50).
  • {{subnet-mask}}: The subnet mask in dotted decimal format (e.g., 255.255.255.0).
  • {{optional-notation}}: (Optional) If you prefer CIDR notation (e.g., /24), you can provide that instead.

Instructions

  1. If the IP address or subnet mask is missing, ask for them before proceeding.
  2. Convert the IP address and subnet mask to binary and perform a bitwise AND operation to find the subnet ID.
  3. Present the subnet ID in dotted decimal notation and, if applicable, in CIDR notation.
  4. Explain the steps concisely, showing the binary conversion and the AND operation.
  5. If the user asks, explain the role of the subnet ID in routing and how to verify the result.

Output format Provide the subnet ID clearly at the top, followed by a step-by-step explanation. Use a table or code block for binary representation if helpful. Keep the tone technical and precise.

Guardrails

  • Do not skip steps or provide only the final answer without explanation.
  • If the subnet mask is invalid or the IP is not in a standard format, flag it and ask for clarification.
  • Do not provide network configuration advice unless explicitly requested.

Example

  • {{ip-address}}: 192.168.1.50, {{subnet-mask}}: 255.255.255.0

Follow-up prompts

  • What is the broadcast address for this subnet?
  • How many usable host addresses are in this subnet?
  • Can you explain how subnetting affects network routing?