Difference between revisions of "Netconsole"

From ArchWiki
Jump to: navigation, search
(configure local IP address too)
Line 11: Line 11:
 
mount none -t configfs /sys/kernel/config
 
mount none -t configfs /sys/kernel/config
  
mkdir /sys/kernel/config/target1
+
mkdir /sys/kernel/config/netconsole/target1
cd /sys/kernel/config/target1
+
cd /sys/kernel/config/netconsole/target1
  
# set target IP address
+
# set local IP address
 +
echo 192.168.0.111 > local_ip
 +
# set destination IP address
 
echo 192.168.0.17 > remote_ip
 
echo 192.168.0.17 > remote_ip
# find remote MAC address
+
# find destination MAC address
arping 192.168.0.17 -f |grep -o ..:..:..:..:..:.. > remote_mac
+
arping `cat remote_ip` -f |grep -o ..:..:..:..:..:.. > remote_mac
  
 
echo 1 > enabled
 
echo 1 > enabled
Line 27: Line 29:
 
<pre>
 
<pre>
 
nc -u -l 6666
 
nc -u -l 6666
 +
</pre>
 +
or
 +
<pre>
 +
nc -u -l -p 6666
 
</pre>
 
</pre>

Revision as of 15:21, 10 February 2010

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). "netconsole" is a misnomer because it's not really a "console", more like a remote logging service.

netconsole 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

Dynamic configuration

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 192.168.0.111 > local_ip
# set destination IP address
echo 192.168.0.17 > 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"

Receiver

nc -u -l 6666

or

nc -u -l -p 6666