How do i calculate the broadcast address for a given subnet without any calculators? - networking

Let's say you had to answer this question and can NOT write anything down or use any calculator as 99% of the solutions I see include one of these which are not possible in this scenario:
Find the broadcast address for 192.156.68.71/21

Related

Network mask unlogical response

I'm quite new a network learning, and when I was connected to a public network I was trying to play with the stuff that I learned.
So under mac OS X I tried the ifconfig command, and I looked closer to the eth0 response which returned at some point something like this "netmask 0xfffff000 broadcast 172.20.159.255".
My question is : if the mask is 0xfffff000 why the broadcast adress is not 172.20.15.255. Since the broadcast adress should be the one with only 1 in the part that is not associated to the mask (it should be 172.20.15.255).
Furthermore if we calculate the total number of adresses in our network according to the mask we get 16*16*16 which is 4096 but if we look at the broadcast adress returned we get 160*256 = 40 960 which is ten time more.
Thank you in advance for the ones who can help me.
Sorry if my english is not perfect I'm not a native english.
I just found my mistake after writing down the bits.
The answer you be 172.20.(15).255 if the bits in parenthesis are (00001111), but the part with the 0 can change and this is why our broadcast adress is the the one I expected to be is is in fact (1001|1111) which is 159 OK!

NAT64 embedded formats used by actual phone carriers

I'm refactoring some of my network code due to Apple's guidelines to support full IPv6 networks, and they state one reason for this is that carriers are starting to make the conversion.
When I test with Apple's NAT64 network, I see IPv4 addresses coming in mapped to IPv6 in the form:
64:ff9b::xxxx:yyyy
Based on the NAT64 spec, it seems there are other possibilities, but I am not sure if these are ever used.
I'm hoping that I can just assume the above format, but I would like to know what NAT64 mapping styles other phone carriers are using.
EDIT: I omitted an important detail from my original question - that I need to do some filtering based on IPv4 ranges in certain scenarios. So I need to be able to convert IPv6 to IPv4 for the addresses where that is possible.
There are many ways. Don't assume anything. Query the DNS64 and use what you get. Everything else will break.

Why are IP Addresses so different when searched for?

I am trying to geo-locate 500 or so IP Addresses. Several online services say that for, for example, 50 addresses, 50% are in California and the other 50% in Colorado.
How do you accurately geolocate an IP address and why are some of them so off?
Thanks!
Maybe this Question is what you're looking for:
How does IP geolocating work?
The Reason why some Addresses are concentrated on single points, could be that if for a specific IP Address no entry exists, they match it to a predefined point, for example the country or town the ISP belongs to.
There is no way to get real accurate information (as mentioned in the link).

How do IP Addresses Relate to Countries?

I have a general question about IP Addresses. I am not sure if this question is better suited for another S/O Network (like Server Fault), but I thought I'd ask it here.
I want to try to hone in on the relationship between an IP Address and a Country. Is it fair or accurate to say that an IP Address like 100.*.*.* relates to ISPs in the US solely or is it possible that one of the octets with the 100.*.*.* range gets assigned to other Countries?
I am looking for a way to relate IP Address ranges, at their highest level, to Countries on a one-for-one basis.
Thanks.
I don't think there's an explicit rule for that. Check here.
Strictly-speaking, it is my understanding that location roughly correlates with location via IPv4 address blocks. There's a Wikipedia reference for these here.
However, more often than not this isn't particularly accurate - from personal experience relying on these results in more false results than positive. Part of the problem is that these addresses tend to shift with time and use.
MaxMind offer a free geoIP database called GeoLite 2 (link here) which I've used on a few occasions to detect an IP's origin country with a really high success rate, you just have to make sure that you update the database fairly regularly to keep up-to-date.

Calculating IP address from the following statement

I would like to not be so specific with my question, but I do not understand it and would like to get some help. The statement says:
The interface should be addressed in the next (upwards) available /27
subnet in the 192.168.20.0/24 address space.
I do not understand what it means. I understand that:
192.168.20.0/24 would mean a subnet mask of 255.255.255.0, and the address range would be 192.168.20.0 - 192.168.20.255. But what does the statement mean with the next upward available /27 subnet in that address space?
The next /27 that's not used by something else. If 192.168.20.0/27 is available, take it. Otherwise, if 192.168.20.32/27 is available, take it. Otherwise, if 192.168.20.64/27 is available... etc. Which address within that subnet you should use, and how you determine what is "available" are both unclear from the context you gave, but probably provided somewhere.

Resources