tcpdump(1) of IPv4 TCP connection (loopback)
tcpdump(1) of IPv6 TCP connection (loopback)
IPv4 socket structures
IPv6 socket structures
IPv4 Name Resolution
IPv6 Name Resolution
IPv4 | IPv6 |
32 bit addresses | 128 bit addresses |
'.' address element separator | ':' address element separator |
four elements of three digits (15) | eight elements of four hex digits (39) |
Typically a single IP address per interface | More than one IP address per interface |
CIDR (/xx) subnets for VLANs | /64 subnet for all VLANs |
Broadcasts for a variety of items | Multicasts addressed to specific functional groups |
n/a | DAD -- Duplicate Address Detection via ICMPv6 |
BOOTP -- Boot Protocol | SLAAC -- Stateless Auto-Address Configuration via ICMPv6 |
ARP -- Address Resolution Protocol | NDP -- Neighbor Discovery Protocol via ICMPv6 |
DHCP | DHCPv6 |
NAT -- Network Address Translation | Routable Addresses only |
IPv4 packet headerFrom RFC 791 September 1981:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| IHL |Type of Service| Total Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identification |Flags| Fragment Offset | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time to Live | Protocol | Header Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Options | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Go to Top of Page |
IPv6 packet headerFrom RFC 2460 December 1998:0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| Traffic Class | Flow Label | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Payload Length | Next Header | Hop Limit | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Source Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Destination Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Go to Top of Page |
listening on lo0, link-type NULL (BSD loopback), capture size 96 bytes 11:43:30.141126 IP 127.0.0.1.14245 > 127.0.0.1.23: Flags [S], seq 1899213868, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 7533732 ecr 0], length 0 11:43:30.141217 IP 127.0.0.1.23 > 127.0.0.1.14245: Flags [S.], seq 3809265911, ack 1899213869, win 65535, options [mss 16344,nop,wscale 3,sackOK,TS val 3742840880 ecr 7533732], length 0 11:43:30.141259 IP 127.0.0.1.14245 > 127.0.0.1.23: Flags [.], ack 1, win 8960, options [nop,nop,TS val 7533732 ecr 3742840880], length 0 ... 11:49:41.008987 IP 127.0.0.1.14245 > 127.0.0.1.23: Flags [F.], seq 173, ack 107, win 8960, options [nop,nop,TS val 7904657 ecr 3742841014], length 0 11:49:41.009075 IP 127.0.0.1.23 > 127.0.0.1.14245: Flags [.], ack 174, win 8960, options [nop,nop,TS val 3743211805 ecr 7904657], length 0 11:49:41.012735 IP 127.0.0.1.23 > 127.0.0.1.14245: Flags [F.], seq 107, ack 174, win 8960, options [nop,nop,TS val 3743211808 ecr 7904657], length 0 11:49:41.012896 IP 127.0.0.1.14245 > 127.0.0.1.23: Flags [.], ack 108, win 8959, options [nop,nop,TS val 7904661 ecr 3743211808], length 0Go to Top of Page
11:56:47.750525 IP6 ::1.49816 > ::1.23: Flags [S], seq 4281000056, win 65535, options [mss 16324,nop,wscale 3,sackOK,TS val 8331463 ecr 0], length 0 11:56:47.750636 IP6 ::1.23 > ::1.49816: Flags [S.], seq 3300695537, ack 4281000057, win 65535, options [mss 16324,nop,wscale 3,sackOK,TS val 220526000 ecr 8331463], length 0 11:56:47.750697 IP6 ::1.49816 > ::1.23: Flags [.], ack 1, win 8960, options [nop,nop,TS val 8331463 ecr 220526000], length 0 ... 11:57:10.519518 IP6 ::1.49816 > ::1.23: Flags [F.], seq 173, ack 107, win 8960, options [nop,nop,TS val 8354236 ecr 220526134], length 0 11:57:10.519632 IP6 ::1.23 > ::1.49816: Flags [.], ack 174, win 8960, options [nop,nop,TS val 220548773 ecr 8354236], length 0 11:57:10.523294 IP6 ::1.23 > ::1.49816: Flags [F.], seq 107, ack 174, win 8960, options [nop,nop,TS val 220548776 ecr 8354236], length 0 11:57:10.523486 IP6 ::1.49816 > ::1.23: Flags [.], ack 108, win 8959, options [nop,nop,TS val 8354240 ecr 220548776], length 0Go to Top of Page
IPv4 packet headerFrom FreeBSD 8.0:struct ip { #if BYTE_ORDER == LITTLE_ENDIAN u_int ip_hl:4, /* header length */ ip_v:4; /* version */ #endif #if BYTE_ORDER == BIG_ENDIAN u_int ip_v:4, /* version */ ip_hl:4; /* header length */ #endif u_char ip_tos; /* type of service */ u_short ip_len; /* total length */ u_short ip_id; /* identification */ u_short ip_off; /* fragment offset field */ #define IP_RF 0x8000 /* reserved fragment flag */ #define IP_DF 0x4000 /* dont fragment flag */ #define IP_MF 0x2000 /* more fragments flag */ #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ u_char ip_ttl; /* time to live */ u_char ip_p; /* protocol */ u_short ip_sum; /* checksum */ struct in_addr ip_src,ip_dst; /* source and dest address */ } __packed __aligned(4);Go to Top of Page |
IPv6 packet headerFrom FreeBSD 8.0:struct ip6_hdr { union { struct ip6_hdrctl { u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ u_int16_t ip6_un1_plen; /* payload length */ u_int8_t ip6_un1_nxt; /* next header */ u_int8_t ip6_un1_hlim; /* hop limit */ } ip6_un1; u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ } ip6_ctlun; struct in6_addr ip6_src; /* source address */ struct in6_addr ip6_dst; /* destination address */ } __packed;Go to Top of Page |
IPv4 socket structuresstruct sockaddr_in { uint8_t sin_len; sa_family_t sin_family; in_port_t sin_port; struct in_addr sin_addr; char sin_zero[8]; }; struct in_addr { in_addr_t s_addr; }; typedef uint32_t in_addr_t;Go to Top of Page |
IPv6 socket structuresstruct sockaddr_in6 { uint8_t sin6_len; /* length of this struct */ sa_family_t sin6_family; /* AF_INET6 */ in_port_t sin6_port; /* Transport layer port # */ uint32_t sin6_flowinfo; /* IP6 flow information */ struct in6_addr sin6_addr; /* IP6 address */ uint32_t sin6_scope_id; /* scope zone index */ }; struct in6_addr { union { uint8_t __u6_addr8[16]; uint16_t __u6_addr16[8]; uint32_t __u6_addr32[4]; } __u6_addr; /* 128-bit IP6 address */ };Go to Top of Page |
IPv4 Name Resolution Structuresstruct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ int h_addrtype; /* host address type */ int h_length; /* length of address */ char **h_addr_list; /* list of addresses from name server */ #define h_addr h_addr_list[0] /* address, for backward compatibility */ };Go to Top of Page |
IPv6 Name Resolution Structuresstruct sockaddr { unsigned char sa_len; /* total length */ sa_family_t sa_family; /* address family */ char sa_data[14]; /* actually longer; address value */ }; struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ int ai_family; /* PF_xxx */ int ai_socktype; /* SOCK_xxx */ int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ socklen_t ai_addrlen; /* length of ai_addr */ char *ai_canonname; /* canonical name for hostname */ struct sockaddr *ai_addr; /* binary address */ struct addrinfo *ai_next; /* next structure in linked list */ };Go to Top of Page |
|
IPv4 Name Resolution Functions#includeGo to Top of Page |
IPv6 Name Resolution Functions#includeGo to Top of Page |