Install and Configure Netconsole on Ubuntu
Netconsole works as a module. It could transfer the system log message (dmesg) directly to networking interface device driver, so that the system log messages could be forwarded to another machine via network. We can use it to trace the disk request information and avoid interferences of writing the log itself to the same machine.
Requirement: Linux2.6 Kernel
In the following, we call “server” the machine sending log messages, and thus server needs to get netconsole module installed. We call “client” the machine receiving log messages.
Install netconsole module on “server”:
Before this, make sure you have downloaded the kernel source code. Then we do the following:
- % cd /usr/src/linux-2.6.xx
- % make menuconfig
- go through "device driver"->"networking support"->"netconsole(Experimental)", and set it as M, save it and return to terminal.
- go through "device driver"->"networking support"->"netpoll support…", and set it as *, save it and return to terminal.
- % make dep bzImage
- % make modules
- % make modules_install install
- % reboot
Configure Netconsole on the server:
First, we must make ensure that printk messages can be sent to terminal.
- sudo sysctl -w kernel.printk="8 4 1 7"
These values influence printk() behavior when printing or logging error messages. Some people say using “7 4 1 7″ is enough, but if you don’t see the expected results, you should try “8 4 1 7″.
Do the following to check if the values are successfully set:
- cat /proc/sys/kernel/printk
Now we should tell netconsole which network interface to use, and the address of the destination machine:
- % sudo /sbin/modprobe netconsole netconsole=6665@10.23.1.57/eth0,6666@10.23.1.56/00:15:17:4D:98:E0
In the above command, 10.23.1.57 is the server, and 10.23.1.56 is the client. eth0 tells netconsole to use Interface eth0 to send out information, and the MAC address of client is 00:15:17:4D:98:E0. Moreover, server port is 6665, and client is listening on port 6666.
Configure Netconsole on Client:
Procedures are much easier on the client. But you should configure the firewall (if you have it) to be able to listen on port 6666. Then do the following to start listening:
- sudo nc -ul 6666
Netconsole transmits with UDP packets, so you see the “-u” parameter for nc.
To test if this is all successfully configured, do the following on the server machine
- % sudo modprobe tun
You should now be able to see something on the client.
Recent Comments