blob: 3c2f2b3286385337ce5ec24afebd4699dd1e6e0a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001
2started by Ingo Molnar <mingo@redhat.com>, 2001.09.17
32.6 port and netpoll api by Matt Mackall <mpm@selenic.com>, Sep 9 2003
4
5Please send bug reports to Matt Mackall <mpm@selenic.com>
Satyam Sharma0bcc1812007-08-10 15:35:05 -07006and Satyam Sharma <satyam.sharma@gmail.com>
7
8Introduction:
9=============
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
11This module logs kernel printk messages over UDP allowing debugging of
12problem where disk logging fails and serial consoles are impractical.
13
14It can be used either built-in or as a module. As a built-in,
15netconsole initializes immediately after NIC cards and will bring up
16the specified interface as soon as possible. While this doesn't allow
17capture of early kernel panics, it does capture most of the boot
18process.
19
Satyam Sharma0bcc1812007-08-10 15:35:05 -070020Sender and receiver configuration:
21==================================
22
Linus Torvalds1da177e2005-04-16 15:20:36 -070023It takes a string configuration parameter "netconsole" in the
24following format:
25
26 netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
27
28 where
29 src-port source for UDP packets (defaults to 6665)
30 src-ip source IP to use (interface address)
31 dev network interface (eth0)
32 tgt-port port for logging agent (6666)
33 tgt-ip IP address for logging agent
34 tgt-macaddr ethernet MAC address for logging agent (broadcast)
35
36Examples:
37
38 linux netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc
39
40 or
41
42 insmod netconsole netconsole=@/,@10.0.0.2/
43
Satyam Sharmab5427c22007-08-10 15:33:40 -070044It also supports logging to multiple remote agents by specifying
45parameters for the multiple agents separated by semicolons and the
46complete string enclosed in "quotes", thusly:
47
48 modprobe netconsole netconsole="@/,@10.0.0.2/;@/eth1,6892@10.0.0.3/"
49
Linus Torvalds1da177e2005-04-16 15:20:36 -070050Built-in netconsole starts immediately after the TCP stack is
51initialized and attempts to bring up the supplied dev at the supplied
52address.
53
54The remote host can run either 'netcat -u -l -p <port>' or syslogd.
55
Satyam Sharma0bcc1812007-08-10 15:35:05 -070056Dynamic reconfiguration:
57========================
58
59Dynamic reconfigurability is a useful addition to netconsole that enables
60remote logging targets to be dynamically added, removed, or have their
61parameters reconfigured at runtime from a configfs-based userspace interface.
62[ Note that the parameters of netconsole targets that were specified/created
63from the boot/module option are not exposed via this interface, and hence
64cannot be modified dynamically. ]
65
66To include this feature, select CONFIG_NETCONSOLE_DYNAMIC when building the
67netconsole module (or kernel, if netconsole is built-in).
68
69Some examples follow (where configfs is mounted at the /sys/kernel/config
70mountpoint).
71
72To add a remote logging target (target names can be arbitrary):
73
74 cd /sys/kernel/config/netconsole/
75 mkdir target1
76
77Note that newly created targets have default parameter values (as mentioned
78above) and are disabled by default -- they must first be enabled by writing
79"1" to the "enabled" attribute (usually after setting parameters accordingly)
80as described below.
81
82To remove a target:
83
84 rmdir /sys/kernel/config/netconsole/othertarget/
85
86The interface exposes these parameters of a netconsole target to userspace:
87
88 enabled Is this target currently enabled? (read-write)
89 dev_name Local network interface name (read-write)
90 local_port Source UDP port to use (read-write)
91 remote_port Remote agent's UDP port (read-write)
92 local_ip Source IP address to use (read-write)
93 remote_ip Remote agent's IP address (read-write)
94 local_mac Local interface's MAC address (read-only)
95 remote_mac Remote agent's MAC address (read-write)
96
97The "enabled" attribute is also used to control whether the parameters of
98a target can be updated or not -- you can modify the parameters of only
99disabled targets (i.e. if "enabled" is 0).
100
101To update a target's parameters:
102
103 cat enabled # check if enabled is 1
104 echo 0 > enabled # disable the target (if required)
105 echo eth2 > dev_name # set local interface
106 echo 10.0.0.4 > remote_ip # update some parameter
107 echo cb:a9:87:65:43:21 > remote_mac # update more parameters
108 echo 1 > enabled # enable target again
109
110You can also update the local interface dynamically. This is especially
111useful if you want to use interfaces that have newly come up (and may not
112have existed when netconsole was loaded / initialized).
113
114Miscellaneous notes:
115====================
116
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117WARNING: the default target ethernet setting uses the broadcast
118ethernet address to send packets, which can cause increased load on
119other systems on the same ethernet segment.
120
Satyam Sharma8d4ef882007-08-10 15:31:19 -0700121TIP: some LAN switches may be configured to suppress ethernet broadcasts
122so it is advised to explicitly specify the remote agents' MAC addresses
123from the config parameters passed to netconsole.
124
125TIP: to find out the MAC address of, say, 10.0.0.2, you may try using:
126
127 ping -c 1 10.0.0.2 ; /sbin/arp -n | grep 10.0.0.2
128
129TIP: in case the remote logging agent is on a separate LAN subnet than
130the sender, it is suggested to try specifying the MAC address of the
131default gateway (you may use /sbin/route -n to find it out) as the
132remote MAC address instead.
133
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134NOTE: the network device (eth1 in the above case) can run any kind
135of other network traffic, netconsole is not intrusive. Netconsole
136might cause slight delays in other traffic if the volume of kernel
137messages is high, but should have no other impact.
138
Satyam Sharma8d4ef882007-08-10 15:31:19 -0700139NOTE: if you find that the remote logging agent is not receiving or
140printing all messages from the sender, it is likely that you have set
141the "console_loglevel" parameter (on the sender) to only send high
142priority messages to the console. You can change this at runtime using:
143
144 dmesg -n 8
145
146or by specifying "debug" on the kernel command line at boot, to send
147all kernel messages to the console. A specific value for this parameter
148can also be set using the "loglevel" kernel boot option. See the
149dmesg(8) man page and Documentation/kernel-parameters.txt for details.
150
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151Netconsole was designed to be as instantaneous as possible, to
152enable the logging of even the most critical kernel bugs. It works
153from IRQ contexts as well, and does not enable interrupts while
Matt LaPlante84eb8d02006-10-03 22:53:09 +0200154sending packets. Due to these unique needs, configuration cannot
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155be more automatic, and some fundamental limitations will remain:
156only IP networks, UDP packets and ethernet devices are supported.