JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
System Administration Guide: IP Services     Oracle Solaris 11 Express 11/10
search filter icon
search icon

Document Information

Preface

Part I TCP/IP Administration

1.  Planning an IPv4 Addressing Scheme (Tasks)

2.  Planning an IPv6 Addressing Scheme (Overview)

3.  Planning an IPv6 Network (Tasks)

4.  Configuring TCP/IP Network Services and IPv4 Addressing (Tasks)

Before You Configure an IPv4 Network (Task Map)

Determining Host Configuration Modes

Systems That Should Run in Local Files Mode

Network Configuration Servers

Systems That Are Network Clients

Mixed Configurations

IPv4 Network Topology Scenario

Adding a Subnet to a Network (Task Map)

Network Configuration Task Map

Configuring Systems on the Local Network

How to Configure a Host for Local Files Mode

How to Set Up a Network Configuration Server

Configuring Network Clients

How to Configure Hosts for Network Client Mode

How to Change the IPv4 Address and Other Network Configuration Parameters

Packet Forwarding and Routing on IPv4 Networks

Routing Protocols Supported by Oracle Solaris

IPv4 Autonomous System Topology

Configuring an IPv4 Router

How to Configure an IPv4 Router

Routing Tables and Routing Types

Configuring Routes

Configuring Multihomed Hosts

How to Create a Multihomed Host

Configuring Routing for Single-Interface Systems

How to Enable Static Routing on a Single-Interface Host

How to Enable Dynamic Routing on a Single-Interface Host

Monitoring and Modifying Transport Layer Services

How to Log the IP Addresses of All Incoming TCP Connections

How to Add Services That Use the SCTP Protocol

How to Use TCP Wrappers to Control Access to TCP Services

5.  Enabling IPv6 on a Network (Tasks)

6.  Administering a TCP/IP Network (Tasks)

7.  Configuring IP Tunnels

8.  Troubleshooting Network Problems (Tasks)

9.  TCP/IP and IPv4 in Depth (Reference)

10.  IPv6 in Depth (Reference)

Part II DHCP

11.  About DHCP (Overview)

12.  Planning for DHCP Service (Tasks)

13.  Configuring the DHCP Service (Tasks)

14.  Administering DHCP (Tasks)

15.  Configuring and Administering the DHCP Client

16.  Troubleshooting DHCP (Reference)

17.  DHCP Commands and Files (Reference)

Part III IP Security

18.  IP Security Architecture (Overview)

19.  Configuring IPsec (Tasks)

20.  IP Security Architecture (Reference)

21.  Internet Key Exchange (Overview)

22.  Configuring IKE (Tasks)

23.  Internet Key Exchange (Reference)

24.  IP Filter in Oracle Solaris (Overview)

25.   IP Filter (Tasks)

Part IV Networking Performance

26.  Integrated Load Balancer Overview

27.  Configuration of Integrated Load Balancer Tasks

28.  Virtual Router Redundancy Protocol (Overview)

29.  VRRP Configuration (Tasks)

30.  Implementing Congestion Control

Part V IP Quality of Service (IPQoS)

31.  Introducing IPQoS (Overview)

32.  Planning for an IPQoS-Enabled Network (Tasks)

33.  Creating the IPQoS Configuration File (Tasks)

34.  Starting and Maintaining IPQoS (Tasks)

35.  Using Flow Accounting and Statistics Gathering (Tasks)

36.  IPQoS in Detail (Reference)

Glossary

Index

Packet Forwarding and Routing on IPv4 Networks

This section contains procedures and examples that show how to configure forwarding and routing for routers and hosts on IPv4 networks.

Packet forwarding is the basic method for sharing information across systems on a network. Packets are transferred between a source interface and a destination interface, usually on two different systems. When you issue a command or send a message to a nonlocal interface, your system forwards those packets onto the local network. The interface with the destination IP address that is specified in the packet headers then retrieves the packets from the local network. If the destination address is not on the local network, the packets are then forwarded to the next adjacent network, or hop. By default, packet forwarding is automatically configured when you install Oracle Solaris.

Routing is the process by which systems decide where to send a packet. Routing protocols on a system “discover” the other systems on the local network. When the source system and the destination system are on the same local network, the path that packets travel between them is called a direct route. If a packet must travel at least one hop beyond its source system, the path between the source system and destination system is called an indirect route. The routing protocols learn the path to a destination interface and retain data about known routes in the system's routing table.

Routers are specially configured systems with multiple physical interfaces that connect the router to more than one local network. Therefore, the router can forward packets beyond the home LAN, regardless of whether the router runs a routing protocol. For more information about how routers forward packets, refer to Planning for Routers on Your Network.

Routing protocols handle routing activity on a system and, by exchanging routing information with other hosts, maintain known routes to remote networks. Both routers and hosts can run routing protocols. The routing protocols on the host communicate with routing daemons on other routers and hosts. These protocols assist the host in determining where to forward packets. When network interfaces are enabled, the system automatically communicates with the routing daemons. These daemons monitor routers on the network and advertise the routers' addresses to the hosts on the local network. Some routing protocols, though not all, also maintain statistics that you can use to measure routing performance. Unlike packet forwarding, you must explicitly configure routing on an Oracle Solaris system.

This section contains tasks for administering packet forwarding and routing on IPv4 routers and hosts. For information about routing on an IPv6-enabled network, refer to Configuring an IPv6 Router.

Routing Protocols Supported by Oracle Solaris

Routing protocols are classified as interior gateway protocols (IGPs), exterior gateway protocols (EGPs), or a combination of both. Interior gateway protocols exchange routing information between routers on networks under common administrative control. In the network topology shown in Figure 4-3, the routers run an IGP for exchanging routing information. Exterior gateway protocols enable the router that connects the local internetwork to an external network to exchange information with another router on the external network. For example, the router that connects a corporate network to an ISP runs an EGP to exchange routing information with its router counterpart at the ISP. Border Gateway Protocol (BGP) is a popular EGP that is used for carrying routing information between different organizations and IGPs.

The following table provides information about the Oracle Solaris routing protocols and the location of each protocol's associated documentation.

Table 4-1 Oracle Solaris Routing Protocols

Protocol
Associated Daemon
Description
For Instructions
Routing Information Protocol (RIP)
in.routed
IGP that routes IPv4 packets and maintains a routing table
Internet Control Message Protocol (ICMP) Router Discovery
in.routed
Used by hosts to discover the presence of a router on the network
Routing Information Protocol, next generation (RIPng) Protocol
in.ripngd
IGP that routes IPv6 packets and maintains a routing table
Neighbor Discovery (ND) Protocol
in.ndpd
Advertises the presence of an IPv6 router and discovers the presence of IPv6 hosts on a network

Oracle Solaris also supports the Open Source Quagga routing protocol suite. These protocols are available from the SFW consolidation disk, though they are not part of the mainOracle Solaris distribution. The following table lists the Quagga protocols:

Table 4-2 OpenSolaris Quagga Protocols

Protocol
Daemon
Description
RIP protocol
ripd
IPv4 distance vectoring IGP that routes IPv4 packets and advertises its routing table to neighbors.
RIPng
ripngd
IPv6 distance vectoring IGP. Routes IPv6 packets and maintains a routing table.
Open Shortest Path First (OSPF) protocol
ospfd
IPv4 link state IGP for packet routing and high availability networking
Border Gateway Protocol (BGP)
bgpd
IPv4 and IPv6 EGP for routing across administrative domains.

The following figure shows an autonomous system that uses the Quagga routing protocols:

Figure 4-2 Corporate Network That Runs Quagga Protocols

This figure shows a corporate network that runs the Quagga routing protocols. The context explains the figure.

The figure shows a corporate network autonomous system that is subdivided into two routing domains, A and B. Arouting domain is an internetwork with a cohesive routing policy, either for administrative purposes or because the domain uses a single routing protocol. Both domains in the figure run routing protocols from the Quagga protocol suite.

Routing Domain A is an OSPF domain, which is administered under a single OSPF domain ID. All systems within this domain run OSPF as their interior gateway protocol. In addition to internal hosts and routers, Domain A includes two border routers.

Border router R1 connects the Corporate Network to an ISP and ultimately the Internet. To facilitate communications between the Corporate Network and the outside world, R1 runs BGP over its externally facing network interface. The border router R5 connects Domain A with Domain B. All systems on Domain B are administered with RIP as their interior gateway protocol. Therefore, border router R5 must run OSPF on the Domain A facing interface and RIP on the Domain B facing interface.

For more information on the Quagga protocols, refer to the Open Solaris Quagga. For configuration procedures for these protocols, go to the documentation for quagga.

IPv4 Autonomous System Topology

Sites with multiple routers and networks typically administer their network topology as a single routing domain, or autonomous system (AS) . The following figure shows a typical network topology that would be considered a small AS. This topology is referenced in the examples throughout this section.

Figure 4-3 Autonomous System With Multiple IPv4 Routers

This topology diagram of an autonomous system is explained in the following context.

The figure shows an AS that is divided into three local networks, 10.0.5.0, 172.20.1.0, and 192.168.5. Four routers share packet-forwarding and routing responsibilities. The AS includes the following types of systems:

Configuring an IPv4 Router

This section contains a procedure and example for configuring an IPv4 router. To configure an IPv6-enabled router, refer to How to Configure an IPv6-Enabled Router.

Because a router provides the interface between two or more networks, you must assign a unique name and IP address to each of the router's physical network interfaces. Thus, each router has a host name and an IP address that are associated with its primary network interface, in addition to a minimum of one more unique name and IP address for each additional network interface.

You can also use the following procedure to configure a system with only one physical interface (by default, a host) to be a router. You might configure a single interface system as a router if the system serves as one endpoint on a PPP link, as explained in Planning a Dial-up PPP Link in System Administration Guide: Network Services.


Note - You can configure all interfaces of a router during Oracle Solaris system installation. For instructions, see Getting Started With Oracle Solaris 11 Express.


How to Configure an IPv4 Router

The following instructions assume that you are configuring interfaces for the router after installation.

Before You Begin

After the router is physically installed on the network, configure the router to operate in local files mode, as described in How to Configure a Host for Local Files Mode. This configuration ensures that routers boot if the network configuration server is down.

  1. Use the dladm show-link command to determine which interfaces are physically installed on the router.
    # dladm show-link

    The following example output from dladm show-link indicates that a qfe NIC with four interfaces and two bge interfaces are physically available on the system.

    LINK      CLASS     MTU      STATE   BRIDGE   OVER
    e1000g0   phys      1500     up      --       --
    e1000g1   phys      1500     up      --       --
    e1000g2   phys      1500     up      --       --
    nge0      phys      1500     up      --       --
    bge0      phys      1500     up      --       --
    bge1      phys      1500     up      --       --
  2. Review which interfaces on the router were configured and plumbed during installation.
    # ipadm show-addr

    The following example output from ipadm show-addr shows that the interface e1000g0 was configured during installation. This interface is on the 172.16.0.0 network. The nge interface and the bge interfaces have not been configured.

    ADDROBJ           TYPE     STATE        ADDR
    lo0/v4            static   ok           127.0.0.1/8
    e1000g0/v4        static   ok           172.16.26.232/24
  3. Configure another interface with a valid IP address.
    # ipadm create-addr -T static -a address addrobj

    where addrobj is an identifier of the interface and its corresponding address. The addrobj must use the naming format interface/user-defined-string.

    For example, to assign the IP address 192.168.84.3 to e1000g1, type the following:

    # ipadm create-addr -T static -a 192.168.84.3/24 e1000g1/v4

    Caution

    Caution - You can configure an IPv4 routers to receive its IP address through DHCP, but this is recommended only for very experienced DHCP system administrators.


    For more information about configuring single interfaces, refer to How to Configure an IP Interface in System Administration Guide: Network Interfaces and Network Virtualization. For more information about the ipadm command, see the ipadm(1M) man page.

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

    For example:

    172.16.26.232      deadsea        #interface for network 172.16.0.0
    192.168.200.20     timbuktu       #interface for network 192.168.200
    192.168.201.20     timbuktu-201   #interface for network 192.168.201
    192.168.200.9      gobi
    192.168.200.10     mojave
    192.168.200.110    saltlake
    192.168.200.12     chilean

    The interfaces timbuktu and timbuktu-201 are on the same system. Notice that the network address for timbuktu-201 is different from the network interface for timbuktu. The difference exists because the physical network media for network 192.168.201 is connected to the timbuktu-201 network interface while the media for network 192.168.200 is connected to the timbuktu interface.

  5. Enable IPv4 packet forwarding on the router.

    Use either of the following commands to enable packet forwarding:

    # ipadm set-prop -p forwarding=on ipv4

    At this point, the router can forward packets beyond the local network. The router also supports static routing, a process where you can manually add routes to the routing table. If you plan to use static routing on this system, then router configuration is complete. However, you need to maintain routes in the system routing table. For information on adding routes, see Configuring Routes and the route(1M) man page.

  6. (Optional) Start a routing protocol.

    The routing daemon /usr/sbin/in.routed automatically updates the routing table, a process that is known as dynamic routing. Turn on the default IPv4 routing protocols in either of the following ways:

    • Use the routeadm command, as follows:

      # routeadm -e ipv4-routing -u
    • Use the following SMF command to start a routing protocol such as RIP.

      # svcadm enable route:default

      The SMF FMRI associated with the in.routed daemon is svc:/network/routing/route.

    For information about the routeadm command, see the routeadm(1M) man page.

Example 4-2 Configuring the Default Router for a Network

This example shows how to upgrade a system with more than one interface to become a default router. The goal is to make Router 2, which is shown in Figure 4-3, the default router for network 172.20.1.0. 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 assumes that the router operates in local files mode, as described in How to Configure a Host for Local Files Mode.

After becoming superuser or assuming an equivalent role, you would determine out the status of the system's interfaces.

# dladm show-link
LINK     CLASS     MTU     STATE   BRIDGE   OVER
e1000g0  phys      1500    up      --       --
bge0     phys      1500    up      --       --
bge1     phys      1500    up      --       --
# ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
e1000g0/v4        static   ok           172.20.1.10/24

The output of dladm show-link indicates that three links are available on the system. Only the e1000g0 interface has been configured with an IP address. You would begin default router configuration by physically connecting the bge0 interface to the 10.0.5.0 network.

# ipadm create-addr -T static -a 10.0.5.10/24 bge0/v4
# ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
e1000g0/v4        static   ok           172.20.1.10/24
bge0/v4           static   ok           10.0.5.10/24

Continue by configuring the following network databases with information about the newly plumbed interface and the network to which it is connected:

# vi /etc/inet/hosts
127.0.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

Finally, use SMF to enable packet forwarding and then enable 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, the default router configuration for network 172.20.1.0 is not yet complete. You would need to do the following:

Routing Tables and Routing Types

Both routers and hosts maintain a routing table. The routing daemon on each system updates the table with all known routes. The system's kernel reads the routing table before forwarding packets to the local network. The routing table lists the IP addresses of networks that the system knows about, including the system's local, default network. The table also lists the IP address of a gateway system for each known network. The gateway is a system that can receive outgoing packets and forward them one hop beyond the local network. The following is a simple routing table for a system on an IPv4-only network:

Routing Table: IPv4
  Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
default              172.20.1.10          UG       1    532   ce0
224.0.0.0            10.0.5.100           U        1      0   bge0
10.0.0.0             10.0.5.100           U        1      0   bge0
127.0.0.1            127.0.0.1            UH       1     57   lo0

You can configure two types of routing on an Oracle Solaris system: static and dynamic. You can configure either or both routing types on a single system. A system that implements dynamic routing relies on routing protocols, such as RIP for IPv4 networks, and RIPng for IPv6 networks, to maintain its routing tables. A system that runs only static routing does not rely on a routing protocol for routing information and for updating the routing table. Instead, you must maintain the system's known routes manually through the route command. For complete details, refer to the route(1M) man page.

When you configure routing for the local network or autonomous system, consider which type of routing to support on particular routers and hosts.

The following table shows the different types of routing and the networking scenarios to which each routing type is best applied.

Routing Type
Best Used on
Static
Small networks, hosts that get their routes from a default router, and default routers that only need to know about one or two routers on the next few hops.
Dynamic
Larger internetworks, routers on local networks with many hosts, and hosts on large autonomous systems. Dynamic routing is the best choice for systems on most networks.
Combined static and dynamic
Routers that connect a statically routed network and a dynamically routed network, and border routers that connect an interior autonomous system with external networks. Combining both static and dynamic routing on a system is a common practice.

The AS that is shown is Figure 4-3 combines both static and dynamic routing.

Configuring Routes

To implement dynamic routing for an IPv4 network, use the routeadm or svcadm command to start the in.routed routing daemon. For instructions, see How to Configure an IPv4 Router. Dynamic routing is the preferred strategy for most networks and autonomous systems. However, your network topology or a particular system on your network might require static routing. In that case, you must manually edit the system routing table to reflect the known route to the gateway. The next procedure shows how to add a static route.


Note - Two routes to the same destination does not automatically cause the system to do load balancing or failover. If you need these capabilities, use IPMP, as explained in Chapter 13, Introducing IPMP, in System Administration Guide: Network Interfaces and Network Virtualization.


How to Add a Static Route to the Routing Table

  1. View the current state of the routing table.

    Use your regular user account to run the following form of the netstat command:

    % netstat -rn

    Your output would resemble the following:

    Routing Table: IPv4
      Destination           Gateway           Flags  Ref   Use   Interface
    -------------------- -------------------- ----- ----- ------ ---------
    192.168.5.125        192.168.5.10          U      1   5879   ipge0
    224.0.0.0            198.168.5.10          U      1  0       ipge0
    default              192.168.5.10          UG     1  91908
    127.0.0.1            127.0.0.1             UH     1  811302   lo0
  2. (Optional) Flush the existing entries in the routing table.
    # route flush
  3. Add a route that persists across system reboots.
    # route -p add -net network-address -gateway gateway-address
    -p

    Creates a route that must persist across system reboots. If you want the route to prevail only for the current session, do not use the -p option.

    add

    Indicates that you are about to add the following route.

    -net network-address

    Specifies that the route goes to the network with the address in network-address.

    -gateway gateway-address

    Indicates that the gateway system for the specified route has the IP address gateway-address.

Example 4-3 Adding a Static Route to the Routing Table

The following example shows how to add a static route to a system. The system is Router 2, the default router for the 172.20.1.0 network that is shown in Figure 4-3. In Example 4-2, Router 2 is configured for dynamic routing. To better serve as the default router for the hosts on network 172.20.1.0, Router 2 additionally needs a static route to the AS's border router, 10.0.5.150.

To view the routing table on Router 2, you would do the following:

# netstat -rn
Routing Table: IPv4
  Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
default              172.20.1.10          UG        1    249 ce0
224.0.0.0            172.20.1.10          U         1      0 ce0
10.0.5.0             10.0.5.20            U         1     78 bge0
127.0.0.1            127.0.0.1            UH        1     57 lo0

The routing table indicates two routes that Router 2 knows about. The default route uses Router 2's 172.20.1.10 interface as its gateway. The second route, 10.0.5.0, was discovered by the in.routed daemon running on Router 2. The gateway for this route is Router 1, with the IP address 10.0.5.20.

To add a second route to network 10.0.5.0, which has its gateway as the border router, you would do the following:

# route -p add -net 10.0.5.0/24 -gateway 10.0.5.150/24
add net 10.0.5.0: gateway 10.0.5.150

Now the routing table has a route for the border router, which has the IP address 10.0.5.150/24.

# netstat -rn
Routing Table: IPv4
  Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------
default              172.20.1.10          UG        1    249 ce0
224.0.0.0            172.20.1.10          U         1      0 ce0
10.0.5.0             10.0.5.20            U         1     78 bge0
10.0.5.0             10.0.5.150           U         1    375 bge0
127.0.0.1            127.0.0.1            UH        1     57 lo0

Configuring Multihomed Hosts

In Oracle Solaris, a system with more than one interface is considered a multihomed host. A multihomed host does not forward IP packets. However, you can configure a multihomed host to run routing protocols. You typically configure the following types of systems as multihomed hosts:

How to Create a Multihomed Host

  1. Configure each additional network interface that was not configured as part of the Oracle Solaris installation.

    Refer to How to Configure an IP Interface in System Administration Guide: Network Interfaces and Network Virtualization.

  2. Verify that IPv4 forwarding is not enabled on the multihomed host.
    # ipadm show-prop -p forwarding ipv4

    The following sample output shows that IPv4 forwarding is enabled:

    PROTO PROPERTY     PERM CURRENT      PERSISTENT   DEFAULT      POSSIBLE
    ipv4  forwarding   rw   on           --           off          on,off
  3. Turn off packet forwarding, if it is enabled on the system.
    # ipadm set-prop -p forwarding=off ipv4
  4. (Optional) Turn on dynamic routing for the multihomed host.

    Use either of the following commands to enable the in.routed daemon:

    • For the routeadm command, type the following:

      # routeadm -e ipv4-routing -u
    • To use SMF, type the following:

      # svcadm enable route:default

Example 4-4 Configuring a Multihomed Host

The following example shows how to configure the multihomed host that is shown in Figure 4-3. In the example, the system has the host name hostc. This host has two interfaces, which are both connected to network 192.168.5.0.

To begin, you would display the status of the system's interfaces.

# dladm show-link
LINK     CLASS     MTU     STATE   BRIDGE   OVER
bge0     phys      1500    up      --       --
bge1     phys      1500    up      --       --
bge2     phys      1500    up      --       --
e1000g0  phys      1500    up      --       --
e1000g1  phys      1500    up      --       --#

ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
e1000g0/v4        static   ok           192.168.5.82/24
 

The dladm show-link command reports that hostc has two interfaces with a total of five possible links. However, only e1000g0 has been configured with an IP address. To configure hostc as a multihomed host, you must configure another link, such as bge0. First, you would physically connect the bge0 interface to the 192.168.5.0 network. Then you would configure the bge0 interface, and make the interface persist across reboots.

# ipadm create-addr -T static -a 192.168.5.85/24 bge0/v4
# ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
e1000g0/v4        static   ok           192.168.5.82/24
bge0/v4           static   ok           192.168.5.85/24

Next, you would add the bge0 interface to the /etc/hosts database:

# vi /etc/inet/hosts
127.0.0.1           localhost
192.168.5.82        host3    #primary network interface for host3
192.168.5.85 host3-2 #second interface

Then, you would check the state of packet forwarding and routing on host3:

# ipadm show-prop -p forwarding ipv4
PROTO PROPERTY     PERM CURRENT   PERSISTENT   DEFAULT      POSSIBLE
ipv4  forwarding   rw   on        --           off          on,off

# routeadm
              Configuration   Current              Current
                     Option   Configuration        System State
---------------------------------------------------------------
               IPv4 routing   enabled              enabled
               IPv6 routing   disabled             disabled

           Routing services   "route:default ripng:default"

The routeadm command reports that dynamic routing through the in.routed daemon and packet forwarding are currently enabled. However, you would need to disable packet forwarding:

# ipadm set-prop -p forwarding=off ipv4

When packet forwarding is disabled, host3 becomes a multihomed host.

Configuring Routing for Single-Interface Systems

Single-interface hosts need to implement some form of routing. If the host is to obtain its routes from one or more local default routers, then you must configure the host to use static routing. Otherwise, dynamic routing is recommended for the host. The following procedures contain the instructions for enabling both routing types.

How to Enable Static Routing on a Single-Interface Host

This procedure enables static routing on a single-interface host. Hosts that use static routing do not run a dynamic routing protocol such as RIP. Instead, the host must rely on the services of a default router for routing information. The figure IPv4 Autonomous System Topology shows several default routers and their client hosts. If you supplied the name of a default router when you installed a particular host, that host is already configured to use static routing.


Note - You can also use the following procedure to configure static routing on a multihomed host.


For information about the /etc/defaultrouter file, see /etc/defaultrouter File. For information about static routing and the routing table, refer to Routing Tables and Routing Types.

  1. Verify whether the /etc/defaultrouter file is present on the host.
    # cd /etc
    # ls | grep defaultrouter
  2. Open a text editor to create or modify the /etc/defaultrouter file
  3. Add an entry for the default router.
    # vi /etc/defaultrouter
    router-IP
           

    where router-IP indicates the IP address of the default router for the host to use.

  4. Verify that routing and packet forwarding are not running on the host.
    # # ipadm show-prop -p forwarding ipv4
    PROTO PROPERTY     PERM CURRENT   PERSISTENT   DEFAULT      POSSIBLE
    ipv4  forwarding   rw   off        --           off          on,off
    
    # routeadm
       Configuration   Current              Current
                         Option   Configuration        System State
    ---------------------------------------------------------------
                   IPv4 routing   disabled             disabled
                   IPv6 routing   disabled             disabled
    
               Routing services   "route:default ripng:default"
  5. Add an entry for the default router in the local /etc/inet/hosts file.

    For information about configuring /etc/inet/hosts, refer to How to Change the IPv4 Address and Other Network Configuration Parameters.

Example 4-5 Configuring a Default Router and Static Routing for a Single-Interface Host

The following example shows how to configure static routing for hostb, a single-interface host on the network 172.20.1.0 that is shown in Figure 4-3. hostb needs to use Router 2 as its default router.

First, you would log in to hostb as superuser, or assume an equivalent role. Then, you would determine whether the /etc/defaultrouter file is present on the host:

# cd /etc
# ls | grep defaultrouter

No response from grep indicates that you need to create the /etc/defaultrouter file.

# vi /etc/defaultrouter
172.20.1.10

The entry in the /etc/defaultrouter file is the IP address of the interface on Router 2, which is attached to the 172.20.1.0 network. Next, you verify whether the host currently enables packet forwarding or routing.

# ipadm show-prop -p forwarding ipv4
PROTO PROPERTY     PERM CURRENT   PERSISTENT   DEFAULT      POSSIBLE
ipv4  forwarding   rw   on         --           off          on,off

# routeadm
   Configuration   Current              Current
                     Option   Configuration        System State
---------------------------------------------------------------
               IPv4 routing   disabled             disabled
               IPv6 routing   disabled             disabled

           Routing services   "route:default ripng:default"

Packet forwarding is enabled for this particular host. You would turn it off as follows:

# ipadm set-prop -p forwarding=off ipv4

Lastly, you would make sure that the host's /etc/inet/hosts file has an entry for the new default router.

# vi /etc/inet/hosts
127.0.0.1           localhost
172.20.1.18         host2    #primary network interface for host2
172.20.1.10 router2 #default router for host2

How to Enable Dynamic Routing on a Single-Interface Host

Dynamic routing is the easiest way to manage routing on a host. Hosts that use dynamic routing run the routing protocols provided by the in.routed daemon for IPv4 or in.ripngd daemon for IPv6. Use the next procedure to enable IPv4 dynamic routing on a single interface host. For more information about dynamic routing, refer to Packet Forwarding and Routing on IPv4 Networks.

  1. Verify whether the /etc/defaultrouter file exists.
    # cd /etc
    # ls | grep defaultrouter
  2. If /etc/defaultrouter exists, delete any entry that you find there.

    An empty /etc/defaultrouter file forces the host to use dynamic routing.

  3. Verify whether packet forwarding and routing are enabled on the host.
    # routeadm
       Configuration   Current              Current
                         Option   Configuration        System State
    ---------------------------------------------------------------
                   IPv4 routing   disabled             disabled
                   IPv6 routing   disabled             disabled
    
               Routing services   "route:default ripng:default"
    
    # ipadm show-prop -p forwarding ipv4
    PROTO PROPERTY     PERM CURRENT   PERSISTENT   DEFAULT      POSSIBLE
    ipv4  forwarding   rw   on         --           off          on,off
  4. If packet forwarding is enabled, turn it off
    # ipadm set-prop -p forwarding=off ipv4
  5. Enable routing protocols on the host.

    Use either of the following commands:

    • For the routeadm command, type the following:

      # routeadm -e ipv4-routing -u
    • To use SMF, type the following:

      # svcadm enable route:default

    Now IPv4 dynamic routing is enabled. The host's routing table is dynamically maintained by the in.routed daemon.

Example 4-6 Running Dynamic Routing on a Single-Interface Host

The following example shows how to configure dynamic routing for hosta, a single-interface host on the network 192.168.5.0 that is shown in Figure 4-3. hosta currently uses Router 1 as its default router. However, hosta now needs to run dynamic routing.

First, you would log in to hosta as superuser or assume an equivalent role. Then, you would determine whether the /etc/defaultrouter file is present on the host:

# cd /etc
# ls | grep defaultrouter
defaultrouter

The response from grep indicates that a /etc/defaultrouter file exists for hosta.

# vi /etc/defaultrouter
192.168.5.10

The file has the entry 192.168.5.10, which is the IP address for Router 1. You would delete this entry to enable static routing. Next, you would need to verify whether packet forwarding and routing are already enabled for the host.

# routeadm   Configuration   Current              Current
                     Option   Configuration        System State
---------------------------------------------------------------
               IPv4 routing   disabled             disabled
               IPv6 routing   disabled             disabled

           Routing services   "route:default ripng:default"

# ipadm show-prop -p forwarding ipv4
PROTO PROPERTY     PERM CURRENT   PERSISTENT   DEFAULT      POSSIBLE
ipv4  forwarding   rw   off         --           off          on,off

Both routing and packet forwarding are turned off for hosta. Turn on routing to complete the configuration of dynamic routing for hosta, as follows:

# svcadm enable route:default