Hot answers tagged

77 votes

Why does DHCP use UDP and not TCP?

DHCP cannot use TCP as the transport protocol because TCP requires both end-points to have unique IP addresses. At the time a host is required to use DHCP, it does not have an IP address it can source ...
user avatar
  • 1,635
61 votes
Accepted

Does UDP do anything at all?

Interesting perspective and question! Yes, most of what UDP does is supply a standard means for multiple applications to co-exist using the same IP address, by defining the concept of UDP ports. The ...
user avatar
  • 5,153
48 votes

Why isn't UDP with reliability (implemented at Application layer) a substitute of TCP?

TCP is about as fast as you can make something with its reliability properties. If you only need, say, sequencing and error detection, UDP can be made to serve perfectly well. This is the basis for ...
user avatar
  • 15.9k
47 votes

Does UDP do anything at all?

UDP is a transport protocol, like TCP. That means it provides a protocol for an application to use IP. Like TCP, UDP has addressing (ports) to which applications bind so that datagrams destined to ...
user avatar
  • 92.9k
29 votes
Accepted

Why does one say IP fragmentation is bad and to be avoided when in reality data always needs to be fragmented for MTU compatibility?

Fragmentation is resource intensive in a router, and it slows packet forwarding. Today, we use PMTUD to determine the smallest MTU in the path so that packets are properly sized prior to sending. ...
user avatar
  • 92.9k
29 votes
Accepted

Why is Packet Size Limited?

Why we don't just send one single packet? why we need to split content into multiple pockets (ignoring size limit). That would just lead back to circuit-switched networks like the original PSTN (...
user avatar
  • 92.9k
25 votes

Why does DHCP use UDP and not TCP?

Since the source has no IP address (0.0.0.0) and the destination is everyone (255.255.255.255), it's hard to see how you would identify a particular session. But even if you could, what would be the ...
user avatar
  • 62k
23 votes
Accepted

What do TCP/UDP add to "raw ip"?

IP is a Layer 3 protocol. TCP/UDP are Layer 4 protocols. They each serve different purposes. Layer 3 is in charge of end to end delivery. Its sole function is adding whatever is necessary to a packet ...
user avatar
  • 13.9k
20 votes

Why does DHCP use UDP and not TCP?

There are multiple reasons why TCP wouldn't work for DHCP(v4.) First of all, TCP is connection-oriented. A TCP connection is defined between two particular hosts. However, when a DHCP client first ...
user avatar
  • 459
18 votes
Accepted

What does a UDP connection timeout really mean?

While there is no formal "connection" with UDP there is still a convention that clients send requests and expect to get responses back with the source IP and port swapped with the Destinatoin IP and ...
user avatar
  • 11.6k
17 votes
Accepted

Why No Source and Destination IPs in UDP Datagram?

Because you're looking at the UDP Datagram, which is the payload in an IP Datagram. The IP Header has the src/dst IP addresses.
user avatar
  • 29.5k
16 votes

PING port number?

I'd like to give you an additional answer especially to this part of the question: ... someone says ICMP uses Port 7 Port 7 (both TCP and UDP) is used for the "echo" service. If this service is ...
user avatar
14 votes
Accepted

How `UDP Hole Punching` Works?

Details vary but basically it goes something like. The two peers both open a UDP socket bound to a random local port The two peers both contact a server on the internet. This server responds and ...
user avatar
  • 11.6k
14 votes

Could IPv6 make NAT / port numbers redundant?

IPv6 does not have a NAT standard as IPv4 does (NAT breaks the end-to-end premise of IP, and IPv6 was designed to restore that). There is an experimental RFC for IPv6 NAT, but it is a one-to-one NAT ...
user avatar
  • 92.9k
14 votes

Does UDP do anything at all?

I would encourage you to look at how higher level protocols that utilize UDP actually use it. Classic and well documented examples are DNS (in most cases at least, it's possible to do DNS over TCP but ...
user avatar
13 votes

Is a DHCP offer packet a broadcast or unicast?

The answer is that it can be either broadcast or unicast - and in some cases both unicast and broadcast before it reaches the client when an ip helper-address is used. A client doesn't actually have ...
user avatar
  • 26.7k
13 votes
Accepted

Is a DHCP offer packet a broadcast or unicast?

Be aware of the broadcast flag, see RFC2131 (page 24): A client that cannot receive unicast IP datagrams until its protocol software has been configured with an IP address SHOULD set the ...
user avatar
13 votes

Why maximum length of IP, TCP, UDP packet is not suit?

IP protocol build on Ethernet or something, Why an IP packet can be 65535 bytes when Ethernet can only send 1500 bytes? Ethernet is one of several physical layers which can be used to to transport IP ...
user avatar
12 votes

How to verify that a UDP port is open?

UDP is obviously a send-and-forget protocol. For example, during an NMap UDP scan, the only way to definitively prove that a UDP port is open is if you receive a response from that port. Keep in mind ...
user avatar
  • 435
12 votes

How to verify that a UDP port is open?

This is a quick recipe: 1) Start a packet sniffer: sudo tcpdump -n -i eth2 icmp & [1] 1409 $ tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth2, link-...
user avatar
  • 1,616
12 votes
Accepted

Does a switch always get a MAC address from a PC?

A switch learns the source MAC from the sender. If the destination is not in the CAM table, the switch floods the frame out all ports. So if the receiver never responds, the switch will never learn ...
user avatar
  • 62k
12 votes

Why is Packet Size Limited?

In general there are several reasons to limit packet size. A larger packet has a longer transmission duration, which means it ties up the line for longer, increasing jitter for other (potentially ...
user avatar
  • 11.6k
11 votes
Accepted

How to know whether a protocol uses TCP or UDP

You asked a good question. Don't let anyone tell you otherwise. Regrettably, there is no rule of thumb for the types of protocols that use TCP verses the types of protocols that use UDP. The ...
user avatar
  • 13.9k
11 votes

What does a UDP connection timeout really mean?

Your firewall is maintaining a connection table for UDP connections. For example, when you send a DNS query, the firewall creates an entry for that flow so that the DNS reply will be allowed back ...
user avatar
  • 62k
11 votes

Why isn't UDP with reliability (implemented at Application layer) a substitute of TCP?

UDP with reliability can indeed be a substitute for TCP. We already have an example of it: it's called QUIC. From Wikipedia: Among other applications, QUIC improves performance of connection-...
user avatar
10 votes

Packet forwarding in TCP vs UDP

Transport of both UDP and TCP packets from one router to the next is done at the IP layer and solely based on the information at this layer. This means, that there is no distinction between UDP and ...
user avatar
10 votes
Accepted

Is rerouting possible in UDP?

This is not the hosts that decide which route a packet will follow, each router in the path make it's own decision. (Actually, the originating host could use the IP strict source option to force the ...
user avatar
  • 18.3k
9 votes
Accepted

Can two different applications bind the same port on a host if they use different protocols?

Think of it this way: TCP is one street, UDP is another street, and port numbers are the addresses of the houses (ports) on the streets, just as they are layer-4 addresses. Each street has the same ...
user avatar
  • 92.9k
9 votes
Accepted

How does UDP NAT Know When To Remove The Rule

A NAT router doesn't know when to remove a UDP mapping - it guesses. The router simply ages (or times) out the entry when it hasn't been used for a period of time (usually between 5 and 60 minutes). ...
user avatar
  • 69.6k

Only top scored, non community-wiki answers of a minimum length are eligible