netconsole is used to print log information from the local host to a remote host, making it easy for remote users to view log information. As for how to configure Netconsole, online search an article, speaking more comprehensive, including the local host and remote server configuration. Reproduced here, although the English, but the understanding should not be difficult, will no longer translate. According to the parameter form of the Netconsole module in the paper, it should be applied to the 2.6 kernel.
Linux Configure netconsole to Log Messages over UDP networkLinux can is configured to log DMESG output to another system via network using Syslog. It is the done using kernel level networking stuff ia UDP Port 514. There is module called Netconsole which logs kernel PRINTK messages over UDP allowing debugging of problem where disk Logg ing fails and serial consoles are impractical. Most modern distro has this netconsole as a built-in module. Netconsole Initializes immediately after NIC cards. There are two steps to configure Netconsole:
SYSLOGDServer-let US assume 192.168.1.100 IP having fqdn-syslogd.nixcraft.in. Please note that the remote host can run either ' netcat-u-l-p <port> ' or syslogd. All other
Systems running Netconsolemodule in kernel
Step # 1:configure centralized syslogd
Login to Syslogd.nixcraft.in server. Open syslogd configuration file. Different Unix/linux variant have different configuration files Red hat/centos/fedora Linux configuration I f you are using Red hat/centos/fedora Linux open /etc/sysconfig/syslog file and set syslogd_options Option for UDP logging.
# Vi/etc/sysconfig/syslog
Configure syslogd option as follows:
Syslogd_options= "-M 0-r-X"
Save and close the file. Restart Syslogd, enter:
# service Syslog Restart debian/ubuntu Linux Configuration
If you are the using Debian/ubuntu Linux Open file /etc/default/syslogd set syslogd option for UDP logging .
# VI/ETC/DEFAULT/SYSLOGD
Configure syslogd option as follows:
Syslogd_options= "-R"
#/etc/init.d/sysklogd Restart FreeBSD configuration
If you are are using FreeBSD open /etc/rc.conf and set syslogd_flags option for UDP logging. Please note this FreeBSD by default accepts network connections. Please refer to Syslogd Mans page for more information. Firewall Configuration
You could need to the open UDP Port 514 to allow network login. Sample iptables rules to open UDP port 514:
mynet= "192.168.1.0/24"
Slserver= "192.168.1.100"
Iptables-a input-p udp-s $MYNET--sport 1024:65535-d $SLSERVER--dport 514-m State--state new,established-j ACCEPT
Iptables-a output-p udp-s $SLSERVER--sport 514-d $MYNET--dport 1024:65535-m State--state established-j ACCEPT step # 2:configure Linux netconsole
You are need to configure Netconsole service. Once This service started, your are allowed a remote syslog daemon to the record console is output from the local system. The local port number, that Netconsole module, would use 6666 (default). You are need to set the IP addresses of the remote syslog server to send messages.
Open/etc/sysconfig/netconsole file under Centos/rhel/fedora Linux, enter:
# Vi/etc/sysconfig/netconsole
Set syslogaddr to 192.168.1.100 (IP address of remote syslog server)
syslogaddr=192.168.0.1
Save and close the file. Restart Netconsole service, enter:
#/etc/init.d/netconsole Restart A Note about Debian/ubuntu Linux
Red Hat has netconsole init script. However, under Debian/ubuntu Linux, you are need to manually configure. Type the following command to start Netconsole by loading kernel netconsole module, enter:
# modprobe Netconsole 6666@192.168.1.5/eth0,514@192.168.1.100/00:19:d1:2a:ba:a8
Where, 6666-local Port 192.168.1.5-local system IP eth0-local System interface 514-remote syslogd UDP port 192.168 .1.100-remote syslogd IP 00:19:d1:2a:ba:a8-remote syslogd Mac
You can add above modprobe line to /etc/rc.local to load module automatically. Another recommend option is Create/etc/modprobe.d/netconsole file and append following text:
# echo ' Options netconsole netconsole=6666@192.168.1.5/eth0,514@192.168.1.100/00:19:d1:2a:ba:a8 ' >/etc/ Modprobe.d/netconsole how do I verify netconsole be logging messages over UDP network?
Login to remote syslog UDP server (i.e. 192.168.1.100 our sample SYSLOGD system), enter:
# tail-f/var/log/messages
/var/log/messages is default log file under many distributions to log messages. Refer to/etc/syslog.conf for exact location of your file. How does I use Nc/netcat instead of the messing with syslogd?
The
is called one minute configuration. You can easily get output on 192.168.1.100 without using SYSLOGD. All are have to do are run Netcat (NC) command, on 192.168.1.100:
$ nc-l-P 30000-u
Login to no other box, enter Command:
# modprobe Netconsole 6666@192.168.1.5/eth0,30000@192.168.1.100/00:19:d1:2a:ba:a8
Output should Start to appear in 192.168.1.100 from 192.168.1.5 without configuring or syslogd else. further readings: nc/netcat Command modprobe command netconsole documentation man pages NC, modeprobe