Capture Kernel Logs Over the Network With netconsole
Send kernel messages as UDP packets to another host with netconsole, set it up at boot or run time, and receive crash logs that never reach disk.

A machine that panics often cannot write its last words anywhere useful. The disk may be the thing that failed, the serial port may not exist, and the journal is gone after the reset. Netconsole solves this by sending every kernel message as a UDP packet to another host, from inside the kernel, with no daemon and no disk involved. This post configures it on Linux 6.12 the three ways you will need, at module load, at boot and dynamically through configfs, shows how to receive and save the stream, and lists the limits. The reference is Netconsole.
What it is and what it needs
netconsole is a kernel module, or built-in code with CONFIG_NETCONSOLE=y, that registers as a console. Every message that would go to a console is also sent in a UDP datagram through a network driver. It works from the printk path, so it even carries messages from an oops or a panic, as long as the network driver can still transmit, because netconsole uses the polling mode of the driver (ndo_poll_controller or its modern equivalent) that does not need interrupts.
You need:
A network interface whose driver supports netpoll. Most Ethernet drivers do. Wireless interfaces and some virtual ones do not.
The sender's IP address and the receiver's IP address and, if the receiver is not on the same subnet, the MAC address of the gateway.
A receiver listening on a UDP port.
The log is not encrypted or authenticated. Use it on a trusted network, and never for messages that contain secrets.
The parameter format
All three methods share one syntax:
netconsole=[+][src-port]@[src-ip]/[dev],[tgt-port]@tgt-ip/[tgt-macaddr]| Field | Meaning | Default |
|---|---|---|
+ | Enable extended console messages with sequence numbers | Off |
src-port | Local UDP port | 6665 |
src-ip | Local IP address | The interface's address |
dev | Local network interface | eth0 |
tgt-port | Receiver's UDP port | 6666 |
tgt-ip | Receiver's IP address | Required |
tgt-macaddr | Receiver's MAC address, or the gateway's | Broadcast |
A sender at 192.168.1.20 on eth0, sending to a receiver at 192.168.1.10, with the receiver's MAC address:
[email protected]/eth0,[email protected]/aa:bb:cc:dd:ee:ffStart the receiver first
On the receiving host, listen on UDP port 6666 and save to a file. With the OpenBSD netcat, which most distributions ship:
nc -u -l 6666 | tee kernel-from-ticker-host.logWith ncat from the nmap package:
ncat -u -l 6666 | tee kernel-from-ticker-host.logSome netcat variants need nc -l -u -p 6666 instead, so check yours. Make sure the host firewall allows inbound UDP 6666. Alternatively, socat -u UDP-RECV:6666 - works, and a syslog-ng or rsyslog UDP input also accepts the stream.
Method 1: load the module at run time
On the machine you want to monitor:
sudo modprobe netconsole [email protected]/eth0,[email protected]/aa:bb:cc:dd:ee:ffThe module prints its own start-up line, and then every kernel message flows. Send one yourself to test:
echo "netconsole test" | sudo tee /dev/kmsgnetconsole testOn the receiver, a line appears:
netconsole testIf nothing arrives, check the checklist at the end. To see messages of all levels, raise the console loglevel first, since netconsole only forwards messages that pass it:
sudo dmesg -n 8Method 2: on the kernel command line
To capture messages from early boot, add the same string to the kernel command line, for example in the bootloader configuration, with the module built in or in the initramfs:
[email protected]/eth0,[email protected]/aa:bb:cc:dd:ee:ff loglevel=8When netconsole is built in, it initializes after the network device appears, so messages from before that point are not sent, though they are replayed from the ring buffer on registration. For problems that happen before the network driver loads, you need a serial console or the early console parameters from the earlycon post. For a system that boots from an initramfs, the module must be included in it and loaded early, or built in.
Method 3: dynamic targets with configfs
Since Linux 2.6.36, netconsole supports multiple targets created at run time through configfs, without reloading anything. Load the module without parameters, then build a target in the configuration tree:
sudo modprobe netconsole
sudo mount -t configfs none /sys/kernel/config 2>/dev/null
cd /sys/kernel/config/netconsole
sudo mkdir target1
cd target1
echo eth0 | sudo tee dev_name
echo 192.168.1.20 | sudo tee local_ip
echo 192.168.1.10 | sudo tee remote_ip
echo 6666 | sudo tee remote_port
echo aa:bb:cc:dd:ee:ff | sudo tee remote_mac
echo 1 | sudo tee enabledeth0
192.168.1.20
192.168.1.10
6666
aa:bb:cc:dd:ee:ff
1The enabled file is the commit step, as in the configfs how-to: the attributes cannot be changed while it reads 1. Disable with echo 0 | sudo tee enabled to change a setting, and remove the target with rmdir. A second mkdir target2 adds another receiver. The extended attribute turns on the extended message format. This method is the one to script: a service unit can create the target at boot.
Extended format
The leading + in the parameter, or extended in configfs, makes netconsole send each message with a header that carries the level, sequence number, timestamp and flags, followed by the text:
6,1704,5120331204,-;ticker: fifo overrun
SUBSYSTEM=misc
DEVICE=+misc:tickerThe fields before the semicolon are the syslog level and facility, the sequence number, the timestamp in microseconds, and a continuation flag. Continuation lines carry key-value metadata. Sequence numbers let a receiver detect lost packets, which matters because UDP does not guarantee delivery. Scripts that process the stream can use them to report gaps.
Making it survive a crash
A panic is the case netconsole is mostly used for. Three things improve your odds of capturing everything:
Set the loglevel high so the whole oops text, which is printed at emergency or alert level, always passes, and
ignore_loglevelmakes sure nothing is filtered.Configure a reboot delay with
panic=30to give the packets time to leave, or none if you want the machine to halt with the log intact on the receiver.Use the extended format to spot gaps in the received stream.
A test you should do on a development machine before you need it: trigger a controlled panic and confirm the full report arrives. With magic SysRq enabled, echo c | sudo tee /proc/sysrq-trigger crashes the machine on purpose. The post on SysRq warns about this one. Use a test machine, because this is a real crash.
Limits and failure modes
Packet loss. UDP drops under load, and a burst of messages from a faulting machine can exceed what the network driver can send in polling mode. A serial console is more reliable but slower.
Driver support. If the interface does not support netpoll, enabling fails with
netpoll: ... doesn't support pollingindmesg. Use another interface or a serial console.No messages before the network is up. Boot-time messages before the driver loads come out in a burst when it registers, or not at all for the earliest ones.
Routing. For a receiver on another subnet, give the gateway's MAC as
tgt-macaddr. The kernel does not run ARP at crash time.Bridge and VLAN interfaces. Netconsole on a bridge or bonded device is supported on current kernels, but the physical device underneath must also support polling.
Security. Anyone on the path can read the messages. Keep the receiver on a management network.
Troubleshooting checklist
| Symptom | Check |
|---|---|
modprobe fails, "Invalid argument" | A syntax error in the netconsole= string, or a missing interface |
| Module loads, no packets arrive | Receiver firewall, wrong target MAC, wrong subnet |
| Only high-severity messages arrive | Console loglevel is low; run dmesg -n 8 |
| Packets arrive, but with gaps | Use the + extended format and check sequence numbers |
| Works until the interface goes down | The target is tied to the interface; netconsole re-enables when it returns, or disable and recreate the target |
Dynamic target enabled refuses | A required field is empty; set dev_name, remote_ip and, where needed, remote_mac |


