lecture[说明]tcp-ip_day2 国外大学课件

国外ip  时间:2021-05-05  阅读:()

TC P/IP

Binary, IP addre ssing

Binary Numbers

 When we look inside the packets sent across a TCP/IP network,most ofthe information isrepresented using the binary number syst'em.And in particular,when we discuss that globaladdressing system introduced earlier,we ll discover that tho se global addresses are in fact 32 bitbinary numbe rs.

 I find that the best way to introduce the binary numbering system is to learn to count in binary,andthat the best way to do that is to imagine a binary odometer.

 You all know about odometer's: they are the displays that show how many kilometers (or miles, ifyour car is old like mine)youve put on your car.

((count in decimal))

((use 8 digit odometer))

 Binary,unlike decimal (which has ten digits,0-9),has only two digits:0 and 1.So a binaryodometer will move a bit differently.

((count in binary))

((use 8 digit odometer))

((explain why–bytes))

 Now this odometer analogy is useful for a first introduction,and isn't too bad if all you needed toaccomplish was counting from zero(or perhaps identifying small binary numbers).

 But it would be tedious, to say that the least, to use this method to, e.g., identify the binaryrepresentation o f 25510,or determining the dec imal o f 101111012 .

Bina ry–decimal

 An easier method for converting from binary to decimal is to determine the value of a particular bitin the binary number,based on its placement in the number(sometimes called its significance). It's pretty easy to determine the value of any particular bit:

(1)The least significant (rightmost)bit has a value ofone

(2)Bit n=(n-1)*2

1 0 1 1 1 1 0 1

128 64 32 16 8 4 2 1

 To calculate the value of a binary=number, just add up the value of all the bits that are'on', i.e.,equal to one: 128+32+16+8+4+1 189

Decimal to binary

 It's not quite as simple to convert from decimal to binary. Here’s one way to do it:

(1)Find the first bit whose value is greater that the value of the decimal number your areconverting(2) If n is that bit found in(1), turn on the bit n-1, if n-1 exists,else go to(5)below

(3)Subtract the value of n-1 from the original decimal number;

(4)Return to(1), repeat using the value you obtained from the subtraction in(3)

(5)Set any other bits to zero

Example:222

X 1 1 0 1 1 1 1 0

256 12864 32 16 8 4 2 1

222-128=94

94-64=30

30-16=14

14-8=6

6-4=2

2-2=0

Global Addressing

 Recall from our introduction that a TCP/IP internet employs global addressing, i.e.,every'host'onan entire internetwork is uniquely identified by its address.

 Now since TCP/IP is designed to interconnect networks, the way in which the global addressesuniquely identify hosts is by

(1) identifying the network o f that ho st

(2) identifying the host on that network

 Conceptually, these global addresses operate something like the addressing in the followingdia gram:

A(2) B(2) C(2)

| | |

|----------|xx|-------------|xx|--------------|

| | |

A(1) B(1) C(1)

((Don't confuse this diagram with the similar one from the previous lecture,where we weredistinguishing local from global addressing.))

 Where the letter identifies the network,and the number identifies the host on that network. Notice that,considered in isolation,neither the network portion nor the host portion uniquelyidentifies the host–it is when taken together that this constitutes a global addressing system.IP addressing

 The protocol in the TCP/IP suite which specifies addressing is IP, the Internet Protocol. Although comparable to our alpha-numerical addressing in the above diagram, it's not quite ass imp le.

 Every'host' in a TCP/IP internet is identified by a 32 bit binary number.An example might be:10101101 11001011 11110000 10101011

 Now like our alpha-numerical addressing scheme,part of this 32 bit binary number identifies thenetwork,and part of it identifies the host on that network.

 What portion identifies each is not,however,completely fixed.We'll begin our explanation ofthisby considering the original IP address scheme:

Classful IP addressing

 In the original scheme,how a 32 bit IP address was divided into network portion and host portionwas based on the values of the first few most significant bits

Clas s A:0xxxxxx xxxxxxxx xxxxxxxx xxxxxxxxle ftmost byte network portion

Clas s B: 10xxxxxx xxxxxxxx xxxxxxxx xxxxxxxxle ftmost 2 byte s network portion

Clas s C: 110xxxxx xxxxxxxx xxxxxxxx xxxxxxxxle ftmost 3 b ytes netwo rk portio n

Clas s D: 1110xxxx xxxxxxxx xxxxxxxx xxxxxxxx

Clas s E: 1111xxx xxxxxxxx xxxxxxxx xxxxxxxx

Only Class A,B,C are important for now.

Dotted Decimal Representation

 Since this 32 bit representation isn't very digestable by humans,normally we refer to IP addressesin d ec imal, like this:

1. Break up the 32 bit IP addre ss into four 8 bit chunks.

2. Treating each ofthese'octets'as a separate number, translate them into a decimal

3. Separate each dec imal number from its ne ighbours with a dot

((couple of examples))

 And now we should be able to figure out the decimal representation of our three classes of internetaddre s se s:

ClassA:

00000000000000000000000000000000

-01111111 11111111 11111111 11111111

=0.0.0.0 andeverything

 127.255.255.255 inbetween

((ex amples))

ClassB:

10000000000000000000000000000000

- 10111111 11111111 11111111 11111111

=128.0.0.0

 191.255.255.255

 Back to the division into network and host portions: in the case of Class A the first decimal numberdesignates the network,wh' ile the next three can be seen as one big number,designating the host(i.e.,pretend the dots arent there).

 Class B, the first two, the net, the final two the host.

 Class C, the first three the net, the final one the host.

Special IP addresses

 Not every IP address in the 32 bit address space can be assigned to a ho st.

- If all the host bits in a particular Class A,B or C address are set to 0, this refers to the networkitse lf(e g, 192.168.1.0)

 If all the host bits are set to 1, then this refers to all the hosts on that network; this isreferred to as the directed broadcast address for that network

(e.g. 172.16.255.255)

(e.g. 10.255.255.255) these addresses can be routed.

 If all the bits in the 32 bit address are set to 1, this referred to as the limited broadcast

(255.255.255.255) this addres s cannot be routed.

 If all the net bits are set to 0; the'n in my'experience this is meaningless,unless the hostpart is also set to 0; this often refers to this host.

(used in DHCP as source address before the client receives an address lease)

(Linux interprets it as 'this ho st' in a ping, in fact it pings the loopback)

 Any address' in the C lass A network 127.0.0.0 refers to the'loopback' interface:a pseudointerface that doesn t rely on the existence of a physical network or even a Network InterfaceCard(NIC)for testing and software relying on a TCP/IP stack without a network connection.Address-space reserved for private Internets

ClassA: 10.0.0.0–10.255.255.255

ClassB: 172.16.0.0–172.31.255.255

Class C: 192.168.0.0–192.168.255.255

Subnetting

-The original class A,B and C addressing scheme isn't very flexible.

If you have a netwo' rk with about 250 hosts,a class C works pretty well,but if you have a networkwith far less, it s a waste of address space.

If you have a networ'k with about 65000 hosts,a class B works,but e.g., if your network has 300hosts,a class isnt going to work,and a class B is a waste.

Class A can accommodate over 10 million hosts.

-For these reasons, subnetting was specified. (RFC 950)

Subnet addresses

 RFC 950 discusses optionally subdividing the 32 bit address into three portions. In addition to:

1.A network portion

2.A hostportionthe standard specifies

 A subnetportion

-The general id' ea is that,even though an organization might control, say,a particular class B addressspace, it doesnt want just one single LAN or physical network.

-For example, the University of Calgary has 136.159.0.0,but it would probably want to create anumb er o f phys ical networks.

-The process of subnetting involves 'stealing' some number ofbits from the host portion, to designatethe subnet with.

-Bits must be stolen as a contiguous series starting from the most significant host bit. (RFC

950 recommendation.not mathematically required,but universally adhered to)Let's start with a simple example:

 Suppose you want to subnet the Class B network address: 172.16.0.0

 What you could do is use the third byte to refer to the subnet,and the last byte to refer to the host:

 172.16.10.26: subnet 10,host 26

 172.16.21.21 : subnet 21,host 21

 But,how are network hosts supposed to know what subnet they are on?

Remember,hosts can determine that they are on a class B network and what class B network theyare on,merely by inspecting their IP address.

 172.16.0.26 is class B(10xxxxx. . .)

 But they cannot determine their subnet by inspecting their address.

Subnet masks

 The way you specify a subnet is by adding more information,over and above the IP address. In addition,we must specify a subnet mask:

 A subnet mask is a 32 bit number,where all the network and subnet bits are set to 1,and allthe host bits are set to 0

 So inour example:

172.16.10.26

IP: 10101100.00011000.00001010.00011010sub mask: 11111111.11111111.11111111.00000000

4. This netmask determines the portion of the 32 bit number used to designate the subnet.-With this in mind, let's move onto a more complex example:

256(-2 for broadcast and net address)for hosts.So we had:

172.16.0.0, 172.16.0.1, 172.168.0.2, . . .

172.16.1.0, . . .

172.16.2.0, . . .

 But if the portion reserved for th'e subnet doesn't correspond to a byte,we pretty muchhave to work in binary(at least until we re more comfortable)

 Example:

 Suppose we have the Class C address 192.168.0.0,and we want 6 subnets.

11000000.10101000.00000000.00000000

11111111.11111111.11111111.11100000

(NB 2n=the number of possible values,where n=#bits)

Invalid subnetting

 RFC 950 suggests that a subnet designated by“all ones”or“all zeros”(in the subnet portion of theaddress) should not be used.So,e.g., the following would be invalid:

172.16.0.1 (255.255.255.0) ('all zeros')

172.16.255.1 (255.255.255.0) ('all ones')

 The r”eason this i's su'ggested is to preserve the interpretation of“all zeros”(meaning'this')and“allones (meaning all).

 Normally they are not thus interpreted,but sometimes they are interpreted as invalid. (Theproblem is ambiguity: in certain cases we cannot distinguish a reference to the(classful)networkitself,as opposed to a subnet on that network. For example,does 172.16.0.0 refer to the class Bnetwork itself,or to the all zeros subnet? Does 172.16.255.255 refer to the network broadcast,orthe all ones broadcast address?)

 There are a few other cases of invalid subnetting:

1. Borrowing a single bit. (we only get subnets 1 and 0,which RFC 950 recommends against)

2. Borrowing all the bits (no room left for hosts)

3. Borrowing all but one bit(leaves only subnet and broadcast addresses)

(There are cases where 3. is legitimate, in particular for point-to-point,non-broadcast links.)Determining local versus remote delivery

 Classful:

If(network address o f dst=network address o f src)Then( local delivery)

 Sub netted:

If(dst ip&netmask=src ip&netmask)

Then( local delivery)

B itwise'and'

0&0=1

1&0=0

0&1=0

1&1=1

建站选择网站域名和IP主机地址之间关系和注意要点

今天中午的时候有网友联系到在选择网站域名建站和主机的时候问到域名和IP地址有没有关联,或者需要注意的问题。毕竟我们在需要建站的时候,我们需要选择网站域名和主机,而主机有虚拟主机,包括共享和独立IP,同时还有云服务器、独立服务器、站群服务器等形式。通过这篇文章,简单的梳理关于网站域名和IP之间的关系。第一、什么是域名所谓网站域名,就是我们看到的类似"www.laozuo.org",我们可以通过直接记...

Megalayer(159元 )年付CN2优化带宽VPS

Megalayer 商家我们还算是比较熟悉的,商家主要业务方向是CN2优化带宽、国际BGP和全向带宽的独立服务器和站群服务器,且后来也有增加云服务器(VPS主机)业务。这次中秋节促销活动期间,有发布促销活动,这次活动力度认为还是比较大的,有提供香港、美国、菲律宾的年付VPS主机,CN2优化方案线路的低至年付159元。这次活动截止到10月30日,如果我们有需要的话可以选择。第一、特价限量年付VPS主...

DMIT(8.72美元)日本国际线路KVM月付8折起,年付5折

DMIT.io是成立于2018年的一家国外主机商,提供VPS主机和独立服务器租用,数据中心包括中国香港、美国洛杉矶和日本等,其中日本VPS是新上的节点,基于KVM架构,国际线路,1Gbps带宽,同时提供月付循环8折优惠码,或者年付一次性5折优惠码,优惠后最低每月8.72美元或者首年65.4美元起,支持使用PayPal或者支付宝等付款方式。下面列出部分日本VPS主机配置信息,价格以月付为例。CPU:...

国外ip为你推荐
重庆网通重庆联通现在有哪些资费???iphone连不上wifi苹果手机“无法加入网络”怎么办itunes备份怎么使用iTunes备份ipad上网ipad上网速度很慢怎么回事?360chrome360浏览器和谷歌chrome比哪个好用google图片搜索谁能教我怎么在手机用google的图片搜索啊!!!google图片搜索如何使用google图片搜索引擎?谷歌sb在谷歌里搜SB为什么结果中第一个是百度win7勒索病毒补丁我的电脑是windows7系统,为什么打不了针对勒索病毒的补丁(杀毒软件显联通合约机iphone5联通合约机iphone5和电信合约机Iphone5哪个好
手机网站空间 紧急升级请记住新域名 三级域名网站 com域名抢注 vpsio 轻博客 抢票工具 免费ddos防火墙 panel1 本网站在美国维护 hdd 上海服务器 银盘服务是什么 域名与空间 空间登入 万网注册 windowssever2008 美国主机 什么是dns 删除域名 更多