Title: p.1
1?? ????????????
NetGuru by NetSmooth Corporation
PART I TCP/IP????????/?NetGuru??
??? IP Address ? MAC Address ???
2Overview
- Internet Protocol
- IEEE 802?Ethernet
- MAC address
- ARP????
- ????
- ??2.1 ??ARP????
- ??2.2 Subnetting
- ??2.3 ??Subnet??????
- ??2.4 Supernetting
3Internet Protocol
4??
- IP (Internet Protocol )??????? RFC 791
- ???????????????,???????????,?????????????,??????(C
onnectionless)????? - ??? Packet ????(Routing), Packet
??(Fragmentation)??? (Re-assembly)
5??IP Address
- Internet Protocol Version 4
- ???????????????,??????????
- ? 32 Bits ??,?? 232 4,294,967,296 ???
- ???????????????
- ??????????????,???? Class
??????
6Class First Bits First Byte Values MAX of Hosts in its Subnet
A 0 0127 224-216,777,214
B 1 0 128191 216-265,534
C 1 1 0 192223 28-2254
D 1 1 1 224239 Reversed for multicast
E 1 1 1 1 240255 Reversed
7Netmask
- ???IP Address??,?????????netid
- ?192.168.1.96 / 27
8????
- netid
- ???IP??????IP??,????IP???????(netid)
- ?192.168.1.0 / 24 -gt 192.168.1.0
- broadcast
- ???IP???????IP,????IP???????(broadcast)
- ?192.168.1.0 / 24 -gt 192.168.1.255
9???IP Address - CIDR
- Classless Inter-Domain Routing
- ?? CIDR ?????? Class C ?????????? Class B
?????,????? - ? 222.77.235.0/21 ? 222.77.237.0/21
- 222.77.235.0 ? 11011110.1001101.11101011.0
- 222.77.237.0 ? 11011110.1001101.11101101.0
- ???????? 21 ?bit???,?????
10Subnetting
- ???????????????????
- ???Interior Routing Protocol
- ??172.16.0.0 / 16????B?????256?????
172.16.0.0 / 24 172.16.1.0 / 24
172.16.2.0 / 24 . .
. 172.16.255.0 / 24
??2.2 Subnetting
??2.3 ??subnet??????
11Supernetting
- ???????????????????
- ???Exterior Routing Protocol
- ???Routing Table?Entry?
- ??203.100.64.0 / 20(203.100.64.0
203.100.79.255)?16?C???????203.100.64.0/20???? - netid203.100.64.0
- range203.100.64.0 203.100.79.255
- netmask255.255.240.0
- broadcast203.100.79.255
??2.4 Supernetting
12Private Address
- ????,?????
- ??? Routing Information ?????????
- ??????? NAT(Network Address Translation)??????
- ??? Private Address ??
- 10.0.0.0 10.255.255.255(10.0.0.0/8)
- 172.16.0.0 172.31.255.255(172.16.0.0/12)
- 192.168.0.0 192.168.255.255(192.168.0.0/24)
13IP Protocol Header
14- Version(4 bits)
- IP Protocol ???,???IPv4,????IPv6
- Header Len(4 bits)
- IP Header ???(515),???5(??5420Bytes)
?5rows,4Bytes/row - Type of Service(8 bits) (????Differentiated
Services,RFC 3317, RFC 2474) - Precedence (3 bits)????????,???????
- D (1bit)??0?????,??1????(Low delay)
- T (1 bit)??0??????,??1??????(Throughput)
- R (1 bit)??0???Reliability ,??1???Reliability
- C (1 bit)??0???Cost,???1??Cost
- Unused (1 bits)???
15- Total Length(16 bits)
- ??? (IP header data ,576 65535 Bytes)
- ???Byte
- Identification????Datagram??,???????
- Flags
- Bit 0 reserved, must be zero
- Bit 1 (DF) 0 May Fragment, 1 Don't Fragment.
- Bit 2 (MF) 0 Last Fragment, 1 More
Fragments. Fragment Offset
16- Fragment Offset
- 0 8191 ( 213 -1)
- ?????????
- ?8 bytes???????
- ?????? 8192 8 65536 bytes
- Time to Live (TTL)
- ??????????
- ?????Router???????,??0??,??????(Discard)
????
17- Protocol
- 0??
- 1ICMP,Internet Control Message
- 2IGMP,Internet Group Management
- 5ST,Stream
- 6TCP,Transmission Control
- 8EGP,Exterior Gateway Protocol
- 9IGP,Any private interior gateway
- 17UDP,User Datagram
- ????? rfc1700 Assigned Numbers http//www.ietf.or
g/rfc/rfc1700.txt
????
18- Header Checksum
- IP Header ??????,?IP Header???16-bit?word??1??????
,??????,????Checksum? - Source IP Address
- ??IP??
- Destination IP Address
- ??IP??
- Options
- ?????
- Data
- ???????
19IP Header Checksum????
450000309ea4400080063ddd0385d348fe063b68a
???3??b68a?,3b68ab68d,??????1011 0110 1000
1101 ?????0100 1001 0111 0010
20IEEE 802 ? Ethernet
21IEEE 802 Ethernet ??
22IEEE 802
- Dst MAC ( Destination MAC Address)???????
- Src MAC (Source MAC Address)???????
- Len (Length)???????(??CRC)
23- 802.2 LLC (Logical Link Control)
- DSAP (Destination Service Access Point)
- SSAP (Source Service Access Point)
- Control(?????)
- 802.2 SNAP (Sub-network Access Protocol)
- Org Code
- Ether Type?????????
- CRC (Cyclic Redundancy Check)
- ?????
- Trailer
24Ethernet Encapsulation
25- Dst MAC (Destination MAC Address)???????
- Src MAC (Source MAC Address)??????
- Ether Type
- 0x0800(2048)IPv4
- 0x08DD(2269)IPv6
- 0x0806(2054)ARP
- 0x8035(32821)RARP
- Payload??????????
- CRC (Cyclic Redundancy Check)
- ?????
- Trailer
26??????MTU
- Maximum Transmission Unit
- Data-link layer????(payload)???????
- Network layer??Data-link layer??????????(fragment)
27MAC Address
28MAC Address
- ???????????????????????
- ??????????????,????????
- ?6? bytes ??,?0010F30328B0
- MAC Layer ???,??? Physical Layer ??
29MAC Address
- Broadcast Address
- FFFFFFFFFFFF
- Multicast Address
- 01005Exxxxxx
30Linux?? ifconfig
- ifconfig - ????????
- ??????????????????????????
- ??ifconfig eth0eth0 Link encapEthernet Hwaddr
5254ABED6F61 inet addr210.34.6.89
Bcast210.34.6.127 Mask255.255.255.128 UP
BROADCAST RUNNING MULTICAST MTU1500 Metric1 RX
packets46299 errors0 dropped0 overruns0
frame189 TX packets3057 errors0 dropped0
overruns0 carrier0 collisions0
txqueuelen100 Interrupt5 Base address0xece0
31?????Packet???
- ????????,????????
- Destination MAC Address??????MAC Address
- ????(Broadcast Address)
- ????(Multicast Address)
- ????? Promiscuous Mode ?
- Ethereal????Promiscuous Mode
32MAC Address ? IP Address
- ????? MAC Address ??????
- ? MAC Protocol ? MAC Address ????
- MAC Address ??????????
- ?? IP Address ?????
- IP Address ?????
- ???
- IPv4?? 32 Bits ???IPv6??128Bits??
33ARP?????
34ARP
- Address Resolution Protocol,RFC903
- ??????????????????ARP Table
- ???? IP ?????
- ????? ARP Table ???????? MAC Address
- ??,?? ARP ?????? MAC Address
- ??????????? MAC Address ????
35ARP?????
?Host A ?? Host B ? telnet ???? ARP ??
36ARP?????(1)
37ARP?????(2)
38ARP?????(3)
39ARP?????(4)
40ARP?????(5)
41Linux?? arp
- ????????? ARP Table,??????? ARP Table ????
??2.1 ??ARP????
42????
43IP MAC Address
- ???????Address ( IP , MAC)?
- IP Address
- IP Address???????,????????(Routing)
- ????,???????IP Address??????Domain
- MAC Address
- Ethernet??MAC Address????????????,????????,???????
?,???????????? - ???????????
44??????
45?????(Connectionless-oriented)
- ??????,?????????????????????????????????????,????
??,????????? - ????????????,?????????????????,???????????????,???
??????????????? - ??????????????????,???????????,???????????????????
????
46????(Connection-oriented)
- ?????????????,???????????????????????,????????????
??? - ??????????????,????????????,?????,?????????????,??
???????????????????????
??
47???
48?????? ???????
139127 026 025 024 123 022 121 120
49?????? ???????
139282 181 380
50?????? ????????
12304162 12161 14160
51?????? ??????????
??
52????
53IP Fragmentation????
- ????Unicast?Broadcast???????????????
- ??
- Step1 ??HostA?HostB?HostC?Ethereal
- Step2 ??HostA ping c1 s 2000
192.168.0.2 - Step3 ????ping?????????
??
54IP Header??Protocol????
- ??????ping
- ?????UDP
- Step1HostA?HostB????Ethereal
- Step2 HostA ??udpserver?? udpserver
- Step3 HostB??udpsend?? udpsend d
192.168.0.1 dport 9090 m Hello - Step4 ??protocol?????17 (0x11)
??
55????
- ??2.1 ??ARP????
- ??2.2 Subnetting
- ??2.3 ??subnet??????
- ??2.4 Supernetting
56?? 2.1 ??ARP????
- ????
- ??arp??
- ??ARP table???
- ??ARP table???????
- ??ARP table?????????
57?????
58Step 1??ARP table
- Host A
- ?? Ethereal ,interface?eth0,??????????
- Host A
- arp an
- ping 192.168.0.2
- ping 192.168.0.3
- ????arp an
- ??arp table???
- ????????ARP??????
59Step 2????ARP table
- Host A
- arp s 192.168.0.2 xxxxxxxxxxxx
- xxxxxxxxxxxx??MAC address(?MAC
address????????ARP table??) - ????arp an,??ARP table???
- ?????
- ????ARP table?,?MAC address?????????
- 192.168.0.3???????????????????????
- ????ARP table??????
??
60?? 2.2 Subnetting
- ????
- ??ifconfig????IP address?netmask
- ?????????????
- ??????????
- ??Network is unreachable?????
61?????
62Step 1 ??????
- Host A
- ifconfig eth0 192.168.0.1 netmask 255.255.255.192
- Host B
- ifconfig eth0 192.168.0.2 netmask 255.255.255.192
- Host C
- ifconfig eth0 192.168.0.254 netmask
255.255.255.192 - ??Host?????????
- Host A?B??192.168.0.0/26
- Host C??192.168.0.192/26
63Step 2 ??subnets????
- Host A
- ?? Ethereal ,interface?eth0,??????????
- ?Host A ping Host B?Host C
- arp an
- ping 192.168.0.2
- ping 192.168.0.254
- ???????
- ?????Host A, B, C????arp -an
- ??????
- ?????
- ???Host A ping 192.168.0.254?,?????ARP
entry???????ARP??? - ??Network is unreachable?????
??
64?????????
65?? 2.3 ??subnet???
- ????
- ??ifconfig????IP address?netmask
- ?????????????
- ??netmask???
66?????
67Step 1 ??????
- Host A
- ifconfig eth0 192.168.0.1 netmask 255.255.255.0
- Host B
- ifconfig eth0 192.168.0.2 netmask 255.255.255.192
- Host C
- ifconfig eth0 192.168.0.254 netmask
255.255.255.192 - ??Host?????????
- Host A??192.168.0.0/24
- Host B??192.168.0.0/26
- Host C??192.168.0.192/26
68Step 2 ??subnets????
- Host A
- ?? Ethereal ,interface?eth0,??????????
- Host A
- arp -an
- ping 192.168.0.2
- ping 192.168.0.254
- arp an
- ???????
- ???????????????
69- Host B
- ?? Ethereal ,interface?eth0,??????????
- Host B
- arp -an
- ping 192.168.0.1
- ping 192.168.0.254
- arp an
- ???????
- ???????????????
70- Host C
- ?? Ethereal ,interface?eth0,??????????
- Host C
- arp -an
- ping 192.168.0.1
- ping 192.168.0.2
- arp an
- ???????
- ???????????????
??
71?? 2.4 Supernetting
- ????
- ??ifconfig????IP?netmask
- ?????????????
72?????
73Step 1 ??????
- Host A
- ifconfig eth0 192.168.4.1 netmask 255.255.254.0
- Host B
- ifconfig eth0 192.168.4.2 netmask 255.255.254.0
- Host C
- ifconfig eth0 192.168.5.254 netmask 255.255.254.0
74Step 2 ?supernetting????
- Host A
- ??Ethereal,interface?eth0,??????????
- Host A
- arp -an
- ping 192.168.4.2
- ping 192.168.5.254
- arp -an
- ???????,?????
??