Does anyone know how many host bits are needed to guarantee that a subnet could have 9 usable hosts?
I was thinking about around 4, but I'm not sure. Can some shed some light on this?
Two subnet addresses (all-ones and all-zeros) can't be used to indicate a host, so with N bits you get up to (2**N - 2) usable hosts. So, for 9 hosts, 4 bits is correct: it would do up to 14, but 3 bits would do only 6 hosts.
Here are networks that meet the requirement 192.168.1.0 /28
Mask:255.255.255.240 Host/Net - 14
Network Broadcast
192.168.1.0 192.168.1.15
192.168.1.16 192.168.1.31
192.168.1.32 192.168.1.47
192.168.1.48 192.168.1.63
192.168.1.64 192.168.1.79
192.168.1.80 192.168.1.95
192.168.1.96 192.168.1.111
192.168.1.112 192.168.1.127
192.168.1.128 192.168.1.143
192.168.1.144 192.168.1.159
192.168.1.160 192.168.1.175
192.168.1.176 192.168.1.191
192.168.1.192 192.168.1.207
192.168.1.208 192.168.1.223
192.168.1.224 192.168.1.239
192.168.1.240 192.168.1.255
We can calculate number of host bit by 2 methods:
We require 9 usable hosts
So converting 9 into binary we have 00001001.
Now,
128 64 32 16 8 4 2 1
0 0 0 0 1 0 0 1
count from right to left now, till the last on bit
so into 00001001 we have last on bit at 1
get the borrow bit till last on bit, that is 4
now for if we are calculating for class c , than the default subnet mask is
255.255.255.00000000
Now for calculation we off the bits where as for network we on the bit
so for host off 4 bits from right to left and on the rest left bits.
here 4 is the borrow bit that was calculated earlier
255.255.255.11110000
now taking only the last bit of subnet mask,
128 64 32 16 8 4 2 1
1 1 1 1 0 0 0 0
the increment value is 16
Note: increment value is calculated as last on bit from left to right.
so we will have a network of 128+64+32+16= 240
for class 'C' we have 192.168.1.0/28 or 192.168.1.0 255.255.255.240
number of host: 192.168.1.0
192.168.1.16
this is the first network, here we have 192.168.1.0 as network IP and 192.168.1.15 as broadcast IP
so from 192.168.1.1 to 192.168.1.14 are the usable IP or host that claculates to 14 usable host.
2nd method
we have the formula of claculating the host as 2^(n)-2
here n are off bits
from the 1st method we have number of off bit is 4
so 2^4 - 2= 16-2 = 14
hence we will get a slot of 14 usable host from which we can use 9
NOTE: The network class taken above is just an example which does not have any effect on increment bit calculation.Similarly we can calculate for class A and B
Related
I currently learn about TCP protocol and about 3 way-handshake. I cannot figure out how I can calculate the number of bytes transmited in this TCP session. I understand that in the first 3 and in the last 4 it's connection establishment and closing connection but between 4-11 I don't know to count the bytes
TCP session
Looking at frames 4 to 6 of your attachment:
172.20.1.21.1303 > 172.20.0.81.23: P 1:22(21) ack 1 win 65535
172.20.0.81.23 > 172.20.1.21.1303: P 1:13(12) ack 22 win 61299
172.20.1.21.1303 > 172.20.0.81.23: P 22:25(3) ack 13 win 65523
Frame 4 is from host A to B. The first number (1) after the 'P' flag is the (relative) sequence number of the first data byte of this segment, and the number in brackets (21) is the length of that segment in bytes.
Frame 5 is response from host B to A. The value after 'ack' (22) is host B telling host A that B has received bytes 1 to 21, and that it expects sequence number 22 next.
Frame 6 is the next segment from A to B. Sure enough, the sequence number is 22, which matches what B is expecting, and this time the length is 3 bytes.
If you then look at the final frames of the sequence, we can see in frame 12 that Host B has a sequence number of 1052, meaning it has sent 1052 bytes over the course of the connection (and the ack in frame 13 confirms this). Similarly, frame 14 shows that Host A sent 107 bytes (and the ack in frame 15 confirms this).
Given the following table, where the network is using 8-bit host addresses, I am asked to compute the associated range of destination host addresses for every interface. Then I am also asked about the number of addresses in every range.
Table:
prefix match Interface
00 0
010 1
011 2
10 2
11 3
I determined that I am given the prefixes of the 8-bit binary IP's and the concluded that:
00000000 to 00111111 (0-63 in decimal) uses interface 0
addresses in the range = 2 to the power of (8 - the number of bits in the prefix, so 2) = 64
01000000 to 01011111 (64-95 in decimal) uses interface 1
addresses in range = 2^(8-3) = 32
01100000 to 10111111 (96-191 in decimal) uses interface 2
addresses in range = 2^5 = 32
11000000 and higer (192+ in decimal) uses interface 3
addresses in range = 2^5 = 32
Is my reasoning correct?
The number of addresses in each range is 2(8 - prefixlen). So if the prefix has 2 bits, the number of addresses is 26 = 64.
I want to find a formula with it I can find the number of the communication that can occur at the same time (different combination) in f port router for network on chip.
In network on chip's router there are 5 port and each port has input and output.
5 is the maximum number of communication that can happen at the same time. Here an example:
input 1 -> output 2
input 2 -> output 3
input 3 -> output 4
input 4 -> output 5
input 5 -> output 1
I want to calculate how many combinaison I can have.
I could only figure out that the question is based on mathematics and has nothing to do with the networking and probability tags!
As you mentioned
In each port the input cannot communicate with other inputs and cannot communicate with the output in the same ports.
So, assuming one port communicating via input,
the port can communicate with only 4 output of other ports and not with the 4 input of the other ports and also not with the output of the same port.
So,net communication in this case while considering 5 inputs = 5*4 = 20.
Similarly,for the output case, the overall communications = 5*4 = 20.
Therefore,net communication done= 20 + 20 = 40.
If duplication while communicating is not considered(taken into account), then the total communication for input & output for all ports= 2 * 5 Combination 2 = 2 * 10 = 20.
I have this 3-axis dongle serial accelerometer connected using RS-232 cable. I am putting the baud rate as 9600 and im getting 80 XXXX-YYYY-ZZZZ readout per second. I am trying to justify why does it shows 80 readings in a second, and here is my calculation,
2 Bytes of data x (1 Start bit + 1 Stop bit + 8 bits) = 20 bits
20 bits x 3 axis x 80 readouts = 4800 bits
While im getting 4800 bits instead of 9600 bits, so i am wondering did i miss out anything in justifying the 80 readouts?
Thanks guys :)
You indicate that you're getting 80 XXXX-YYYY-ZZZZ readouts per second. I'm assuming this is ASCII, so each digit is one byte.
So each "message" is len('XXXX-YYYY-ZZZZ')*8 = 112 bits long. Add a start and stop bit and you have 114. Multiply that times 80 messages per second, and you're transmitting 9120 bits per second, which is much close to the theoretical limit.
I understand if two IP addresses are AND'd with a subnet mask if the result is the same then they are on the same network. If the result is different then they are on different networks. My question is, when given an IP address omitting some 0s where do the extra 0s get placed?
For example if the subnet mask is 255 . 128 . 0 . 0 , and you have IP 126 . 1 . 0 . 10 and IP 126 . 127 . 0 . 1 if you just blindly AND the IPs with the subnet mask you get different results even though they are on the same network.
Does 126.1.0.10 become 126.100.000.100 or 126.001.000.100?
EDIT after reading replies:
255128000000 AND 126001000010 = 1085496376*32* but 255128000000 AND 126127000001 = 1085276323*84*
Am I missing something?
IPv4 addreses are written as four ordinary decimal numbers (each fitting into a byte) separated by dots.
The ordinary decimal number 1 is "one", which can also be written 001. However 100 is a different number, namely "a hundred".
The AND operation is always a bitwise AND, so to understand it you must first see how the dotted-decimal address and netmask corresponds to a raw binary 32-bit address:
126 . 127 . 0 . 1
01111110 01111111 00000000 00000001
255 . 128 . 0 . 0
AND 11111111 10000000 00000000 00000000
-----------------------------------------------
01111110 00000000 00000000 00000000
126 . 0 . 0 . 0
So 126.127.0.1 with netmask 255.128.0.0 is in subnet 126.0.0.0/9
In software one usually stores IPv4 addresses in a single 32-bit variable -- so 126.127.0.1 is 01111110011111110000000000000001 binary (which also encodes 2122252289 decimal, except that nobody ever cares what the decimal value of a 32-bit IP address is), and it is converted to dotted-decimal only when it needs to be shown to human users. This representation is what glglgl decribes as multiplying by 256 several times.
If you also have the netmask in a 32-bit variable (11111111100000000000000000000000 binary or 4286578688 decimal), you can AND them in a single machine instruction to get the network address 01111110000000000000000000000000.
You are completely missing something: You don't just concat your digits together, because AND works on binary level.
So either you process the IPv4 addresses byte-wise, or you transform them into a decimal number, but not with factor 1000, but with factor 256.
This is to say, instead of doing
((126 * 1000 + 1) * 1000 + 0) * 1000 + 10 = 126001000010
you should do
((126 * 256 + 1) * 256 + 0) * 256 + 10 = 2113994762
. If you apply this to the other numbers, you should succeed.
Alternatively, you could AND together the 4 numbers separately, so
255 & 126 = 126 (in both cases), 128 & (1 resp. 127) = 0, 0 & (anything) = 0, 0 & (anything) = 0.
So you get 126.0.0.0 for both, making them belong to the same subnet.
Despite the fact that it's a rather odd question, I'll try answering your specific query:
The number '1' in that second octet is really a number 1, and therefore it's '001', not '100'.
That said, your example should have worked, so I suspect there's something wrong with your implementation. You should not need to worry about padding or anything. These are numbers, and bitwise-AND should "just work".
You might want to provide more detail about what is going wrong.