ldattach
Attach line discipline to serial port
SYNOPSIS
ldattach [options] discipline device
PARAMETERS
-d, --detach
Detach line discipline from device
-h, --help
Display help and exit
-L, --list
List available line disciplines
-n, --nohangup
Prevent detachment on TTY hangup
-s speed, --speed=speed
Set serial line speed (e.g., 38400)
-V, --version
Show version information
-y, --yes
Detach without prompting
DESCRIPTION
ldattach is a utility from the util-linux package that attaches or detaches a TTY line discipline (ldisc) to a serial device, enabling protocols like SLIP or PPP over serial lines. Line disciplines are kernel modules that alter how data is processed on a TTY device, transforming it into a network interface.
Typically run as root, ldattach loads the required kernel module (e.g., slip or cslip) if not present, sets the line discipline on the specified tty (e.g., /dev/ttyS0), and optionally configures the baud rate. After attachment, the interface (e.g., sl0) can be configured with ifconfig or ip for IP networking.
Common use cases include point-to-point serial links for embedded systems or legacy dial-up. By default, the discipline detaches on TTY hangup (e.g., modem disconnect), but this can be disabled. Debugging output is available in some versions.
Modern networking favors Ethernet or PPP daemons like pppd, making ldattach largely legacy, but it's still useful for raw serial protocols or HDLC. Always verify kernel support via -L option.
CAVEATS
Requires root privileges.
Legacy tool; prefer pppd(8) for PPP.
May fail if device busy or module unavailable.
Detaches on hangup by default; disrupts normal serial use.
Kernel modules (e.g., slip.ko) must be available.
COMMON DISCIPLINES
slip (SLIP), cslip (CSLIP), ppp (async PPP), ppp_sync (sync PPP), n_hdlc (Cisco HDLC)
EXAMPLE USAGE
ldattach -s 38400 slip /dev/ttyS0
ifconfig sl0 192.168.1.1 pointopoint 192.168.1.2 up
To detach: ldattach -d slip /dev/ttyS0
HISTORY
Introduced in early Linux (1990s) for SLIP serial networking. Integrated into util-linux-ng package. Declined in use post-2000s with broadband rise; maintained for compatibility.


