# # This is an example configuration file for ser2net. It has the following # format: # :::: # 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/. # # 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=, where 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=[;[;...]], 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. # # The default buffer size for ser2net is 64 bytes. If this # is not proper for you application, you can individually # set the buffers size for data from the net to the device # and data from the device to the net with the # net-to-dev-bufsize=N and dev-to-net-bufsize=N. # # or... # # BANNER::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 (the # actual device if you use the DEVICE command), \o (the device as # specified in the config line, before substituting the DEVICE), # \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 # This will create a RFC 2217 signature, that will be sent on clients # request. # # RS485CONF::::: # This will create a RS485 configuration set, i.e. RTS delays before and after send as # also RTS logical level and receive configuration. # # TRACEFILE::filename # This specifies a filename to trace output into, as tw=. # This takes the same escape sequences as banners. # # LED::: # 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::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::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: # 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: # Allow the control port to be specified in the config file. # # 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 where you would have put the device filename. # # DEFAULT:: # 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:: # 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 receives 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 fine) 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: # 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