PCP: the gateway learns to answer back

For years, the home gateway was the Internet’s least accountable landlord. It held the public address, ran the NAT, and decided which inside services got a knock at the door. A host could hope; it could not ask. PCP—the Port Control Protocol, standardized in RFC 6887 in April 2013—changed the conversation by giving the host a formal request and the gateway a formal reply.

A host sends a PCP MAP request with a protocol, an internal port and, if it has a preference, a suggested external address and port. That suggestion is not a reservation. A successful response supplies the external address and port actually assigned, along with a lifetime set by the server. If the suggestion cannot be honoured, the normal outcome may be a different endpoint. Only a request carrying PREFER_FAILURE asks the server to fail instead of substituting another mapping.

That exchange is the protocol’s central allocation of authority. The client can state its need, renew it and ask for deletion. The gateway controls the translation or firewall state and answers within its own resources, quotas and policy. PCP’s result codes make the boundary visible: a request can be unsupported, unauthorized, over quota, short of resources, or impossible at the proposed external endpoint. A successful result is evidence of the mapping the server accepted—not proof that the host owns a public port.

The request is not the reservation

This is where PCP rewards close reading. The protocol is often described as host-driven, and in one sense it is: the host names the service it wants exposed and proposes a public port. But the operative words in the reply are “assigned” and “lifetime.” The gateway does not hand over a deed. It grants a mapping, watches the clock, and keeps the policy file.

The result codes are the paper trail of that asymmetry. NOT_AUTHORIZED says the request was understood and refused. USER_EX_QUOTA says the request was reasonable and the account is full. CANNOT_PROVIDE_EXTERNAL says the suggested endpoint is not available. None of these is a malfunction. They are the protocol admitting that the edge is a finite, governed place.

Nonce: a name tag, not a passport

PCP gives the request a 96-bit Mapping Nonce. The client chooses it; the server copies it into the response and uses it when validating later refreshes. Under the Simple Threat Model, a different nonce cannot casually seize an existing dynamic mapping. That is a useful lock on the door, but it is not a passport.

The nonce is deliberately narrower than identity. It correlates one mapping lineage with one PCP server. It does not authenticate a person, establish durable host identity or defeat an attacker who can observe and alter traffic on the path. In other words, the nonce tells the gateway “this refresh belongs to the same conversation.” It does not tell the gateway who the host really is.

The clock belongs to the gateway

Time is equally explicit. A client renews a mapping while it still needs it, and the response states how long the server will maintain it. A requested lifetime of zero has defined deletion meanings for MAP, with threat-model rules preventing it from becoming a universal eraser. The protocol therefore treats disappearance as ordinary state management, not an exceptional failure: stop renewing, delete correctly, or allow the lease to expire.

That design has a sharp operational consequence. A mapping is not a fact you install once and forget. It is a relationship you maintain. The host that treats the first successful response as permanent has misunderstood the protocol; the gateway that treats expiry as an error has misunderstood it too.

Epoch Time: a smoke alarm for state

The server’s Epoch Time addresses a different uncertainty. It advances in responses, but resets or becomes inconsistent when the server restarts, loses explicit mapping state, or undergoes certain address changes. A client that detects a suspicious jump or reversal promptly recreates its mappings. Epoch Time is therefore evidence about continuity of the server’s state. It cannot prove that packets were accepted throughout the interval, and it cannot restore the state by itself.

Think of it as a smoke alarm, not a fire extinguisher. It tells the client that the gateway’s memory may have broken. The client still has to do the rebuilding.

PEER, THIRD_PARTY, and the politics of who may ask

PEER applies the same custodial logic to an explicit outbound mapping tied to a remote peer. It can create or extend that state, and its remote-address fields make it more specific than MAP. THIRD_PARTY, meanwhile, shows that the source host is not always the beneficiary: an authorized client may act for another host only where server policy permits it. Consumer gateways are advised to prohibit such requests by default.

That last detail is easy to miss and hard to overstate. PCP does not merely ask “what mapping do you want?” It asks “who is allowed to ask for whom?” The answer is not in the packet’s enthusiasm. It is in the gateway’s policy.

RFC 7488 and the many-gateway problem

RFC 7488, published in March 2015, widened the operational picture. One PCP server may have several addresses, while one interface may lead to several independent PCP servers. A client tries addresses under a defined retry procedure, reuses a nonce across addresses of the same server, and uses different nonces for different servers. Requests to those servers do not share authority. They may produce several mappings, each maintained by a different device; a firewall path may require all of them when state is not replicated.

This is the point where a clean protocol exchange can conceal a messy topology. The host sees one request. The network may contain several gatekeepers, each with its own memory, policy and failure mode. RFC 7488 gives the client a procedure for finding them. It does not give the client a single owner to negotiate with.

What the record establishes

The protocol record establishes the request and response fields, server-set lifetime, nonce checks, result codes, recovery signal and server-selection behaviour. It supports an interpretation of PCP as negotiated custody of finite edge state.

What remains unknown

These RFCs do not measure adoption, certify any implementation, explain a particular gateway’s policy, or guarantee end-to-end reachability from every network. They also do not define how a client learns that a provisioned server address is legitimate; RFC 7488 leaves that security question to the provisioning mechanism.

Sources