Ip Addressess
- Each address is 4 bytes long.
- Usually grouped in 4 sets of a byte each.
- 147.64.242.52
- Are issued to individuals and institutions by an ISP.
- Originally the network was divided into three "classes"
- Class A, or addresses with the first octet 1-126
- 10.x.x.x for example
- Class B or addresses 128-191 as the first octet
- The second octet is used as well.
- 147.64.x.x for example
- Class C or addresses with 192-223 in the first octet
- 198.23.42.x
- The second and third octets are part of the address as well
- Other (class D and E) had special uses but were very small.
- Some have special meaning
- 127.0.0.1 is the loopback address, hostname loopback
- 10.0.0.0 is the class A private network
- 172.16.0.0 is the class B private network
- 192.168.0.0 is the class C private network
- The last three should not be routed outside your network.
- And they will never be assigned
- Each machine on the net must have at least one unique ip address.
- Subnet Masks
- Are used to divide an ip address into two parts
- The network part
- The address of a machine.
- By the way, the machine can not be all 0s or all 1s
- A 1 in a netmask means that bit is assigned to the network address
- So a mask of 255.255.255.0
- Means that there are 24 network bits and 8 machine bits.
- 131.123.32.102
- 102 is the machine,
- 131.123.32 is the network
- In the classical model, a class C would have 254 machines (no 0 or 255)
- A class A netmask is 255.0.0.0
- A class B netmask is 255.255.0.0
- A class C netmask is 255.255.255.0
- But if you have a class B, there is no reason you can't further subdivide your network.
- This allows you to reduce traffic on a network
- And distribute control of your network.
- You just need a way to route between these networks.
- CIDR (classless inter-domain routing) notation
- It is hard to keep track of subnet masks that don't end on an octet boundary, so the custom is to add a /XX to represent the number of bits in the netmas.
- We use 255.255.254.00/23
- Which is 11111111.11111111.11111110.00000000
- This means we have 29-2 or 510 addresses.
- If we have a subnet mask of 255.255.255.192/26
- FF.FF.FF.1100 0000
- And our address is 199.43.58.x
- We have further divided our network into four subnets
- 199.43.58.0/26, (.00) with machines 199.43.58.1 to 199.43.58.62
- 199.53.58.64/26,(.01) with machines 199.43.58.65 to 199.43.58.126 (+64)
- 199.53.58.128/26, (.10) with machines 199.43.58.129 to 199.43.58.192 (+128)
- 199.53.58.192/26, (.11) with machines 199.43.58.193 to 199.43.58.255 (+192)
- Or we have four networks, with 62 machines each.
- Use of netmasks and addresses
- When a machine sees a packet
- It looks at the IP address
- If the network portion of the address (as determined by the machine's netmask) matches the network portion in the packet
- It further looks to see if the machine part matches its machine part, or if it is is all 1s.
- In either case, it receives the packet.
- If a router encounters a packet with an ip address for the network it is on, it does nothing.
- If a router encounters a packet with an ip address for another network, it does its best to send the packet on.