Setting up a Linux router

6.10 LPAR mode z/VM guest

By default, your Linux® instance is not a router. Depending on your IP version, IPv4 or IPv6 you can use the route4 or route6 attribute of your qeth device to define it as a router.

Before you begin

  • A suitable hardware setup must be in place that enables your Linux instance to act as a router.
  • The Linux instance is set up as a router. To configure Linux running as a z/VM® guest or in an LPAR as a router, IP forwarding must be enabled in addition to setting the route4 or route6 attribute.
    For IPv4, enable IP forwarding by issuing:
    # sysctl -w net.ipv4.conf.all.forwarding=1
    For IPv6, enable IP forwarding by issuing:
    # sysctl -w net.ipv6.conf.all.forwarding=1
Note: Depending on your distribution, you might be able to use distribution-specific configuration files. See your distribution documentation for distribution-specific procedures.

About this task

You can set the route4 or route6 attribute dynamically, while the qeth device is online.

The same values are possible for route4 and route6 but depend on the type of CHPID, as shown in Table 1.
Table 1. Summary of router setup values
Router specification OSA-Express CHPID in QDIO mode HiperSockets CHPID
primary_router Yes No
secondary_router Yes No
primary_connector No Yes
secondary_connector No Yes
multicast_router Yes Yes
no_router Yes Yes
Both types of CHPIDs accept:
multicast_router
causes the qeth driver to receive all multicast packets of the CHPID. For a unicast function for HiperSockets see HiperSockets Network Concentrator.
no_router
is the default. You can use this value to reset a router setting to the default.
An OSA-Express CHPID in QDIO mode accepts the following values:
primary_router
to make your Linux instance the principal connection between two networks.
secondary_router
to make your Linux instance a backup connection between two networks.
A HiperSockets CHPID accepts the following values, if the microcode level supports the feature:
primary_connector
to make your Linux instance the principal connection between a HiperSockets network and an external network.
secondary_connector
to make your Linux instance a backup connection between a HiperSockets network and an external network.

Example

In this example (see Figure 1), two Linux instances, Linux P and Linux S, running on an IBM® mainframe use OSA-Express to act as primary and secondary routers between two networks. IP forwarding must be enabled for Linux in an LPAR or as a z/VM guest to act as a router. IP forwarding is configured in procfs or in a configuration file; see your distribution manual for details.

Mainframe configuration:
Figure 1. Mainframe configuration
This graphic is described in the surrounding text.

It is assumed that both Linux instances are configured as routers in their LPARs or in z/VM.

Linux P configuration:
To create the qeth group devices:
# echo 0.0.0400,0.0.0401,0.0.0402 > /sys/bus/ccwgroup/drivers/qeth/group
# echo 0.0.0200,0.0.0201,0.0.0202 > /sys/bus/ccwgroup/drivers/qeth/group
To make Linux P a primary router for IPv4:
# echo primary_router > /sys/bus/ccwgroup/drivers/qeth/0.0.0400/route4
# echo primary_router > /sys/bus/ccwgroup/drivers/qeth/0.0.0200/route4
Linux S configuration:
To create the qeth group devices:
# echo 0.0.0404,0.0.0405,0.0.0406 > /sys/bus/ccwgroup/drivers/qeth/group
# echo 0.0.0204,0.0.0205,0.0.0206 > /sys/bus/ccwgroup/drivers/qeth/group
To make Linux S a secondary router for IPv4:
# echo secondary_router > /sys/bus/ccwgroup/drivers/qeth/0.0.0404/route4
# echo secondary_router > /sys/bus/ccwgroup/drivers/qeth/0.0.0204/route4
In this example, qeth device 0.0.1510 is defined as a primary router for IPv6:
# chzdev --enable qeth 0.0.1510,0.0.1511,0.0.1512
# chzdev qeth 0.0.1510 route6=primary_router
# lszdev 1510 -i | grep route6
primary router
Alternatively, using sysfs attributes:
# cd /sys/bus/ccwgroup/drivers/qeth/0.0.1510
# echo 1 > online
# echo primary_router > route6
# cat route6
primary router