210 likes | 342 Views
Advanced Higher Computing Computer Networking Topic 2: IP addressing and DNS. IP Address. An IP address is made up of 4 octets Each octet is a binary number in the range: 0000000 to 11111111 In practice 0 and 255 are reserved addresses so the range is: 00000001 to 11111110.
E N D
Advanced Higher ComputingComputer Networking Topic 2: IP addressing and DNS
IP Address • An IP address is made up of 4 octets • Each octet is a binary number in the range: 0000000 to 11111111 • In practice 0 and 255 are reserved addresses so the range is: 00000001 to 11111110
Classes of IP Address Class A: nnn.hhh.hhh.hhh 1st octet = 1 to 126 Class B: nnn.nnn.hhh.hhh 1st octet = 128 to 191 Class C: nnn.nnn.nnn.hhh 1st octet = 192 to 223 Class D nnn.hhh.hhh.hhh 1st octet = 224 to 239 Class E nnn.hhh.hhh.hhh 1st octet = 240 to 255 n = network h = host
Routing packets • Routers use the IP address of a packet to determine where to send it. • The router builds up a database of host IP addresses called a Forwarding Table
Why is the class system inefficient? • A tiny network would use up an entire block of Class C IP addresses • Any network with more than 254 hosts will need a block of Class B addresses • A large number of networks means that routing tables become very difficult to maintain
Subnet Masks • A mask tells a router which bits to examine and which ones to ignore • A 1 tells the router to treat that part of the address as the network identifier, a 0 signifies the host identifier
Subnet Masks Class C private address block Subnet mask 255.255.255.0 = 11111111. 11111111. 11111111. 00000000 The first 3 octets are the network address nnn. nnn. nnn. hhh Most home networks will use the range; 192.168.0.1 to 192.168.0.254
Subnet Masks Subnet mask 255.255.240.0 = 11111111. 11111111. 11110000. 00000000 Divides the network into 16 subnets nnn. nnn. 0. hhh nnn. nnn. 16. hhh nnn. nnn. 32. hhh etc
Subnet Masks 129.215.17.5 AND subnet mask 255.255.240.0 10000001. 11010111. 00010001. 00000101 11111111. 11111111. 11110000. 00000000 = 10000001. 11010111. 00010000. 00000000 = 129.215.16.0 so route this packet to subnet 16
Network AddressTranslation (NAT) A LAN uses the private IP range 192.168.0.1 to 192.168.3.254 (4 Class C blocks) The subnet mask will be 255.255.252.0 To route a packet: • look for an exact match (255.255.255.255) • look for a match using subnet mask • use default route (IP of proxy server)
Network AddressTranslation (NAT) Proxy server presents a single public IP address to the outside The proxy server relays IP requests and then sends the results back to the originating machine (which has a local private IP address)
Classless Inter-Domain Routing eg: 206.13.01.48/18 CIDR uses a standard 32 bit address but adds further information to specify how many bits are used to identify the network. In the above example the addition of /18 at the end of the address indicates that the first 18 bits are used to identify the network nnnnnnnn.nnnnnnnn.nnhhhhhh.hhhhhh
Classless Inter-Domain Routing • CIDR is a notation which combines the IP address with the Subnet in a single notation • 192.168.0.0 subnet mask 255.255.255.0 • Is equivalent to 192.168.0.0/24
Classless Inter-Domain Routing CIDR allows part of a Class B block to be allocated (or several contiguous Class C blocks to be allocated together) However CIDR fragments the address space making routing packets more complex
Domain Name Service (DNS) • The DNS maps host names to IP addresses • DNS is a hierarchy of servers which maintain the database. • These servers usually run Berkley Internet Name Domain (BIND)
Network Troubleshooting tools • ipconfig • route • ping • traceroute • nslookup