]> git.karo-electronics.de Git - karo-tx-linux.git/blob - Documentation/networking/netconsole.txt
Merge remote-tracking branch 'arm-soc/for-next'
[karo-tx-linux.git] / Documentation / networking / netconsole.txt
1
2 started by Ingo Molnar <mingo@redhat.com>, 2001.09.17
3 2.6 port and netpoll api by Matt Mackall <mpm@selenic.com>, Sep 9 2003
4 IPv6 support by Cong Wang <xiyou.wangcong@gmail.com>, Jan 1 2013
5
6 Please send bug reports to Matt Mackall <mpm@selenic.com>
7 Satyam Sharma <satyam.sharma@gmail.com>, and Cong Wang <xiyou.wangcong@gmail.com>
8
9 Introduction:
10 =============
11
12 This module logs kernel printk messages over UDP allowing debugging of
13 problem where disk logging fails and serial consoles are impractical.
14
15 It can be used either built-in or as a module. As a built-in,
16 netconsole initializes immediately after NIC cards and will bring up
17 the specified interface as soon as possible. While this doesn't allow
18 capture of early kernel panics, it does capture most of the boot
19 process.
20
21 Sender and receiver configuration:
22 ==================================
23
24 It takes a string configuration parameter "netconsole" in the
25 following format:
26
27  netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
28
29    where
30         src-port      source for UDP packets (defaults to 6665)
31         src-ip        source IP to use (interface address)
32         dev           network interface (eth0)
33         tgt-port      port for logging agent (6666)
34         tgt-ip        IP address for logging agent
35         tgt-macaddr   ethernet MAC address for logging agent (broadcast)
36
37 Examples:
38
39  linux netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc
40
41   or
42
43  insmod netconsole netconsole=@/,@10.0.0.2/
44
45   or using IPv6
46
47  insmod netconsole netconsole=@/,@fd00:1:2:3::1/
48
49 It also supports logging to multiple remote agents by specifying
50 parameters for the multiple agents separated by semicolons and the
51 complete string enclosed in "quotes", thusly:
52
53  modprobe netconsole netconsole="@/,@10.0.0.2/;@/eth1,6892@10.0.0.3/"
54
55 Built-in netconsole starts immediately after the TCP stack is
56 initialized and attempts to bring up the supplied dev at the supplied
57 address.
58
59 The remote host has several options to receive the kernel messages,
60 for example:
61
62 1) netcat
63
64    On distributions using a BSD-based netcat version (e.g. Fedora,
65    openSUSE and Ubuntu) the listening port must be specified without
66    the -p switch:
67
68    'nc -u -l -p <port>' / 'nc -u -l <port>' or
69    'netcat -u -l -p <port>' / 'netcat -u -l <port>'
70
71 2) socat
72
73    'socat udp-recv:<port> -'
74
75 3) cancd
76
77    A daemon written specifically for netconsole that is good at capturing
78    output from many machines.  Using netcat for several machines either
79    interleaves output from all machines or requires the use of per-machine
80    ports.
81
82    https://git.kernel.org/cgit/linux/kernel/git/joern/cancd.git/
83    https://oss.oracle.com/projects/cancd/
84
85 Dynamic reconfiguration:
86 ========================
87
88 Dynamic reconfigurability is a useful addition to netconsole that enables
89 remote logging targets to be dynamically added, removed, or have their
90 parameters reconfigured at runtime from a configfs-based userspace interface.
91 [ Note that the parameters of netconsole targets that were specified/created
92 from the boot/module option are not exposed via this interface, and hence
93 cannot be modified dynamically. ]
94
95 To include this feature, select CONFIG_NETCONSOLE_DYNAMIC when building the
96 netconsole module (or kernel, if netconsole is built-in).
97
98 Some examples follow (where configfs is mounted at the /sys/kernel/config
99 mountpoint).
100
101 To add a remote logging target (target names can be arbitrary):
102
103  cd /sys/kernel/config/netconsole/
104  mkdir target1
105
106 Note that newly created targets have default parameter values (as mentioned
107 above) and are disabled by default -- they must first be enabled by writing
108 "1" to the "enabled" attribute (usually after setting parameters accordingly)
109 as described below.
110
111 To remove a target:
112
113  rmdir /sys/kernel/config/netconsole/othertarget/
114
115 The interface exposes these parameters of a netconsole target to userspace:
116
117         enabled         Is this target currently enabled?       (read-write)
118         dev_name        Local network interface name            (read-write)
119         local_port      Source UDP port to use                  (read-write)
120         remote_port     Remote agent's UDP port                 (read-write)
121         local_ip        Source IP address to use                (read-write)
122         remote_ip       Remote agent's IP address               (read-write)
123         local_mac       Local interface's MAC address           (read-only)
124         remote_mac      Remote agent's MAC address              (read-write)
125
126 The "enabled" attribute is also used to control whether the parameters of
127 a target can be updated or not -- you can modify the parameters of only
128 disabled targets (i.e. if "enabled" is 0).
129
130 To update a target's parameters:
131
132  cat enabled                            # check if enabled is 1
133  echo 0 > enabled                       # disable the target (if required)
134  echo eth2 > dev_name                   # set local interface
135  echo 10.0.0.4 > remote_ip              # update some parameter
136  echo cb:a9:87:65:43:21 > remote_mac    # update more parameters
137  echo 1 > enabled                       # enable target again
138
139 You can also update the local interface dynamically. This is especially
140 useful if you want to use interfaces that have newly come up (and may not
141 have existed when netconsole was loaded / initialized).
142
143 Miscellaneous notes:
144 ====================
145
146 WARNING: the default target ethernet setting uses the broadcast
147 ethernet address to send packets, which can cause increased load on
148 other systems on the same ethernet segment.
149
150 TIP: some LAN switches may be configured to suppress ethernet broadcasts
151 so it is advised to explicitly specify the remote agents' MAC addresses
152 from the config parameters passed to netconsole.
153
154 TIP: to find out the MAC address of, say, 10.0.0.2, you may try using:
155
156  ping -c 1 10.0.0.2 ; /sbin/arp -n | grep 10.0.0.2
157
158 TIP: in case the remote logging agent is on a separate LAN subnet than
159 the sender, it is suggested to try specifying the MAC address of the
160 default gateway (you may use /sbin/route -n to find it out) as the
161 remote MAC address instead.
162
163 NOTE: the network device (eth1 in the above case) can run any kind
164 of other network traffic, netconsole is not intrusive. Netconsole
165 might cause slight delays in other traffic if the volume of kernel
166 messages is high, but should have no other impact.
167
168 NOTE: if you find that the remote logging agent is not receiving or
169 printing all messages from the sender, it is likely that you have set
170 the "console_loglevel" parameter (on the sender) to only send high
171 priority messages to the console. You can change this at runtime using:
172
173  dmesg -n 8
174
175 or by specifying "debug" on the kernel command line at boot, to send
176 all kernel messages to the console. A specific value for this parameter
177 can also be set using the "loglevel" kernel boot option. See the
178 dmesg(8) man page and Documentation/kernel-parameters.txt for details.
179
180 Netconsole was designed to be as instantaneous as possible, to
181 enable the logging of even the most critical kernel bugs. It works
182 from IRQ contexts as well, and does not enable interrupts while
183 sending packets. Due to these unique needs, configuration cannot
184 be more automatic, and some fundamental limitations will remain:
185 only IP networks, UDP packets and ethernet devices are supported.