Raw Socket Transport

Raw Socket Transport transports streams of characters from one serial interface to another over an IP network for utility applications.

This document describes Raw Socket Transport for the IR8340 and provides a reference section describing the Raw Socket Transport commands.

This document includes the following sections:

Information About Raw Socket Transport

Raw Socket is a method for transporting serial data through an IP network. The feature can be used to transport Supervisory Control and Data Acquisition (SCADA) data from Remote Terminal Units (RTUs). This method is an alternative to the Block Serial Tunnel (BSTUN) protocol.

Raw Socket Transport supports TCP or UDP as the transport protocol. An interface can be configured to use either protocol but not both at the same time. TCP transport is suitable for applications such as control applications that require acknowledged and sequenced delivery of data. For latency-sensitive applications such as line SEL relays, UDP transport provides faster transport of serial data than TCP.

Raw Socket Transport supports the following for the asynchronous serial interface:

  • TCP as the transport protocol, with built-in auto TCP connection retry mechanism.

  • Up to 32 TCP sessions and 32 UDP sessions.

  • Interface configuration as a server, client, or a combination of both.

  • One server interface, but multiple clients.

  • VRF-awareness, which enables the router to send Raw Socket Transport traffic to a server host connected through a Virtual Private Network (VPN) Virtual Routing and Forwarding (VRF) interface.

This section includes the following topics:

TCP Transport

TCP Raw Socket transport uses a client-server model. At most one server and multiple clients can be configured on a single asynchronous serial line. In client mode, the IR8340 can initiate up to 32 TCP sessions to Raw Socket servers, which can be other IR8340 routers or third-party devices.

The following figure shows a sample Raw Socket TCP configuration. In this example, serial data is transferred between RTUs and a utility management system across an IP network that includes several IR8340 routers. One IR8340 router (Router 1) acts as a Raw Socket server, listening for TCP connection requests from the other IR8340 routers (Router 2 and Router 3), which are configured as Raw Socket clients.

A Raw Socket client receives streams of serial data from the RTUs and accumulates this data in its buffer, then places the data into packets, based on user-specified packetization criteria. The Raw Socket client initiates a TCP connection with the Raw Socket server and sends the packetized data across the IP network to the Raw Socket server, which retrieves the serial data from the packets and sends it to the serial interface, and on to the utility management system.


Note


When you configure the serial link interface on the router as a server, the interface’s peer is the serial link interface on the client router and vice versa.

UDP Transport

UDP transport uses a peer-to-peer model. Multiple UDP connections can be configured on an asynchronous serial line. IR8340 can support up to 32 UDP sessions.

The following figure shows a sample Raw Socket UDP configuration. In this example, serial data is transferred between RTUs and a utility management system across an IP network that includes two routers that are configured as Raw Socket UDP peers.

In this example, the Raw Socket UDP peer receives streams of serial data from the RTUs and accumulates this data in its buffer, then places the data into packets, based on user-specified packetization criteria. The Raw Socket UDP peer sends the packetized data across the IP network to the Raw Socket peer at the other end, which retrieves the serial data from the packets and sends it to the serial interface, and on to the utility management system.

Serial Data Processing

When the default serial protocol, Asynchronous Communication Protocol, is used, the streams of serial data received by a Raw Socket peer can be packetized based on the following criteria:

  • Packet length –You can specify a packet length that triggers the IR8340 to transmit the serial data to the peer. Once the IR8340 collects this much data in its buffer, it packetizes the accumulated data and forwards it to the Raw Socket peer.

  • Packet-timer value –The packet timer specifies the amount of time the IR8340 waits to receive the next character in a stream. If a character is not received by the time the packet timer expires, the data the IR8340 has accumulated in its buffer is packetized and forwarded to the Raw Socket peer.

  • Special character –You can specify a character that will trigger the IR8340 to packetize the data accumulated in its buffer and send it to the Raw Socket peer. When the special character (for example, a CR/LF) is received, the IR8340 packetizes the accumulated data and sends it to the Raw Socket peer.

See Configuring Common Raw Socket Line Options for information about configuring the processing options.

VRF-Aware Raw Socket

The VRF-aware Raw Socket Transport feature enables you to isolate Raw Socket traffic using a VRF for efficient management and control of serial data. After configuring a VRF, you can associate the serial interface configured for Raw Socket Transport with the VRF. See Raw Socket VRF for a configuration example.

Prerequisites

Determine how you want Raw Socket traffic transported in your network, including the network devices and interfaces to use, how the router packetizes the serial data, and whether to use VRF.

Guidelines and Limitations

Typically, UDP traffic is blocked by firewalls in the network. If the network has such firewalls, make sure to configure pinholes to allow the raw socket UDP traffic.

Default Settings

Feature

Default Setting

Raw Socket Transport

Disabled.

Packet length

No packet length is configured.

Serial Protocol

Asynchronous Communication Protocol

Packet timeout

15 ms.

Special character

No special character is configured.

Raw Socket mode

Best-effort mode is off, not supported on the IR8340.

TCP idle timeout

5 minutes.

Configuring Raw Socket Transport

This section includes the following topics:

Enabling Raw Socket Transport on the Serial Interface

To enable Raw Socket Transport on the IR8340 router, you must first enable an asynchronous serial port and enable Raw Socket TCP or UDP encapsulation for that port.

Before you begin

Determine availability of the serial port on the IR8340.

Procedure

  Command or Action Purpose

Step 1

configure terminal

Enters global configuration mode.

Step 2

interface serial slot/subslot/port

Enters the interface command mode for the serial interface.

Step 3

physical-layer async

Configure the serial interface to Asynchronous mode.

Step 4

no ip address

Disables IP processing on the interface.

Step 5

Do one of the following:

  • encapsulation raw-tcp
  • encapsulation raw-udp

Enables Raw Socket TCP encapsulation or UDP encapsulation for the serial port.

Example


router# configure terminal
router(config)# interface serial 0/3/2
router(config)# physical-layer async
router(config-if)# no ip address
router(config-if)# encapsulation raw-tcp
router(config-if)# exit

Configuring Common Raw Socket Line Options

You can configure options common to all connections on a line. The common options apply to both TCP and UDP.

Before you begin

Enable Raw Socket Transport as described in Enabling Raw Socket Transport on the Serial Interface.

Procedure

  Command or Action Purpose

Step 1

configure terminal

Enters global configuration mode.

Step 2

line 0 /slot /port

Enters line command mode for the serial slot/port.

Step 3

raw-socket packet-length length

Specifies the packet size that triggers the IR8340 to transmit the data to the peer. When the IR8340 accumulates this much data in its buffer, it packetizes the data and forwards it to the Raw Socket peer.

length— 2 to 1400 bytes.

By default, the packet-length trigger is disabled.

Step 4

raw-socket packet-timer timeout

Specifies the maximum time in milliseconds the IR8340 waits to receive the next character in a stream. If a character is not received by the time the packet-timer expires, the accumulated data is packetized and forwarded to the Raw Socket peer.

timeout —3 to 1000 ms.

The default is 15 ms.

Step 5

raw-socket spec-char ascii_char

Specifies a character that will trigger the IR8340 to packetize the data accumulated in its buffer and send it to the Raw Socket peer.

ascii_char— 0 to 255.

By default, the special character trigger is disabled.

Example


router# configure terminal
router(config)# line 0/3/2
router(config-line)# raw-socket packet-length 32
router(config-line)# raw-socket packet-timer 500
router(config-line)# raw-socket special-char 3
router(config-line)# parity even
router(config-line)# stopbits 1
router(config-line)# speed 9600

What to do next

Use the no form of these commands to return to the default values.

Configuring Raw Socket TCP

After enabling Raw Socket TCP encapsulation, you configure the TCP server and/or clients.

Configuring the Raw Socket TCP Server

Before you begin

Enable a serial port and Raw Socket TCP encapsulation for that port, as described in Enabling Raw Socket Transport on the Serial Interface.

Procedure
  Command or Action Purpose

Step 1

configure terminal

Enters configuration mode.

Step 2

line 0 /slot /port

Enters line command mode for the serial slot/port.

Step 3

raw-socket tcp server port [ip_address ]

Starts the Raw Socket Transport TCP server for an asynchronous line interface. In Raw Socket server mode, the IR8340 listens for incoming connection requests from Raw Socket clients.

port –Port number the server listens on.

ip_address –(Optional) Local IP address on which the server listens for connection requests.

Step 4

raw-socket tcp idle-timeout session_timeout

Sets the Raw Socket Transport TCP session timeout for the asynchronous line interface. If no data is transferred between the client and server over this interval, then the TCP session closes. The client then automatically attempts to reestablish the TCP session with the server.

This timeout setting applies to all Raw Socket Transport TCP sessions under this particular line.

session_timeout –Currently configured session idle timeout in minutes. The default is 5 minutes.

Example

router# configure terminal
 
router(config)# line 0/3/2
router(config-line)# raw-socket tcp server 4000 10.0.0.1
router(config-line)# raw-socket tcp idle-timeout 10
router(config-line)# exit
router(config)#
What to do next

To remove a Raw Socket TCP server, use the no raw-socket tcp server command.

Configuring the Raw Socket TCP Client

Before you begin

Enable a serial port and Raw Socket TCP encapsulation for that port, as described in Enabling Raw Socket Transport on the Serial Interface.

Procedure
  Command or Action Purpose

Step 1

configure terminal

Enters configuration mode.

Step 2

line 0 /slot /port

Enters line command mode for the serial slot/port.

Step 3

raw-socket tcp client dest_ip_address dest_port [local_ip_address ] [local_port ]

Specifies settings for Raw Socket Transport TCP client sessions.

dest_ip_address –Destination IP address of the remote Raw Socket server.

dest_port –Destination port number to use for the TCP connection to the remote server.

local_ip_address –(Optional) Local IP address that the client can also bind to.

local_port –(Optional) Local port number that the client can also bind to.

Step 4

raw-socket tcp idle-timeout session_timeout

Sets the Raw Socket Transport TCP session timeout for the asynchronous line interface. If no data is transferred between the client and server over this interval, then the TCP session is closed. The client then automatically attempts to reestablish the TCP session with the server.

This timeout setting applies to all Raw Socket Transport TCP sessions under this particular line.

session_timeout –Currently configured session idle timeout in minutes. The default is 5 minutes.

Step 5

raw-socket tcp keepalive interval

Sets the Raw Socket Transport TCP session keepalive interval for the asynchronous line interface. The router sends keepalive messages based on the configured interval. You may need to configure this interval, for example, when sending raw TCP traffic over a cellular interface.

interval –Currently configured keepalive interval in seconds. Range is 1-864000 seconds. The default is 1 second.

Example

This example shows how to configure a Raw Socket TCP client for an asynchronous serial line. The IR8340 (router), serving as a Raw Socket client, initiates TCP sessions with a Raw Socket server and forwards packetized serial data to it. The router collects streams of serial data in its buffer; when it accumulates 827 bytes in its buffer, the router packetizes the data and forwards it to the Raw Socket server. If the router and the Raw Socket server do not exchange any data for 10 minutes, then the TCP session with the Raw Socket server closes, and the router attempts to reestablish the session with the Raw Socket server.


router# configure terminal
 
router(config)# line 0/3/2
router(config-line)# raw-socket tcp client 10.0.0.1 4000
router(config-line)# raw-socket packet-length 827
router(config-line)# raw-socket tcp idle-timeout 10
router(config-line)# exit
router(config)#
What to do next

To remove a Raw Socket TCP client, use the no raw-socket tcp client command.

Configuring a Raw Socket UDP Peer-to-Peer Connection

After enabling Raw Socket UDP encapsulation and the common line options, you configure the Raw Socket UDP peer-to-peer connection. The local port on one end of the connection should be the destination port on the other end.

Before you begin

Enable a serial port and Raw Socket UDP encapsulation for that port, as described in Enabling Raw Socket Transport on the Serial Interface.

Procedure

  Command or Action Purpose

Step 1

configure terminal

Enters configuration mode.

Step 2

line 0 /slot /port

Enters line command mode for the serial slot/port.

Step 3

raw-socket udp connection dest_ip_address dest_port local_port [local_ip_address ]

Specifies settings for Raw Socket Transport UDP connections.

dest_ip_address –Destination IP address to use for the UDP connection.

dest_port –Destination port number to use for the UDP connection.

local_port –Local port number for the UDP connection.

local_ip_address –(Optional) Local IP address for the UDP connection.

Example

This example shows how to configure a Raw Socket UDP connection between router A (local IP address 192.168.0.8) and router B (local IP address 192.168.0.2).

Router A


router# configure terminal
router(config)# line 0/2/0
router(config-line)# raw-socket udp connection 192.168.0.2 5000 7000
router(config-line)# exit
router(config)#

Router B


router# configure terminal
router(config)# line 0/2/0
router(config-line)# raw-socket udp connection 192.168.0.8 7000 5000
router(config-line)# exit
router(config)#

What to do next

To remove a Raw Socket UDP connection, use the no raw-socket udp connection command.

Verifying Configuration

Command

Purpose

show running-config

Shows the configuration of the IR8340, including those features that are active and their settings.

show raw-socket tcp detail

Displays information about Raw Socket Transport TCP activity.

show raw-socket tcp sessions

Displays information about Raw Socket Transport TCP sessions.

show raw-socket tcp statistics

Displays Raw Socket Transport TCP statistics for each asynchronous serial line.

show raw-socket udp detail

Displays information about Raw Socket Transport UDP activity.

show raw-socket udp sessions

Displays information about Raw Socket Transport UDP sessions.

show raw-socket udp statistics

Displays Raw Socket Transport UDP statistics for each asynchronous serial line.

clear raw-socket statistics

Clears Raw Socket Transport statistics for a specific TTY interface or for all asynchronous serial lines.

Configuration Example

The following sections include Raw Socket Transport configuration examples:

Raw Socket TCP

The following example shows a Raw Socket Transport configuration in which an IR8340 router (Router 1) acts as the server, and another IR8340 (Router 2) acts as the client.

The following table displays the configuration of the server and client IR8340s highlighted in the above figure:

IR8340 Server Configuration

IR8340 Client Configuration


...
interface serial 0/3/1
 physical-layer async
 no ip address
 encapsulation raw-tcp
!         
...
line 0/3/1
 raw-socket tcp server 5000 10.0.0.1
 raw-socket packet-timer 3
 raw-socket tcp idle-timeout 5
...

...
interface serial 0/3/1
 physical-layer async
 no ip address
 encapsulation raw-tcp
!         
interface serial 0/3/2
 physical-layer async
 no ip address
 encapsulation raw-tcp
!         
...
line 0/3/1
 raw-socket tcp client 10.0.0.1 5000 10.0.0.2 9000
 raw-socket packet-length 32
 raw-socket tcp idle-timeout 5
line 0/3/2
 raw-socket tcp client 10.0.0.1 5000 10.0.0.2 9001
 raw-socket packet-length 32
 raw-socket tcp idle-timeout 5

Raw Socket UDP

This example shows the configuration for a Raw Socket UDP connection between two IR8340 routers:

From Router1


interface GigabitEthernet 0/1/1
ip address 192.168.0.8 255.255.255.0
duplex auto
speed auto
interface serial 0/3/2
physical-layer async
no ip address
encapsulation raw-udp
line 0/3/2
raw-socket udp connection 192.168.0.2 4000 4000

From Router2


interface GigabitEthernet0/1/2
ip address 192.168.0.2 255.255.255.0
load-interval 60
duplex auto
speed auto
no keepalive
interface serial 0/3/2
physical-layer async
no ip address
encapsulation raw-udp
line 0/3/2
raw-socket udp connection 192.168.0.8 4000 4000

Raw Socket VRF

The following example shows a Raw Socket VRF configuration in which two routers, configured for Raw Socket Transport, connect through a VRF. Router1 is an IR8340, serves as the Raw Socket TCP server, and Router2 is an IR8340 serves as the Raw Socket TCP client.

Following are the configurations of Router1 and Router2 as shown in the above figure:

Router1 Configuration

Defining VRF on the router:

vrf definition router1
 rd 100:1
 route-target export 100:3
 route-target import 100:3
 !
 address-family ipv4
 exit-address-family

Applying VRF configuration on the interface:

interface GigabitEthernet0/0/1
 vrf forwarding router1
 ip address 100.100.100.2 255.255.255.0
 duplex auto
 speed auto

Applying raw-tcp on the serial interface:

interface serial 0/3/1
 physical-layer async
 vrf forwarding router1
 no ip address
 encapsulation raw-tcp

Applying raw-tcp on the line:

line 0/3/1
 raw-socket tcp server 5000 4.4.4.4

Router2 Configuration

Defining VRF on the router:

vrf definition router1
 rd 100:1
 route-target export 100:3
 route-target import 100:3
 !
 address-family ipv4
 exit-address-family

Applying VRF configuration on the interface:

interface GigabitEthernet0/0/1
 vrf forwarding router1
 ip address 100.100.100.1 255.255.255.0
 duplex auto
 speed auto

Applying raw-tcp on the serial interface:

interface serial 0/3/1
 physical-layer async
 vrf forwarding router1
 no ip address
 encapsulation raw-tcp

Applying raw-tcp on line:

line 0/3/1
  raw-socket tcp client 4.4.4.4 5000

Show Line Details for Configuring Raw-TCP/UDP

The show line command shows all TTY line summary information. The output contains information about mapping between async interface and line number, the line speed, uses, noise, and so on. The line that begins with the asterisk "*" indicates that the line is in use.

By enabling the physical layer Async on the serial port, the corresponding line will be activated and it will be displayed in the show line output. In the following example, 0/3/0 and 0/3/4 are configured as async mode and displayed.

U1#show line
   Tty Line Typ     Tx/Rx    A Modem  Roty AccO AccI  Uses  Noise Overruns  Int
*     0    0 CTY              -    -      -    -    -     0      0    0/0      -
      1    1 AUX   9600/9600  -    -      -    -    -     0      0    0/0      -
  0/3/0   50 TTY   9600/9600  -    -      -    -    -     0     17    0/0    Se0/3/0
  0/3/4   54 TTY   9600/9600  -    -      -    -    -     0      0    0/0    Se0/3/4
    866  866 VTY              -    -      -    -    -     3      0    0/0      -
    867  867 VTY              -    -      -    -    -     0      0    0/0      -
    868  868 VTY              -    -      -    -    -     0      0    0/0      -
    869  869 VTY              -    -      -    -    -     0      0    0/0      -
    870  870 VTY              -    -      -    -    -     0      0    0/0      -
    871  871 VTY              -    -      -    -    -     0      0    0/0      -
    872  872 VTY              -    -      -    -    -     0      0    0/0      -
    873  873 VTY              -    -      -    -    -     0      0    0/0      -
    874  874 VTY              -    -      -    -    -     0      0    0/0      -
    875  875 VTY              -    -      -    -    -     0      0    0/0      -
    876  876 VTY              -    -      -    -    -     0      0    0/0      -
    877  877 VTY              -    -      -    -    -     0      0    0/0      -
    878  878 VTY              -    -      -    -    -     0      0    0/0      -
    879  879 VTY              -    -      -    -    -     0      0    0/0      -
    880  880 VTY              -    -      -    -    -     0      0    0/0      -
Line(s) not in async mode -or- with no hardware support:
2-49, 51-53, 55-865
U1# 

Raw-Socket Show and Debug Commands

Use the following show commands for the verification:

  • show raw-socket {tcp |udp } session

  • show raw-socket {tcp |udp } statistic

Use the following commands to debug:

debug raw-socket ?
  driver      Driver level debug
  transport   Raw-socket over any transport

debug raw-socket driver ?
  event    Driver event trace
  packet   Driver packet trace

debug raw-socket driver event ?
  <cr>  <cr>

debug raw-socket driver packet ?
  line   Serial/Async line
  <cr>  <cr>

debug raw-socket driver packet line ?
  <0-726>  First Line range
  console  Primary terminal line
  tty      Terminal controller
  vty      Virtual terminal
  x/y/z    Slot/Subslot/Port for Modems

debug raw-socket transport ?
  event    TCP or UDP event trace
  packet   TCP or UDP packet trace

debug raw-socket transport event ?
  <cr>  <cr>

debug raw-socket transport packet ?
  line   Serial/Async line
  <cr>  <cr>

debug raw-socket transport packet line ?
  <0-726>  First Line range
  console  Primary terminal line
  tty      Terminal controller
  vty      Virtual terminal
  x/y/z    Slot/Subslot/Port for Modems