Skip to main content
41 votes

How do I create a UDP packet?

Your packet is completely valid, from the viewpoint of IP and UDP. If you expand the protocol details for Ethernet/IP/UDP in the lower pane of Wireshark, you will see that the packet is successfully ...
nanofarad's user avatar
  • 743
35 votes
Accepted

Are /dev/{udp,tcp} standardized or available everywhere?

This is a feature of the shell and not the operating system. So, for example,on Solaris 10 with ksh88 as the shell: % cat < /dev/tcp/localhost/22 ksh: /dev/tcp/localhost/22: cannot open However ...
Stephen Harris's user avatar
16 votes

How does netcat know if a UDP port is open?

Well I have different opinion: a:~# nc -luk 10.12.0.12 667 // listen on UDP port 667 b:~# nc -uv 10.12.0.12 667 // check if port is open nc: 10.12.0.12 (10.12.0.12) 667 [667] open I love ...
crashoverbike's user avatar
16 votes
Accepted

Why does the udp port not open?

A UDP port is considered open by nmap if a packet sent to this port results in a reply from this port. This, of course, means, that there needs to be some service running at the port. Port 1194 is ...
Steffen Ullrich's user avatar
16 votes

How do I create a UDP packet?

You can send them to Bash special aliases with redirection. From Bash manpages: /dev/tcp/host/port If host is a valid hostname or Internet address, and port is an integer port number or ...
ralz's user avatar
  • 1,996
12 votes
Accepted

How to receive UDP packet with 127.0.0.0/8 dst address in userspace

By default the Linux kernel enforces RFC 1812 when performing route validation on packets with such source or destination. Here are a few samples: IPv4: 1 2 3 4 5, ARP: 6. They all look about the same:...
A.B's user avatar
  • 37.1k
7 votes
Accepted

UDP or TCP hole punching to connect two peers (each one behind a router)

Sometimes the commands given in the question will work, but sometimes it won't. Here is the reason. Let's say: my computer IP on my local network: 192.168.1.10 my home public IP: 203.0.113.10 my ...
Basj's user avatar
  • 2,549
7 votes
Accepted

/dev/tcp/host/port, /dev/udp/host/port what kernel module is this?

As Jeff says, this is a feature implemented by Bash, not by the kernel. It’s only available to shell scripts or on the shell’s command line; other programs can’t open /dev/tcp/.... To implement this ...
Stephen Kitt's user avatar
7 votes
Accepted

Setting up UDP packets to two different destinations using iptables and PREROUTING

Simple userland tools First I would recommend using a dedicated tool running on server D that will listen for UDP packets, and will send a copy twice, one for A and one for B. This could be done for ...
A.B's user avatar
  • 37.1k
6 votes

Are /dev/{udp,tcp} standardized or available everywhere?

To add on, from the Bash Info node: Bash handles several filenames specially when they are used in redirections, as described in the following table. If the operating system on which Bash is ...
extremeaxe5's user avatar
  • 1,193
6 votes
Accepted

difference NFS proto and mountproto

In older NFS versions (v2 and v3) there are two distinct RPC services handled by separate software: the "MOUNT" protocol that's used only to obtain the initial filesystem handles from rpc....
u1686_grawity's user avatar
6 votes

What is the counterpart of telnet client for servers based on UDP?

Pedantically, a Telnet client is a client for the Telnet protocol, which is a TCP/IP-based protocol with no UDP-based equivalent. However, telnet programs are also commonly used with non-Telnet ...
Stephen Kitt's user avatar
5 votes

A program like nethogs for udp?

I compiled the last nethogs from the github repo and I found that they added UDP too: nethogs -h -C : capture TCP and UDP. just download the master folder from github and do make to test it...
Badr Elmers's user avatar
5 votes
Accepted

UDP receive buffer error

Lookup tpacket_rcv: it's in af_packet.c. AF_PACKET means tcpdump. It looks like someone else saw a problem triggered by tcpdump, without resolution: https://groups.google.com/forum/#!msg/mechanical-...
sourcejedi's user avatar
5 votes
Accepted

Measuring latency in a GStreamer pipeline

Nowadays GStreamer has really nice tracers mechanisms to measure latency as for the whole pipeline or for individual elements This is how this can be done with gst-launch env GST_DEBUG="...
CAMOBAP's user avatar
  • 240
5 votes
Accepted

UDP Packet drops

In Linux 5.4.66, the pseudo-file /proc/net/udp is generated by a function in net/ipv4/udp.c: int udp4_seq_show(struct seq_file *seq, void *v) { seq_setwidth(seq, 127); if (v == ...
Andy Dalton's user avatar
  • 14.2k
4 votes

Does /proc/net/udp count all drops that occur between ethernet plug and my app?

No. Packets can be lost before they are de-multiplexed into user sockets. This happens when the kernel is not able to read packets fast enough from the network card for some reason. Network cards ...
sourcejedi's user avatar
4 votes
Accepted

unbind port of crashed program

When a program has connections, and after you kill the process, a timeout can be defined for the port to linger. The involved kernel variables to change that timeouts are: From: Linux TCP Tuning /...
Rui F Ribeiro's user avatar
4 votes
Accepted

Unix Domain Socket with VM

In general Unix Domain Sockets cannot communicate between host OS and guest OS. Unix Domain Sockets are, like e.g. Named Pipes, bound to the OS kernel. If you open the same Unix Domain Socket file ...
cg909's user avatar
  • 7,222
4 votes
Accepted

Why does a UDP client send 1Gbit speed to 100Mbit server?

UDP is a “fire-and-forget” transport, so it doesn’t care what happens to packets once they’re sent. This means you can send at the egress rate of the source system, regardless of the characteristics ...
Stephen Kitt's user avatar
4 votes
Accepted

What UDP destination port(s) does mtr -u use?

TL;DR By default, it starts at 33000 and goes up. You can observe it if you run a network trace at the same time: tcpdump -i any -n host 8.8.8.8 & mtr -u --report -c 1 8.8.8.8 21:21:50.777482 IP ...
Patrick Mevzek's user avatar
4 votes

create a UDP to serial bridge with socat

echo server setup I used socat to set up a UDP echo server like this: echo server $ socat UDP4-LISTEN:54321,fork EXEC:cat echo client $ echo -n "hello" | nc -4u -w1 192.168.56.101 54321 hello ...
slm's user avatar
  • 372k
4 votes

Linux's Internet domain socket, transport protocols (TCP/UDP)'s socket and port

Sockets are an operating system API. This API lets applications on same or different systems communicate over the TCP and UDP (and other) protocols. UNIX domain sockets (not internet domain sockets as ...
Steffen Ullrich's user avatar
4 votes
Accepted

Ip address is of 32 bit, which means 4 bytes. Yet all answers to question on 13 root dns servers say otherwise

"... As each IPv4 address requires 32 bytes, having 13 servers uses 416 bytes, leaving up to 96 bytes for the remaining protocol information." The DNS protocol never transmits just plain IP addresses,...
telcoM's user avatar
  • 99.4k
3 votes

Why does the udp port not open?

You need to put this port rule to your router and forward it to your machine. (If that is a VPN application, there is, of course, no need for port-forwarding.) You need to configure whatever ...
Vlastimil Burián's user avatar
3 votes

TCP flows coexisting with UDP when using SFQ (stochastic fair queuing)

This is expected. SFQ enforces the fairness which TCP/TCP-friendly only approximate when contending for limited bandwidth. If some traffic should get more than its fair share, you need to classify ...
sourcejedi's user avatar
3 votes

Start a service on a network request (socket activation)

It is also possible to ask systemd to open a socket (whether TCP, UDP or unix AF) and then start a service when a connection is received. Since not all services are happy being passed existing sockets ...
DMCoding's user avatar
  • 211
3 votes
Accepted

Ubuntu - UDP Traffic on port 123

You state that I have stopped ntpd Then what you have been observing is nearly surely illegal activity. UDP/123 being a IANA-assigned port, it cannot be used by any other legitimate application: ...
MariusMatutiae's user avatar
3 votes

Redirecting specific UDP traffic?

This question has been answered on ServerFault: iptables forwarding between two interface Adapting the solution given there to your situation yields the following (NOTE: here we're forwarding from ...
igal's user avatar
  • 9,986
3 votes
Accepted

UDP port unreachable although process is listening

Due to the way that UDP "connections" work, this is expected behaviour. This is discussed in the nc6(1) man page ("UDP"), but is applicable to socat and nc as well: UDP support in netcat6 works ...
ErikF's user avatar
  • 4,107

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