# Sysconfig_Route

Parses /etc/sysconfig/network-scripts/route-${device}

Author: Stephen P. Schaefer

Summary

Sysconfig_Route | Parses /etc/sysconfig/network-scripts/route-${device}
Reference | This lens allows manipulation of one IPv4 variant of the /etc/sysconfig/network-scripts/route-${device} script found in RHEL5+, CentOS5+ and Fedora.
License | This file is licenced under the LGPL v2+, like the rest of Augeas.
Lens Usage | Sample usage of this lens in augtool
Configuration files | This lens applies to /etc/sysconfig/network-scripts/route-*
Examples | The Test_Sysconfig_Route file contains various examples and tests.
USEFUL PRIMITIVES |
router | A router
cidr | A subnet mask can be 0 to 32 bits
subnet | Subnet specification
ENTRY TYPES |
entry | One route
LENS AND FILTER |
lns |
filter |

### Reference

This lens allows manipulation of one IPv4 variant of the /etc/sysconfig/network-scripts/route-${device} script found in RHEL5+, CentOS5+ and Fedora.

The variant handled consists of lines like “destination_subnet/cidr via router_ip”, e.g., “10.132.11.0/24 via 10.10.2.1”

There are other variants; if you use them, please enhance this lens.

The natural key would be “10.132.11.0/24” with value “10.10.2.1”, but since augeas cannot deal with slashes in the key value, I reverse them, so that the key is “10.10.2.1[1]” (and “10.10.2.1[2]”... if multiple subnets are reachable via that router).

### License

This file is licenced under the LGPL v2+, like the rest of Augeas.

### Lens Usage

Sample usage of this lens in augtool

- Set the first subnet reachable by a router reachable on the eth0 subnet

>     set /files/etc/sysconfig/network-scripts/route-eth0/10.10.2.1[1] 172.16.254.0/24

- List all the subnets reachable by a router reachable on eth0 subnet

>     match /files/etc/sysconfig/network-scripts/route-eth0/10.10.2.1

### Configuration files

This lens applies to /etc/sysconfig/network-scripts/route-*

### Examples

The Test_Sysconfig_Route file contains various examples and tests.

### USEFUL PRIMITIVES

### router

> let router = Rx.ipv4

A router

### cidr

> let cidr = /(3[012]|[12][0-9]|[0-9])/

A subnet mask can be 0 to 32 bits

### subnet

> let subnet = Rx.ipv4 . "/" . cidr

Subnet specification

### ENTRY TYPES

### entry

> let entry = [ store subnet . del /[ \t]*via[ \t]*/ " via " . key router . Util.del_str "\n" ]

One route

### LENS AND FILTER

### lns

> let lns = entry+

### filter

Provides unit tests and examples for the Sysconfig_Route lens.

> let router = Rx.ipv4

A router

> let cidr = /(3[012]|[12][0-9]|[0-9])/

A subnet mask can be 0 to 32 bits

> let subnet = Rx.ipv4 . "/" . cidr

Subnet specification

> let entry = [ store subnet . del /[ \t]*via[ \t]*/ " via " . key router . Util.del_str "\n" ]

One route

> let lns = entry+

Close