bootp又称为引导程序协议,我们来简单了解一下这个协议以及他的用法。
1,BOOTP 请求和应答均被封装在 U D P数据报中 ;
2,B O O T P使用 U D P,且通常需与 T F T P协同工作;
3,B O O T P有两个熟知端口: BOOTP 服务器为67(50067), BOOTP 客户为68(50068),这两个端口一般是固定不变的。
tftp协议后续再介绍,现在我们先来了解一下bootp.
3,bootp的报文了解.
我们看上面的报文,可以看到目的地址为0xffffffffff, 即是广播报文,我们可以看到request报文和reply报文都是广播报文的,那么为什么呢(这里的端口是固定的)
IP数据报我们前面有了解过,这里不赘述了,整个报文结构如下 ,前面还有个以太网首部,即是
mac首部+ ip首部+udp首部 + udp报文。
bootp的udp报文数据结构分析:
报文分析
请求报文:
op = 01;
Htype = 01;
HLen = 06;
XID = 0x7d174686;
chaddr = 0x001ab6334401(00....)
sname = 0x74697661(0000....)
回应报文:
op = 02;
Htype = 01;
HLen = 06;
XID = 0x9d174686;
chaddr = 0x001ab6334401(00....)
sname = 0x74697661(0000....)
uint32 CIAddr; // 0x0000000
uint32 YIAddr;// 0x7e000101(126.0.1.1)
uint32 SIAddr; //0x7e000107(126.0.1.7)
uint32 GIAddr; // 0x00000
uint8 CHAddr[16]; 0x001ab6334401(000..)
char SName[64]; // 0x74697661(000..)
char File[128]; .//0x6669726d776172652e62696e(000..)
数据结构:
typedef struct
{
uint8 op; // The operation; 1 is a request, 2 is a reply.
uint8 HType;// The hardware type; 1 is Ethernet.
uint8 HLen;// The hardware address length; for Ethernet this will be 6, the length of the MAC address.
uint8 Hops;// Hop count, used by gateways for cross-gateway booting.
uint32 XID;// The transaction ID.
uint16 Secs; // The number of seconds elapsed since the client started trying to boot.
uint16 Flags;// The BOOTP flags.
uint32 CIAddr; // The client's IP address, if it knows it.
uint32 YIAddr;// The client's IP address, as assigned by the BOOTP server.
uint32 SIAddr; // The TFTP server's IP address.
uint32 GIAddr; // The gateway IP address, if booting cross-gateway.
uint8 CHAddr[16];// The hardware address; for Ethernet this is the MAC address.
char SName[64]; // The name, or nickname, of the server that should handle this BooTP // request.
char File[128]; // The name of the boot file to be loaded via TFTP.
uint8 Vend[64];// optional vendor-specific area; not used for BOOTP.
}bootp_pkt_t;