From ArchWiki
Revision as of 06:58, 29 August 2012 by Sambul13 (Talk | contribs)

Jump to: navigation, search

netconsole is a kernel module that sends all kernel log messages (i.e. dmesg) over the network to another computer, without involving user space (e.g. syslogd). Name "netconsole" is a misnomer because it's not really a "console", more like a remote logging service.

It can be used either built-in or as a module. Built-in netconsole initializes immediately after NIC cards and will bring up the specified interface as soon as possible. The module is mainly used for capturing kernel panic output from a headless machine, or in other situations where the user space is no more functional.

Documentation is available in the Linux kernel tree under Documentation/networking/netconsole.txt

Build-in Configuration

netconsole and other modules Kernel parameters can be passed from a bootloader when starting the kernel by modifying bootloader configuration file. Such modification is bootloader type and version specific. Or they can be passed at runtime:

# set log level for kernel messages
dmesg -n 8


Dynamic configuration

# set log level for kernel messages
dmesg -n 8

modprobe configfs
modprobe netconsole
mount none -t configfs /sys/kernel/config

mkdir /sys/kernel/config/netconsole/target1
cd /sys/kernel/config/netconsole/target1

# set local IP address
echo > local_ip
# set destination IP address
echo > remote_ip
# find destination MAC address
arping `cat remote_ip` -f |grep -o ..:..:..:..:..:.. > remote_mac

echo 1 > enabled

netconsole should now be configured. To verify, run 'dmesg |tail' and you should see "netconsole: network logging started"


nc -u -l 6666


nc -u -l -p 6666