LNET\_LEGACY2YAML(8) Lustre Configuration Utilities LNET\_LEGACY2YAML(8)

# [NAME](#NAME)

lnet\_legacy2yaml - convert legacy LNet module parameters to YAML

# [SYNOPSIS](#SYNOPSIS)

`lnet_legacy2yaml` \[*options*] \[*inline-legacy-string*]

`lnet_legacy2yaml` \[*-i* *ip2nets\_file*] \[*-r* *routes\_file*] \[*-n* *networks\_file*] \[*-m* *modprobe\_file*] \[*-o* *output\_file*] \[*--default-hop* \[*HOP*]] \[*inline-legacy-string*]

# [DESCRIPTION](#DESCRIPTION)

The **lnet\_legacy2yaml** utility parses deprecated Lustre LNet module parameter syntaxes (**ip2nets=**, **routes=**, and **networks=**) and emits an equivalent YAML document usable by [**lnetctl**(8)](/man/enterprise-packages/lustre/lnetctl.8) via

lnetctl import &lt; output.yaml

Kernel parsing of ip2nets was deprecated in Lustre 2.10; user space now resolves interface patterns. This tool facilitates migration from legacy module configuration files (e.g. **modprobe.conf** / **lustre.conf**) to the YAML form consumed by modern LNet configuration workflows.

Input may be supplied through any combination of positional inline argument, file options, or standard input. If no positional inline argument is provided and stdin is not a TTY, data is read from stdin. Multiple sources accumulate: ip2nets files first, route files, then inline/stdin content.

# [OPTIONS](#OPTIONS)

[**-i**, **--ip2nets** *FILE*](#i)

File containing one or more ip2nets rules separated by semicolons (;) or newlines. May be specified multiple times.

[**-r**, **--routes** *FILE*](#r)

File containing one or more routes entries separated by semicolons (;) or newlines. May be specified multiple times.

[**-n**, **--networks** *FILE*](#n)

File containing one or more networks entries separated by commas (,) or newlines. May be specified multiple times.

[**-m**, **--modprobe** *FILE*](#m)

Modprobe configuration file (e.g. **/etc/modprobe.d/lnet.conf**) to parse for lnet module parameters. The tool extracts **ip2nets= ,** **routes= ,** and **networks=** values from lines matching

**options lnet ip2nets="..." routes="..." networks="..."**

May be specified multiple times. Line continuations (backslash-newline) are supported.

[**-o**, **--output** *FILE*](#o)

Write YAML to FILE instead of stdout.

[**--default-hop \[*HOP*\]**](#default-hop)

Assign a default hopcount to routes lacking an explicit hop token. If HOP is omitted, 1 is used. Range: 1-255. Explicit hopcounts in input are never overridden.

[**-h**, **--help**](#h)

Display usage summary.

# [EXIT STATUS](#EXIT_STATUS)

**0**

Success.

**1**

Usage error or no data provided.

**2**

Parsing error or file I/O error (message on stderr).

# [NOTES](#NOTES)

## [Legacy networks Syntax](#Legacy_networks_Syntax)

Comma-separated list of network specifications:

*nettype* \[*id*] \[*(*iface-list*)*]

Examples:

**tcp**  
**tcp0(eth0)**  
**tcp0(eth0),o2ib(ib0)**

## [Legacy ip2nets Syntax](#Legacy_ip2nets_Syntax)

Each rule: *net-spec ip-pattern* { *ip-pattern* }

Net spec: *nettype id* optionally followed by interface list in parentheses, e.g.:

**tcp0(eth0,eth1) 192.168.0.\***

IP patterns support wildcards (**\***) and bracket expressions for sets/ranges, e.g.:

132.6.\[1-3].\[2-8/2]

Rules are separated by semicolons or newlines. The first matching rule for a given network wins.

## [Legacy routes Syntax](#Legacy_routes_Syntax)

Two route formats are supported:

**Legacy format:**

*netspec* \[*hopcount*] *gateway* { *gateway* ... }

Gateway NIDs may end with an optional priority suffix: **gateway:PRIORITY** (e.g. **10.0.0.1@o2ib0:5**). The first numeric token (1-255) after the network spec is treated as hopcount. If omitted and **--default-hop** is not used, hop is left unspecified in YAML.

**Alternative format (lustre\_routes\_config syntax):**

*network* **: { gateway:** gateway**@**exitnet \[ , *hop:* hopcount*]* \[ , *priority:* priority *] }*

This format explicitly names parameters and allows them in any order. Parameters are separated by commas. The **gateway** parameter is mandatory; hop and priority are optional.

Examples:

```
tcp1: { gateway: 10.1.1.2@tcp0, priority: 3 }
tcp4: { gateway: 10.3.3.4@tcp }
tcp6: { gateway: 10.3.3.6@tcp, hop: 2, priority: 5 }
tcp7: { gateway: 10.3.3.[6-12]@tcp, priority: 20, hop: 8 }
```

Both formats may be mixed freely in the same input file or stream. The tool automatically detects which format each line uses.

## [YAML Output Format](#YAML_Output_Format)

The tool emits up to three top-level sequences:

net:  
ip2nets:  
route:

Example:

```
net:


  - net type: tcp0


    local NI(s):


    -     interfaces:


              0: eth0
ip2nets:


  - net-spec: tcp0


    interfaces:


         0: eth0


    ip-range:


         0: 192.168.0.[2,4]


  - net-spec: o2ib0


    ip-range:


         0: 192.168.0.*
route:


  - net: tcp0


    gateway: 10.0.0.[1-2]@o2ib0


    hop: 2


    priority: 5


  - net: tcp0


    gateway: 10.0.0.[3-4]@o2ib0


    hop: 2


    priority: 10
```

Any IP pattern beginning with an asterisk (e.g. \*.\*.\*.\*) is automatically wrapped in double quotes to avoid YAML alias semantics.

## [Behavior Notes](#Behavior_Notes)

- Rule / entry separators: semicolon (;) or newline.
- Comments initiated by '#' are stripped (not valid inside bracket expressions).
- IP patterns are preserved verbatim (no expansion of bracket/range expressions).
- Interfaces are listed in the order provided.
- Multiple ip2nets/routes/networks files are concatenated in given order.
- Gateway priority parsed only when final colon + digits suffix present (naive IPv6 avoidance). This limitation does not apply to the alternative route format where priority is explicitly named.
- Both legacy and alternative route formats may be freely mixed in the same file. Each line is automatically detected and parsed according to its format.
- Modprobe files are processed first, followed by explicit ip2nets files, routes files, networks files, then inline/stdin content.
- Line continuations in modprobe files (backslash-newline) are handled automatically.

# [CAVEATS](#CAVEATS)

- Does not expand bracket/range expressions to concrete addresses.
- Simple validation only; malformed nested bracket constructs may not produce intuitive errors.
- Priority parsing does not support IPv6 literal addresses with trailing numeric segments separated by colons.

# [EXAMPLES](#EXAMPLES)

Convert networks parameter:

```
$ lnet_legacy2yaml 'options lnet networks="tcp0(eth0),o2ib(ib0)"'
net:


  - net type: tcp0


    local NI(s):


    -     interfaces:


              0: eth0


  - net type: o2ib


    local NI(s):


    -     interfaces:


              0: ib0
```

Convert simple ip2nets string:

```
$ lnet_legacy2yaml \
   'tcp0(eth0,eth1) 10.0.0.*; o2ib0 192.168.[1-2].*'
```

Extract both parameters from an options line:

```
$ lnet_legacy2yaml \
   'options lnet ip2nets="tcp0 10.0.0.*" \
   routes="tcp0 1 10.0.0.1@o2ib0"'
```

Parse modprobe configuration file:

```
$ lnet_legacy2yaml -m /etc/modprobe.d/lnet.conf \
   -o lnet.yaml
```

Convert routes using alternative format:

```
$ cat routes.conf
tcp1: { gateway: 10.1.1.2@tcp0, priority: 3 }
tcp4: { gateway: 10.3.3.4@tcp }
tcp6: { gateway: 10.3.3.6@tcp, hop: 2, priority: 5 }
tcp7: { gateway: 10.3.3.[6-12]@tcp, priority: 20, hop: 8 }
$ lnet_legacy2yaml -r routes.conf
route:


  - net: tcp1


    gateway: 10.1.1.2@tcp0


    priority: 3


  - net: tcp4


    gateway: 10.3.3.4@tcp


  - net: tcp6


    gateway: 10.3.3.6@tcp


    hop: 2


    priority: 5


  - net: tcp7


    gateway: 10.3.3.[6-12]@tcp


    hop: 8


    priority: 20
```

Files plus default hop:

```
$ lnet_legacy2yaml -i ip.rules -r routes.rules \
   --default-hop 2 -o lnet.yaml
```

Import into LNet:

```
$ lnetctl import < lnet.yaml
```

# [AUTHORS](#AUTHORS)

Generated with assistance from automated tooling; further maintained by Lustre contributors.

# [AVAILABILITY](#AVAILABILITY)

**lnet\_legacy2yaml** is part of the [**lustre**(7)](/man/enterprise-packages/lustre/lustre.7) filesystem package since release 2.17.0

# [SEE ALSO](#SEE_ALSO)

[**lustre**(7)](/man/enterprise-packages/lustre/lustre.7), [**lnetctl**(8)](/man/enterprise-packages/lustre/lnetctl.8)

2025-10-20 Lustre

---

Document: lnet_legacy2yaml(8) from lustre 2.17.59-r2 (Chainguard OS)
Source: https://github.com/lustre/lustre-release
