How can I determine network and broadcast address from the IP address and subnet mask?

前端 未结 5 2111
礼貌的吻别
礼貌的吻别 2020-12-12 16:23

For example:

  • IP Address: 130.45.34.36
  • Mask: 255.255.240.0

What would be Net ID/Subnet Address, and Broadcast

5条回答
  •  孤城傲影
    2020-12-12 17:25

    Let's write both in binary:

    130.45.34.36 = 10000010.00101101.00100010.00100100

    255.255.240.0 = 11111111.11111111.11110000.00000000

    A bitwise AND between the two would give us the network address:

    10000010.00101101.00100010.00100100   (ip address)
    AND
    11111111.11111111.11110000.00000000   (subnet mask)
    =
    10000010.00101101.00100000.00000000 = 130.45.32.0 (the resulting network address)
    

    A bitwise OR between the network address and the inverted subnet mask would give us the broadcast address:

    10000010.00101101.00100000.00000000   (netadress)
    OR
    00000000.00000000.00001111.11111111   (inverted subnet mask)
    =
    10000010.00101101.00101111.11111111 = 130.45.47.255 (broadcast address)
    

提交回复
热议问题