the IP range written in this way:
10.27.0.0/16
means that the address
10.27.24.152
is included?
Thanks a lot.
Luigi
Yeah, 10.27.24.152 is included in your IP range (between your host min and your host max), you can use tools like this one to check by yourself : http://jodies.de/ipcalc?host=10.27.0.0&mask1=16&mask2=
Related
This is what I have determined thus far on a test machine:
base address of ntoskrnl.exe is 0xFFFFF802C8803000
using IDA the address of the imagebase is 0x0000000140000000
using IDA the address of the function is 0x00000001401422D0
the offset (3 subtract 2) is determined to be 0x1422d0
the function address is determined to be 0xFFFFF802C8803000 + 0x1422d0 = 0xfffff802c89452d0
Windbg says the address is 0xfffff802c89454d0
Is the above calculations correct ? Please tell me what I'm doing wrong ?
Found the solution thanks to Neitsa. I was working with two different versions of ntoskrnl.exe one version for Windbg and the other version with IDA Free.
Through an accidental typo I've realized that when you try to reach the ip address 127.0.01 it will successfully route to 127.0.0.1.
Playing around with this, I've noticed that there seems to be some kind of translation happening. Some examples:
127.001 -> 127.0.0.1
127.002 -> 127.0.0.2
127.011 -> 127.0.0.9
127.111 -> 127.0.0.111
127.1111 -> 127.0.4.87
127.9999 -> 127.0.39.15
What's the logic behind these translations? I've tried and replicated this on MacOS, Linux and Windows.
From wikipedia:
When fewer than four numbers are specified in the address in dotted notation, the last value is treated as an integer of as many bytes as are required to fill out the address to four octets. Thus, the address 127.65530 is equivalent to 127.0.255.250.
You can do the calculation yourself to check.
Example:
127.9999 = 01111111. 00000000 00100111 00001111
= 127.0. 39. 15
this is the answer section of : dig supl.nokia.com
;; ANSWER SECTION:
supl.nokia.com. 82858 IN CNAME nokia.supl.svc.ovi.com.
nokia.supl.svc.ovi.com. 58 IN CNAME nokia.supl.svc.ovi.com.glb.as1248.net.
nokia.supl.svc.ovi.com.glb.as1248.net. 300 IN CNAME geo3.nokia.supl.svc.ovi.com.glb.as1248.net.
geo3.nokia.supl.svc.ovi.com.glb.as1248.net. 60 IN CNAME supl.nokia.us-east-1.pos.here.com.
supl.nokia.us-east-1.pos.here.com. 100 IN CNAME pra-suplnokia-516311011.us-east-1.elb.amazonaws.com.
pra-suplnokia-516311011.us-east-1.elb.amazonaws.com. 60 IN A 52.3.37.45
pra-suplnokia-516311011.us-east-1.elb.amazonaws.com. 60 IN A 52.22.201.16
I was expecting an IP address like what I got for : dig supl.google.com
;; ANSWER SECTION:
supl.google.com. 300 IN A 74.125.195.192
What is this list of servers I got for nokia?
It's a chain of CNAME pointers. If you look at the names on the right-hand side of the lines with "CNAME" in them, they are the same as the left-hand name on the following line, until you get to the final step where the right-hand name leads to two A records (which then hold the IP addresses you wanted).
Are this names of different servers? Or same one?
Also, some other DNS server returns in its answer only 3 CNAMEs (and not this whole list) and I see in wireshark for the 3rd CMANE :
nokia.supl.svc.ovi.com.glb.as1248.net: type A, class IN, addr 127.0.0.1
(So i get localhost as my query result and can not establish connection)
How can that be? Why does it return only 3 and not the whole list, like i got when i did 'dig' command?
Thanks
I need to work out the algorithm regarding how you calculate the network and host portion of an IP address.
Is the host ID the public part? Is the network ID the private part for locating the computer within the local network?
If the subnet mask is a value smaller than 255 the corresponding octet in the IP address must be broken down into binary to determine which part of the number is the host ID and which portion is the network ID. Is the result binary number always split in two?
(e.g. An IP address of 192.168.33.22 with a subnet mask of 255.255.224.0 means that the octet holding 33 be broken down as follows: 0010|0001 indicating that 0010 is the network ID portion and 0001 is the host ID portion?)
Thank you in advance for any help.
You're over-complicating things.
IPv4 addresses (and subnet masks) are merely displayed in dot-decimal notation simply as a means of making them more readable to humans. Within the computer, they are simply 4 bytes of contiguous memory (often stored, for example, within a long int):
Stored in computer: 11000000 10101000 00100001 00010110
Displayed for human: 192. 168. 33. 22
Stored in computer: 11111111 11111111 11100000 00000000
Displayed for human: 255. 255. 224. 0
The 1s in the mask indicate bits that identify the network, thus one merely need use a bitwise AND operation to extract the "network number":
address 11000000 10101000 00100001 00010110 192.168.33.22
mask 11111111 11111111 11100000 00000000 255.255.224.0
(AND) ----------------------------------- -------------
network 11000000 10101000 00100000 00000000 192.168.32.0
Since the introduction of CIDR (prior to which the address's class indicated the network/host boundary), hosts usually only know the mask of their own network and are therefore unable to divide arbitrary addresses (e.g. that of a datagram's destination) into network and host numbers.
So what's the point? Well, a source host can still take the bitwise AND of the destination's address and its (the source's) own network mask. Whilst the result of that operation will not necessarily produce a meaningful network number, it will match the source's network number if and only if they are on the same network:
if they match, the destination should be reachable at the link layer (e.g. by looking up its MAC address, perhaps via broadcasting an ARP request, and then encapsulating the datagram in a frame that is addressed to that MAC);
if they differ, the source must send the datagram to a router that is on its own network (using the above process to reach that router); the router will see that the frame is addressed to it, but that the datagram is not, and should then forward the datagram (encapsulated in a different frame) towards the destination. Many hosts only know of one router, their "default gateway", although other configurations are possible.
Those address bits that don't identify the source's network, evidently indicated by 0s in its network mask, can be considered to form its "host number"—although it's really neither meaningful nor useful to extract it in the same way as was done above: even when communicating with a host on one's own network, its full address is used for identification, never the host number alone.
That said, as a purely academic exercise it is of course possible to perform a bitwise AND with the complement of the mask:
address 11000000 10101000 00100001 00010110 192.168.33.22
~mask 00000000 00000000 00011111 11111111 0.0.31.255
(AND) ----------------------------------- -------------
host 00000000 00000000 00000001 00010110 0.0.1.22
So, to address your questions:
Is the host ID the public part? Is the network ID the private part for locating the computer within the local network?
The entire address is "public"; there are no "private" parts. Lookup protocols like ARP (which uses the full address) are used to locate computers within the local network.
If the subnet mask is a value smaller than 255 the corresponding octet in the IP address must be broken down into binary to determine which part of the number is the host ID and which portion is the network ID. Is the result binary number always split in two?
Nothing is "split in two". It only appears that way because dot-decimal notation was intended to make IPv4 addresses more readable to humans (albeit that decision was taken prior to the invention of CIDR, when network numbers were always aligned to byte boundaries and thus never caused the apparent "split" of a decimal number).
Is the host ID the public part? Is the network ID the private part for locating the computer within the local network?
The host and network portions of an ip address have nothing to do with public and private.
If the subnet mask is a value smaller than 255 the corresponding octet in the IP address must be broken down into binary to determine which part of the number is the host ID and which portion is the network ID. Is the result binary number always split in two? ...a subnet mask of 255.255.224.0 means that the octet holding 33 be broken down as follows: 0010|0001...
Your example is wrong. Specifically, you assume that 224 has four consecutive binary bits in it when you spit the 33 octet as 0010|0001 (where | is the division between network and host)...
The octet in the subnet mask containing 224 has three consecutive binary 1s in it: 11100000. Therefore the "network portion" of the whole IP address is: 192.168.32.0. The "host portion" of the ip address is 0.0.1.22. Using your notation, the third octet of ip 192.168.33.22 (mask 255.255.224.0) is: 001|00001.
To get the network portion of an IP address, you must perform a binary AND of the ip address and its netmask. The host portion is a binary AND of the inverted netmask (bits flipped between 0 and 1).
EDIT
Let's make another example to address your comment:
IP Address 192.168.255.22, NetMask 255.255.224.0
The network portion of this address is 192.168.224.0 and the host portion of the address is 0.0.31.22. I intentionally chose the numbers in the example to make the math as obvious as possible. Please convert 224 and 31 to binary, it should make things clear. If not, please reference the wikipedia article on subnetting
Host address portion and network address portion can be easily identified.
Use this trick.
Class A: N.H.H.H
Class B: N.N.H.H
Class C: N.N.N.H
(N= network H=Host)
Class A network range: 1-127
Class B network range: 128-191
Class C network range: 192-223
Reference: https://www.youtube.com/watch?v=ddodZeXUS0w
You can use the following script:
#!/bin/sh
GetNumericIP()
{
ipbin=0
for part in `echo $1 | awk -F'.' '{print $1 " " $2 " " $3 " " $4}'`
do
ipbin=`expr $ipbin \* 256`
ipbin=`expr $ipbin + $part`
done
echo "$ipbin"
}
GetSrtingIP()
{
ipbin=$1
count=0
while [ $count -le 3 ]
do
rem=`expr $ipbin % 256`
ipbin=`expr $ipbin / 256`
if [ -z "$ipstr" ]
then
ipstr=$rem
else
ipstr=`echo ${rem}.${ipstr}`
fi
count=`expr $count + 1`
done
echo $ipstr
}
mask=$2
maskbin=`GetNumericIP $mask`
ip=$1
ipbin=`GetNumericIP $ip`
networkid=$(( $maskbin & $ipbin ))
networkid=`GetSrtingIP $networkid`
echo "networkid = $networkid"
I'm trying to get the SIM number (ICCID, not IMSI) of my 3G Huawei E5830 modem using AT commands (also called Hayes command set).
Unfortunately, it's not specified in the modem formal documentation.
for sim900 AT+CCID
gives CCID.
e.g.89912200000280775659
The first two digits (89 in the example) refers to the Telecom Id.
The next two digits (91 in the example) refers to the country code (91-India).
The next two digits (22 in the example(MNC of IDEA)) refers to the network code.
Try "AT^ICCID?". tested on Huawei E173.
It works with AT+CRSM and also AT+CSIM.
AT+ICCID on galaxy S4 in modem mode.
AT+CICCID on an Iridium satellite modem.