Can we use directed broadcast as limited broadcast? See scenario below - networking

I am learning Computer Networks and was reading about limited and directed broadcast.
If a host with IP 200.100.1.1 wants to send packets to all host in the same network, then does the procedures A and B, to achieve our goal, differs?
Procedure A SRC- 200.100.1.1 DEST- 200.100.1.255
Procedure B SRC- 200.100.1.1 DEST- 255.255.255.255
So, can we use Procedure A to do the task required as the directed broadcast(destination) is aiming at its own network? Or Procedure A is incorrect and Procedure B is the right way to go.

IP directed broadcast packets have a destination IP address that is a valid broadcast address for the subnet that is the target of the directed broadcast (the target subnet). The intent of an IP directed broadcast is to flood the target subnet with the broadcast packets without broadcasting to the entire network. reference; emphasis added
Assume the following:
We have an IP address of 200.100.1.1 (11001000.01100100.00000001 .00000001)
The netmask is /24 (or 255.255.255.0) (11111111.11111111.11111111 .00000000)
Then:
The network address is a bitwise AND between these two:
11001000.01100100.00000001 .00000001
11111111.11111111.11111111 .00000000
=
11001000.01100100.00000001 .00000000
200 100 1 0
So we know the network is 200.100.1.0.
To determine the broadcast address, we invert the subnet mask and OR it with the network address.
Network: 11001000.01100100.00000001 .00000000
Inverted Netmask: 00000000.00000000.00000000 .11111111
11001000.01100100.00000001 .11111111
=
200 100 1 255
The broadcast for 200.100.1.0/24 will be on 200.100.1.255
We also know that this network will have 254 possible hosts in it (or 253 given a gateway address; and the assumption that .0 is not addressable so 200.100.1.1 -> 200.100.1.254).

Related

What does this IP address stand for in IPv4

Hi I've been learning networks for a while now and I can't seem to find a solution for this doubt online.
I learnt that if you are sending a packet to a class B network's destination 141.49.255.255, it means you are broadcasting the packet to the whole class B network of 141.49.0.0; I also learnt that if you are sending a packet to a class A network's destination address like 10.255.255.255, you are again broadcasting the packet in the network ID 10.0.0.0
My question is, what am I doing when I'm sending a packet to class B 141.255.255.255 ? Am I sending it to a single host or a network?
Forget classes. Everything is being done in CIDR for the last two decades.
Sending to 141.255.255.255/16 is a subnet broadcast to 141.255.0.0/16. The same address may also be
141.255.255.255/8 - subnet broadcast to 141.0.0.0/8
141.255.255.255/6 - unicast(!) to the node 141.255.255.255
Most often, broadcasts are sent to 255.255.255.255. Routers (usually) don't forward broadcasts, so it's limited to the segment anyway.
However, there are some subtle differences: running e.g. 192.168.1.0/24 and 10.1.0.0/16 inside the very same Ethernet segment, a broadcast to 192.168.1.255/24 is physically sent to all nodes (Ethernet broadcast), even the ones with a 10.1.0.0/16 address. These however will the drop and ignore the packet since it doesn't address them.
In contrast, a broadcast to 255.255.255.255 will be sent to all nodes and processed by all nodes.

IP Address Class C network and its gateway

Suppose I have following network setup, in a ethernet:
I manually setup start IP and end IP as following:
192.168.2.1 - 192.168.254.254
Manually setup Gateway IP as:
192.168.2.1
Of course, Mask length as:
16
Subnet Mask:
255.255.0.0
Now my question would be following:
Class C network should starting with range: [128, 191], if I'm using 192.*.*.* and setup subnet mask as 255.255.0.0, does it work?
Is there any specific requirement to setup gateway in order to make sure range 192.168.2.1 - 192.168.254.254 work?
For any gateway that: 192.168.2.1 < gateway < 192.168.254.254, it should work for the range?
Suppose within this ethernet, I manually change one's IP to 192.168.1.*, does it able to ping gateway (192.168.2.1)?
Answers:
Since only recently (i. e. about 20 years ago), classful networking is obsolete in favour of CIDR. So you can have an IP range in the old Class A which has a netmask length of 24 bit, or a range in the former Class C range with a netmask length of 16 (or maybe even 17, 18, whatever) bits.
You need a gateway if you want to communicate outside of your network.
The range is defined by the net mask. Even if you only want to use 192.168.2 to 192.168.254, there is no way to exclude 0, 1 and 255 as the third octet, so 192.168.1.* is perfectly reachable from your subnet.
192.168.0.0/24 is address of restricted private IP subset wiki It will work.
Gateway is rather term of specified host within network which has access to other networks. It's address must be accessible from network.
Yes. (Of course if physically connected)

Wifi subnet for IP addresses

I have around 500 IP addresses. 172.45.67.1 - 172.45.67.200. How do I find the Wifi subnet for these IP addresses? If I could use a java API, that would be great. If not, any other technique to determine the subnet?
Your IP range appears to be part of a Class B IPv4 subnet based on the starting octet value 172.
http://en.wikipedia.org/wiki/IP_address#IPv4_subnetting
As such the subnet mask would be 255.255.0.0.
http://www.subnet-calculator.com/subnet.php?net_class=B
A Class B subnet allows for a maximum of 65,536 addresses.
Your building may be allocated just a slice of that subnet by the people administering that subnet. However, there is no way of knowing how much of that subnet is allocated to the building without further information (if there are 500 addresses, they cannot all be allocated from 172.45.67.* as there are only 255 addresses in that range).

Maximum number of systems in a LAN

I am developing a web application.
I want to deploy it in a LAN.
I would like to know what will be the maximum number of systems possible in a LAN?
The maximum number of nodes on a LAN depends on the media type, network protocol, and (at least for the IPv4 protocol) the network address class.
For example, a Class C IPv4 network (mask 255.255.255.0) on ethernet could have up to 254 nodes. (0 and 255 are reserved).
A class B IPv4 network such as 192.168.x.x (mask 255.255.0.0) might have up to 16381 nodes. (0 and 16383 are reserved). But in practice the number of ethernet nodes within the same collision domain is likely to be much less, depending on the number of hubs and their layout.
In a LAN like the one you say (192.168.1.56) is the maximum number of systems 253 if I'm not wrong. 255 is the highest number in an IP address and the last number and first number are reserved for broadcast address and network address.
Or it would be that the subnet mask is other than 255.255.255.0 then it can be even less than 253.
And about the handling of assignment of IP addresses that depends on how the network and systems are configured. Most of the networks are configured so that every PC gets his IP address from a DHCP server (router most of the times). If it goes through DHCP then one PC can have now IP address 192.168.1.56 and when it reboots it can have address 192.168.1.105. Also a PC can have a static IP address so that it does not change.
What do you mean with "maximum number of systems"? Amount of IP-adresses? That depends on the IP class and subclass.

IP adresses of B Class: broadcast

Are the following IP adresses - 168.94.254.255 & 168.94.255.254 - used for broadcast, if they belong to B Class? (The adresses were randomly chosen). I suppose 168.94.255.255 would rather be a broadcast adress, but I'm not sure. Thanks in advance!
A class B network in CIDR notation is a /16 network. A broadcast address is where all of the host bits are 1. In your case, the last 16 bits would need to be 1 to be a broadcast address.
168.94.254.255 and 168.94.255.254 each have a zero bit in the last 16 bits, so they are not broadcast addresses.
If your class B is subnetted into /24's, then the 168.94.254.255 address may be a broadcast address if 168.94.254.0/24 is the network address.

Resources