Port Numbers

What are UDP Port Numbers?

UDP port numbers identify specific applications or services on a host. Each port allows communication with a particular process or service.

Why are UDP Port Numbers useful?

They allow the operating system to route incoming UDP packets to the correct application, enabling multiple services to run simultaneously without interference.

How do UDP Port Numbers work?

UDP uses source and destination port numbers (16-bit each) in its header to send packets to the correct application. Ports range from 0 to 65535.

Where are UDP Port Numbers used?

Common UDP-based services use well-known ports:

  • 53 – DNS

  • 67/68 – DHCP

  • 123 – NTP

  • 161/162 – SNMP

  • 500 – IPsec

Which OSI layer do UDP Port Numbers belong to?

UDP port numbers are part of the Transport Layer (Layer 4), where data is directed to the correct application process.

Are UDP Port Numbers Windows specific?

No, port numbers are part of the standard networking stack and are used on all operating systems including Windows, Linux, and macOS.

Are UDP Port Numbers Linux specific?

No, UDP port numbers are universally used in all OS environments. Linux assigns and manages them just like other OSes.

Which transport protocol uses Port Numbers in this way?

Both UDP and TCP use port numbers, but UDP does so without the overhead of connections or reliability mechanisms.

Are UDP Port Numbers used in client-server models?

Yes. In a typical model, the server listens on a fixed port, and the client uses an ephemeral port to initiate the request.

  • In this section, you are going to learn

  • Terminology

  • Version Info

  • setup

Port Numbers - Testcases

S.No

Test Case

Description

Expected Result

1

Valid Port Range

Use port number between 065535

Packet accepted

2

Reserved Port Usage

Use reserved port (e.g., 53 for DNS)

Packet routed to correct service

3

Invalid Port Number

Use port > 65535

Packet rejected

4

Negative Port Number

Use negative port

Packet rejected

5

Port Number Zero

Use port 0

Packet accepted (source only)

6

Port Conflict

Use same port for multiple apps

Apps may share or conflict

7

Dynamic Port Allocation

Use ephemeral port

Port assigned dynamically

8

Static Port Assignment

Assign fixed port

Packet routed correctly

9

Port Reuse

Enable socket reuse

Multiple apps receive packet

10

Port Binding Failure

Bind to used port

Binding fails

11

Port Binding Success

Bind to free port

Binding succeeds

12

Port Filtering

Block specific port via firewall

Packet dropped

13

Port Forwarding

Forward port via NAT

Packet redirected correctly

14

Port Scanning Detection

Scan ports

Detection triggered

15

Port Range Scan

Scan range of ports

All open ports identified

16

Port with Broadcast

Send to broadcast address

Packet sent to all on port

17

Port with Multicast

Send to multicast group

Packet received by group on port

18

Port with Loopback

Send to loopback

Packet received locally

19

Port with IPv6

Use port with IPv6

Packet routed correctly

20

Port with IPv4

Use port with IPv4

Packet routed correctly

21

Port with DNS

Use port 53

DNS service responds

22

Port with DHCP

Use port 67/68

DHCP service responds

23

Port with SNMP

Use port 161

SNMP service responds

24

Port with TFTP

Use port 69

TFTP service responds

25

Port with NTP

Use port 123

NTP service responds

26

Port with RTP

Use port 5004

RTP stream received

27

Port with SIP

Use port 5060

SIP service responds

28

Port with Custom App

Use custom port

App receives packet

29

Port with Logging

Log port usage

Port logged correctly

30

Port with Monitoring Tool

Use sniffer

Port visible in capture

31

Port with Encryption

Encrypt payload

Port remains visible

32

Port with Compression

Compress payload

Port unaffected

33

Port with NAT Traversal

Use STUN/TURN

Port mapped correctly

34

Port with VPN

Send through VPN

Port preserved

35

Port with VLAN

Send on VLAN

Port used correctly

36

Port with QoS

Apply QoS

Port used for classification

37

Port with Load Balancer

Send through LB

Port used for routing

38

Port with Proxy

Send through proxy

Port preserved or translated

39

Port with TTL

TTL in IP header

Port unaffected

40

Port with Fragmentation

Fragment packet

Port info in each fragment

41

Port with Delay

Delay packet

Port info preserved

42

Port with Packet Loss

Simulate loss

Port info lost with packet

43

Port with Retransmission

Retransmit packet

Port info reused

44

Port with Bit Flip

Flip bit in port field

Packet misrouted or dropped

45

Port with Header Tampering

Modify header

Port info corrupted

46

Port with Logging Disabled

Disable logging

Port info not recorded

47

Port with High Traffic

Send many packets

Port handles load

48

Port with Low Traffic

Send few packets

Port remains open

49

Port with Timeout

Idle port

Port may close

50

Port with Error Handling

Send to closed port

ICMP error returned

  • Reference links