slattach
Attach serial line to network interface
SYNOPSIS
slattach [-c] [-L] [-p protocol] [-s speed] [-v] device
PARAMETERS
-c
Do not fork; stay in the foreground. This is useful for debugging or when running slattach under a process manager.
-L
Enable 3-wire operation (local loopback). This option is for specific serial line setups where fewer control lines are used.
-p protocol
Specify the line discipline protocol to use. Common values include slip (default), cslip (compressed SLIP), adaptive (attempts to detect slip/cslip), ppp (often executes pppd), kiss, and smc-slip.
-s speed
Set the serial port speed (baud rate). Common speeds include 9600, 19200, 38400, 57600, 115200, etc.
-v
Enable verbose output, providing more information about the operation and status.
device
The path to the serial port device to attach, e.g., /dev/ttyS0 or /dev/ttyUSB0.
DESCRIPTION
slattach is a command-line utility used to attach a serial line (TTY device) as a network interface. Its primary historical purpose was to implement Serial Line Internet Protocol (SLIP) or Compressed SLIP (CSLIP) connections, allowing IP traffic to be routed over a serial port. When executed, slattach opens the specified serial device, sets its line discipline to either SLIPDISC or CSLIPDISC (or other protocols based on options), and typically forks into the background, making the serial port available as a network interface (e.g., sl0, sl1).
While slattach enabled early forms of IP networking over dial-up or direct serial connections, it has largely been superseded by Point-to-Point Protocol (PPP) via tools like pppd, which offers superior error correction, authentication, and dynamic IP assignment. After slattach establishes the connection, the resulting network interface usually needs to be configured with IP addresses and routing information using commands like ifconfig and route for the connection to be functional.
CAVEATS
slattach primarily supports SLIP and CSLIP, which are now largely obsolete for general internet connectivity due to their limitations (no error correction, no authentication, fixed IP addresses). For modern dial-up or serial connections, PPP (managed by pppd) is the standard.
Using slattach requires root privileges as it modifies system network interfaces and serial port settings. The serial port must not be in use by another application. After successful execution, you still need to configure the created network interface (e.g., sl0) with an IP address and routes using tools like ifconfig and route. If -p ppp is used, slattach may simply exec the pppd daemon.
USAGE EXAMPLE
To attach /dev/ttyS0 as a SLIP interface at 38400 baud and then configure it:sudo slattach -s 38400 /dev/ttyS0
sudo ifconfig sl0 192.168.1.1 pointopoint 192.168.1.2 up
sudo route add default gw 192.168.1.2
This example assumes a direct SLIP connection between two machines where sl0 is the first assigned SLIP interface.
HISTORY
The Serial Line Internet Protocol (SLIP) was one of the earliest methods for encapsulating IP packets over serial lines, widely adopted in the early days of the Internet (late 1980s, early 1990s) when dedicated network hardware was less common or prohibitively expensive. slattach emerged as a crucial utility to enable this type of networking on Unix-like systems. It was a foundational component for connecting standalone computers or small networks to the nascent Internet via modems. Its usage declined significantly with the rise of the more robust and feature-rich Point-to-Point Protocol (PPP) in the mid-1990s, which addressed many of SLIP's shortcomings like lack of error detection, authentication, and multi-protocol support. Despite its obsolescence for general internet access, slattach remains part of the net-tools package in many Linux distributions, sometimes used for very specific embedded or legacy serial communications.