Configuring an Oracle® Solaris 11.2 System as a Router or a Load Balancer

Exit Print View

Updated: September 2014
 
 

How to Configure an IPv4 Router

The following procedure assumes that you are configuring interfaces for the router after installing the router.

Before You Begin

After the router is physically installed on the network, configure the router to operate in local files mode. This configuration ensures that routers boot even if the network configuration server is down.

  1. Become an administrator.

    For more information, see Using Your Assigned Administrative Rights in Securing Users and Processes in Oracle Solaris 11.2 .

  2. Configure the IP interfaces for the NICs on the system.
    # ipadm create-ip IP-interface
  3. Configure the IP interface with a valid IP address by choosing one of the following commands:
    • To configure a static address, type the following command:
      # ipadm create-addr -a address [interface | addr-obj]
    • To configure a nonstatic address, type the following command:
      # ipadm create-addr -T address-type [interface | addr-obj]

    For detailed instruction about how to configure IP interfaces, see Chapter 3, Configuring and Administering IP Interfaces and Addresses in Oracle Solaris, in Configuring and Administering Network Components in Oracle Solaris 11.2 .

    Make sure that each IP interface is configured with the IP address of the network for which the system must route packets. Therefore, if the system serves the 192.168.5.0 and 10.0.5.0 networks, then one NIC must be configured for each network.


    Caution

    Caution  -  Make sure you are thoroughly knowledgeable about DHCP administration before configuring an IPv4 router to use DHCP.


  4. Add the host name and IP address of each interface to the /etc/inet/hosts file.

    For example, assume that the names you assigned for the two interfaces of the router are krakatoa and krakatoa-1, respectively. The entries in the /etc/inet/hosts file are as follows:

    192.168.5.1      krakatoa        #interface for network 192.168.5.0
    10.0.5.1         krakatoa-1      #interface for network 10.0.5.0
  5. Perform the procedure How to Configure a System for Local Files Mode in Configuring and Administering Network Components in Oracle Solaris 11.2 to configure this router to run in local files mode.
  6. If the router is connected to any subnetted network, add the network number and the netmask to the /etc/inet/netmasks file.

    For example, for IPv4 address notation, such as 192.168.5.0, type the following:

    192.168.5.0    255.255.255.0
  7. Enable IPv4 packet forwarding on the router.
    # ipadm set-prop -p forwarding=on ipv4
  8. (Optional) Start a routing protocol.

    Use one of the following commands:

    # routeadm -e ipv4-routing -u

    where –e option enables IPv4 routing and –u option applies the current configuration to the running system.

    # svcadm enable route:default

    When you start a routing protocol, the routing daemon /usr/sbin/in.routed automatically updates the routing table, a process that is known as dynamic routing. For more information about the types of routing, see Routing Tables and Routing Types in Configuring and Administering Network Components in Oracle Solaris 11.2 . For information about the routeadm command, see the routeadm (1M) man page and for more information about the ipadm command, see the ipadm (1M) man page.

    The Service Management Facility (SMF) Fault Management Resource Identifier (FMRI) associated with the in.routed daemon is svc:/network/routing/route.

Example 2-1  Configuring a System as a Router

This example is based on the following figure.

image:This figure shows an autonomous system with multiple IPv4 routers.

Router 2 contains two wired network connections, one connection to network 172.20.1.0 and one to network 10.0.5.0. The example shows how to configure a system as a router (Router 2) of the 172.20.1.0 network. The example also assumes that Router 2 has been configured to operate in the local files mode as described in How to Configure a System for Local Files Mode in Configuring and Administering Network Components in Oracle Solaris 11.2 .

  1. Determine the status of the system's interfaces.

    # dladm show-link
    LINK     CLASS     MTU     STATE   BRIDGE   OVER
    net0     phys      1500    up      --       --
    net1     phys      1500    up      --       --
    net2     phys      1500    up      --       --
    # ipadm show-addr
    ADDROBJ           TYPE     STATE        ADDR
    lo0/v4            static   ok           10.0.0.1/8
    net0/v4           static   ok           172.20.1.10/24
  2. Only net0 has been configured with an IP address. To make Router 2 the default router, physically connect the net1 interface to the 10.0.5.0 network.

    # ipadm create-ip net1
    # ipadm create-addr -a 10.0.5.10/24 net1
    # ipadm show-addr
    ADDROBJ           TYPE     STATE        ADDR
    lo0/v4            static   ok           192.168.0.1/8
    net0/v4           static   ok           172.20.1.10/24
    net1/v4           static   ok           10.0.5.10/24
  3. Update the following network databases with information about the newly configured interface and the network to which it is connected.

    # pfedit /etc/inet/hosts
    192.168.0.1       localhost
    172.20.1.10        router2        #interface for network 172.20.1
    10.0.5.10          router2-out    #interface for network 10.0.5
    # pfedit /etc/inet/netmasks
    172.20.1.0    255.255.255.0
    10.0.5.0      255.255.255.0
  4. Enable packet forwarding as well as the in.routed routing daemon.

    # ipadm set-prop -p forwarding=on ipv4
    # svcadm enable route:default

    Now, IPv4 packet forwarding and dynamic routing through RIP are enabled on Router 2. However, to complete the default router configuration for the network 172.20.1.0 you must do the following: