forked from cminyard/ser2net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathser2net.conf
373 lines (348 loc) · 16 KB
/
ser2net.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
#
# This is an example configuration file for ser2net. It has the following
# format:
# <network port>:<state>:<timeout>:<device>:<options>
# network port
# Name or number of the TCP/IP port to accept con- nections
# from for this device. A port number may be of the form
# [ipv4,|ipv6,][tcp,|udp,][host,]port, such as
# 127.0.0.1,2000 or ipv4,tcp,localhost,2000. If the host is
# specified, it will only bind to the IP address
# specified. Otherwise it will bind to all the ports on the
# machine. If ipv4 or ipv6 is specified, it will only bind
# to that network type.
#
# For UDP port, any data received on the port from a remote
# source is considered a "connection" and the data for that
# port will go back to the remote source address. See the
# later section on UDP for details.
#
# state Either raw or rawlp or telnet or off. off disables
# the port from accepting connections. It can be
# turned on later from the control port. raw enables
# the port and transfers all data as-is between the
# port and the long. rawlp enables the port and
# transfers all input data to device, device is open
# without any termios setting. It allow to use
# /dev/lpX devices and printers connected to them.
# telnet enables the port and runs the telnet proto-
# col on the port to set up telnet parameters. This
# is most useful for using telnet.
#
# timeout
# The time (in seconds) before the port will be dis-
# connected if there is no activity on it. A zero
# value disables this function.
#
# device The name of the device to connect to. This
# must be in the form of /dev/<device>.
#
# options
# Sets operational parameters for the serial port.
# For a serial device (not IPMI SOL):
# Options 300, 1200, 2400, 4800, 9600, 19200, 38400,
# 57600, 115200 set the various baud rates. EVEN,
# ODD, NONE (MARK and SPACE if supported) set the parity.
# Note that MARK and SPACE are not available on all systems
# or hardware, if it is not supported then it will be
# silently set to ODD or EVEN parity.
# 1STOPBIT, 2STOPBITS set
# the number of stop bits. 5DATABITS, 6DATABITS,
# 7DATABITS, 8DATABITS set the number of data bits.
# [-]XONXOFF turns on (- off) XON/XOFF support.
# [-]RTSCTS turns on (- off) hardware flow control,
# [-]LOCAL turns off (- on) monitoring of the modem lines,
# and [-]HANGUP_WHEN_DONE turns on (- off) lowering the
# modem control lines when the connection is done.
# [-]NOBREAK disables automatic setting of the break
# setting of the serial port.
# The following speed may be available if your system
# has the values defined and your hardware supports
# it: 230400, 460800, 500000, 576000, 921600, 1000000,
# 1152000, 1500000, 2000000, 2500000, 3000000, 3500000,
# 4000000.
#
# SOL connections can take the following speeds: 9600, 19200,
# 38400, 57600, and 115200 and [-]NOBREAK. The following
# SOL-specific options exist: [-]authenticated enable
# (-disable) authentication on the link. [-]encrypted enable
# (-disable) encryption on the link. shared_serial_alert_fail
# fail the connection if the serial port is in use through
# hardware. shared_serial_alert_deferred if the serial port
# is already in use through hardware, wait until it is released.
# shared_serial_alert_deferred if the serial port is already in
# use via hardware, take over the connection.
# [-]deassert_CTS_DCD_DSR_on_connect deassert (- do not deassert)
# the given serial signals on a SOL connection. ack-timeout=n
# set the timeout for resending to n microseconds.
# ack-retries=n set the number of retries before failure to
# n times.
#
# The "[-]remctl" option allow remote control (ala RFC
# 2217) of serial-port configuration.
#
# A banner name, signature, open string and/or close
# stringmay also be specified.
#
# The rs485 option takes RS485 related configuration.
#
# The tw, tr, and tb options take a tracefile name (
# specified in TRACEFILE that will take all traced data.
# tw is data written to the device, tr is data read from
# the device, and tb is both.
#
# The telnet_brk_on_sync option causes a telnet sync
# operation to send a break. By default data is flushed
# until the data mark, but no break is sent.
#
# ser2net automatically waits the time it takes to receive
# 2 characters, or 1000us, whichever is larger, after receiving
# a character before sending data on the TCP port. This
# allows successive characters to be batched into a single
# send. You can disable this with disable-chardelay. Or
# you can change the receive time with chardelay-scale=n, which
# sets the delay in tenths of a character period (eg 20 is
# 2.0 periods, 15 is 1.5 periods, etc.) The default is 20.
# chardelay-min=n sets the minimum delay in microseconds,
# this is 1000 by default. chardelay-max sets the maximum
# delay before sending, in microseconds, default is 20000.
#
# The [-]kickolduser setting causes a new connection to
# terminate any existing connection.
#
# The "led-tx" and "led-rx" options allow to specify
# an LED defined above to trigger for traffic.
#
# ser2net can support more than one connection on a serial
# port by setting max-connections=<n>, where <n> is the
# maximum number of connections allowed. This interacts
# with some other features, see the man page for details.
#
# You can specify the allowed remote connections using
# remaddr=<addr>[;<addr>[;...]], where the addr is a
# standard address in the form (see "network port" above).
# Multiple addresses can be separated by semicolons, and you
# can specify remaddr more than once. If you set the port
# for an address to zero, ser2net will accept a connection
# from any port from the given network host.
#
# or...
#
# BANNER:<banner name>:banner
# This will create a banner, if the banner name is given in the
# options of a line, that banner will be printed. This takes the
# standard "C" \x characters (\r is carriage return, \n is newline,
# etc.). It also accepts \d, which prints the device name, \p,
# which prints the TCP port number, and \s which prints the serial
# parameters (eg 9600 N81), and a large number of date related
# items. See the man page for details.. Banners can span lines if
# the last character on a line is '\'. Note that you *must* use
# \r\n to start a new line.
#
# SIGNATURE:<signature name>:signature
# This will create a RFC 2217 signature, that will be sent on clients
# request.
#
# RS485CONF:<RS485 configuration name>:<RTS delay before send>:<RTS delay after send>:<RTS_ON_SEND>:<RX_DURING_TX>
# This will create a RS485 configuration set, i.e. RTS delays before and after send as
# also RTS logical level and receive configuration.
#
# TRACEFILE:<name>:filename
# This specifies a filename to trace output into, as tw=/tmp/trace1.
# This takes the same escape sequences as banners.
#
# LED:<name>:<driver>:<parameters>
# This specifies an LED which can be used to indicate tx/rx traffic
# on a port. At the moment, the only available LED driver is "sysfs" which
# uses Linux kernel's transient LED trigger.
# The LED is always kicked when traffic is detected on serial side.
# The "sysfs" driver knows about the following parameters which are:
# "device" - This is the directory name of the LED class device, e.g.
# if you want to use your keyboard's scrolllock LED and this
# LED is available as /sys/class/leds/input7::scrolllock, then
# you have to give "device=input7::scrolllock" here.
# "state" - Specifies the transient state of the LED (illuminated or not).
# "duration" - Specifies the flash pulse length in milliseconds.
# See Linux's documentation of the transient trigger for more details.
#
# OPENSTR:<name>:str
# This specifies a string to be transmitted to the device when the
# port is opened. This takes the same escape sequences as banners.
#
# CLOSESTR:<name>:str
# This specifies a string to be transmitted to the device when the
# port is close. This takes the same escape sequences as banners.
#
# CLOSEON:<stop pattern>
# This specifies a string that is compared to the data received
# from the serial device in raw mode. Whatever occurs first, match
# or timeout, will shutdown the port. This can be useful to close
# HTML transmissions from tiny Web Servers on a serial bus.
# C-style \ sequences, like \004 for ^D, \xff, or even \x00 can be used.
#
# CONTROLPORT:<port spec>
# Allow the control port to be specified in the config file.
#
# DEVICE:<name>:<device>
# Allows the string for a device to be specified on a separate line.
# Useful for big device names or device names that have a ":" in them.
# Just use <name> where you would have put the device filename.
#
# DEFAULT:<parm>:<default val>
# Allows default paramters to be specified that will affect all entries
# that follow this line. You can set the default in multple places
# to have different defaults in different areas of the file. See
# below for a list of defaults.
#
# ROTATOR:<port>:<port list>
# If you connect to the given port, this will rotate making a
# connection to the given port list (separated by spaces). A
# name in the port list must exactly match the TCP port string
# it represents. It will try successive ports until it finds a
# free one. The next time it will start on the port after the
# last one it tried. Note that the use of a rotator with a port
# with max-connections > 1 will result in undefined behavior.
#
# Note that the same device can be listed multiple times under different
# ports, this allows the same serial port to have both telnet and raw
# protocols.
#
# A '\' can be put at the end of any line to continue it to the next.
#
# UDP
#
# UDP handling is a bit different than you might imagine, because
# it's hard for ser2net to know where to send the data to. To
# handle this, UDP ports still have the concept of a "connection".
# If a UDP port is not connected, then if it received a packet the
# remote address for that packet is set to the remote end of the
# "connection". It will do all the normal new connection
# operations. ser2net will then ignore packets from other
# addresses until a disconnect occurs.
#
# Unfortunately, there is no easy way to know when to disconnect.
# You have two basic options:
#
# Set a timeout, if the remote end isn't heard from before the
# timeout, then the port is disconnected and something else can
# connect. This means anything that is using the port must
# periodically send a packet (empty is find) to ser2net to
# keep the connection alive.
#
# Use the kickolduser option on the port, any new connection that
# comes in will replace the previous connection.
#
# Note that UDP ports handle multiple connections just like TCP ports,
# so you can have multiple UDP listeners.
#
# You also have a third option. If you set a remote address
# (remaddr) with a non-zero port, ser2net will take one of the
# connections and assign it to that port permanently. This is
# called a fixed remote address. All the traffic from the device
# will go to that port. Every fixed remote address on a UDP port
# has to have a corresponding connection, so if you have 3 fixed
# remote addresses, you must have at least 3 connections.
BANNER:banner:Welcome to ser2net TCP port \p\r\n
BANNER:banner1:Welcome to ser2net TCP port \p device \d\r\n\
second line \
third line\r\n
BANNER:banner2:this is ser2net TCP port \p device \d\r\n\
second line \
third line\r\n
BANNER:banner3:this is ser2net TCP port \p device \d serial parms \s\r\n
SIGNATURE:signature1:ser2net port ttyS2
RS485CONF:rs485port1:0:0:0:0
#LED:rx:sysfs:device=duckbill:green:rs485 duration=20 state=1
#LED:tx:sysfs:device=duckbill:red:rs485 duration=20 state=1
TRACEFILE:tw1:/tmp/tw-\p-\Y-\M-\D-\H:\i:\s.\U
TRACEFILE:tr1:/tmp/tr-\p-\Y-\M-\D-\H:\i:\s.\U
OPENSTR:open1:Open str\r\n
CLOSESTR:close1:close str\r\n
# Don't do this by default
CONTROLPORT:localhost,2000
#CLOSEON:seq1:\004\x03\n
CLOSEON:closehtml:</html>
# Default value settings. The given values are the defaults. For non
# boolean values the possible values are given above.
#
#** serial device and SOL **
# speed: standard speeds shown above
#DEFAULT:speed:9600
# databits: 5,6,7,8
#DEFAULT:nobreak:false
#** serial device only **
#DEFAULT:databits:8
# stopbits: 1,2
#DEFAULT:stopbits:1
# parity: none, even, odd
#DEFAULT:parity:none
#DEFAULT:xonxoff:false
#DEFAULT:rtscts:false
#DEFAULT:local:false
#DEFAULT:hangup_when_done:false
#** all types **
#DEFAULT:remctl:false
#DEFAULT:telnet_brk_on_sync:false
#DEFAULT:kickolduser:false
#DEFAULT:chardelay:true
# chardelay-scale: 1-1000
#DEFAULT:chardelay-scale:20
# chardelay-min: 1-100000
#DEFAULT:chardelay-min:1000
#** SOL only **
#DEFAULT:authenticated:true
#DEFAULT:encrypted:true
#DEFAULT:ack-timeout:1000000
#DEFAULT:ack-retries:10
#DEFAULT:shared-serial-alert:fail
#DEFAULT:deassert_CTS_DCD_DSR_on_connect:false
#DEFAULT:net-to-dev-bufsize:64
#DEFAULT:dev-to-net-bufsize:64
#DEFAULT:max-connections:1
#DEFAULT:remaddr:
#192.168.27.3,2001:raw:600:/dev/ttyS0:9600 NONE 1STOPBIT 8DATABITS XONXOFF \
# LOCAL -RTSCTS
#2002:raw:600:/dev/ttyS1:9600 NONE 1STOPBIT 8DATABITS XONXOFF LOCAL -RTSCTS
2003:raw:5:/dev/ttyS2:9600
2004:raw:5:/dev/ttyS3:115200
2005:raw:5:/dev/ttyS4:9600
2006:raw:5:/dev/ttyS5:9600
2007:raw:5:/dev/ttyS6:9600 tw=tw1 tr=tr1
3001:telnet:0:/dev/ttyS0:19200 remctl banner1
3011:telnet:3:/dev/ttyS0:19200 banner2
#3002:telnet:0:/dev/ttyS1:9600
3003:telnet:0:/dev/ttyS2:9600 banner3
3003:telnet:0:/dev/ttyS2:9600 signature1 rs485=rs485port1
3004:telnet:0:/dev/ttyS3:115200
3005:telnet:0:/dev/ttyS4:9600
3006:telnet:0:/dev/ttyS5:9600 open1 net-to-dev-bufsize=128
3007:telnet:0:/dev/ttyS6:9600 close1 dev-to-net-bufsize=128
5001:rawlp:10:/dev/lp0
3020:telnet:0:/dev/ttyUSB0:115200 banner1 remctl telnet_brk_on_sync -chardelay \
open1 max-connections=3
udp,3020:raw:10:/dev/ttyUSB0:115200 banner1 remctl telnet_brk_on_sync \
-chardelay open1 max-connections=1
# Bind only to ipv4 example
#ipv4,3020:telnet:0:/dev/ttyUSB0:115200 remctl
# Bind only to ipv6 localhost example
#ipv6,::1:telnet:0:/dev/ttyUSB0:115200 remctl
# UDP connection, only allow connections from the given address, IPV4
#udp,3020:raw:10:/dev/ttyUSB0:115200 banner1 remctl telnet_brk_on_sync \
# -chardelay open1 max-connections=1 remaddr=ipv4,udp,100.2.3.4,0
# UDP connection, always connected to the given ipv4 port 4000
#udp,3020:raw:10:/dev/ttyUSB0:115200 banner1 remctl telnet_brk_on_sync \
# -chardelay open1 max-connections=1 remaddr=ipv4,udp,100.2.3.4,4000
# Only allow tcp connections from host otherserver
#3020:telnet:0:/dev/ttyUSB0:115200 remctl remaddr=otherserver,0
# A device file with ":" in it...
DEVICE:MyUSBPort:/dev/serial/by-path/pci-0000:00:1d.0-usb-0:1.8.2.2:1.0-port0
DEFAULT:speed:115200
3021:telnet:0:MyUSBPort:banner2 open1 close1 remctl closehtml \
chardelay-scale=15 chardelay-min=500 chardelay-max=10000 \
max-connections=2
# SOL connections
3022:telnet:0:sol.lan -U minyard -P test i-ipmi:115200 banner
3023:telnet:0:sol.lan -U admin -P admin t-crb8800-ipmi-1:115200 banner
ROTATOR:4001:3021 3022 3023
#5000:telnet:0:/dev/ttyAPP0:9600 NONE 1STOPBIT 8DATABITS -XONXOFF LOCAL \
# -RTSCTS led-tx=tx led-rx=rx