Strategies for Network Administration in Oracle® Solaris 11.2

Exit Print View

Updated: September 2014
 
 

Configure Datalinks, IP Interfaces, and IP Addresses

    The following configuration tasks are described:

  • Verify the current network configuration mode.

  • Determine how network interface names on the system map to physical interfaces.

  • Configure a static IP interface and address.

  • Add a persistent default route.

Example 2-1  Verifying the Active Network Mode

After installing Oracle Solaris, verify which configuration mode you are using as follows

# netadm list
TYPE        PROFILE        STATE
ncp         Automatic      disabled
ncp         DefaultFixed   online
loc         Automatic      offline
loc         NoNet          offline
loc         DefaultFixed   online

The previous output indicates that the system is using the fixed mode, which means you use the dladm, ipadm, and route commands to manage network configuration.

If the system-generated Automatic profile is online, enable the DefaultFixed profile as follows:

# netadm enable -p ncp DefaultFixed
Example 2-2  Determining How Network Interface Names Map to Physical Interfaces

Prior to configuring an IP interface and static IP address for a system, determine how the network interface names on the system map to the physical interfaces. On a system with multiple physical networks, use the dladm command to obtain this information:

# dladm show-phys
LINK              MEDIA                STATE      SPEED  DUPLEX    DEVICE
net0              Ethernet             up         1000   full      e1000g0
net1              Ethernet             unknown    0      unknown   pcn0
Example 2-3  Configuring a Static IP Address

You first create the IP interface and then you configure an IP address for the interface. You can associate multiple IP addresses with a single IP interface. In the following example, ronj is used for example purposes only.

# ipadm create-ip net0
# ipadm show-if
IFNAME     CLASS      STATE      ACTIVE      OVER
lo0        loopback   ok         yes         ---
net0       ip         down       no          ---
# ipadm create-addr -T static -a 10.163.198.20/24 net0/ronj
# ipadm show-if
IFNAME      CLASS     STATE      ACTIVE      OVER
lo0         loopback  ok         yes         ---
net0        ip        ok         yes         ---
# ipadm show-addr
ADDROBJ     TYPE      STATIC     ADDR
lo0/v4      static    ok         127.0.0.1/8
net0/ronj   static    ok         10.163.198.20/24
lo0/v6      static    ok         ::1/128

If your site implements IPv6 addressing, use the addrconf argument with the –T option to specify an automatically generated IPv6 address:

# ipadm create-ip net0
# ipadm create-addr -T addrconf net0/addr

If you need to obtain the IP address from a DHCP server, type the following commands:

# ipadm create-ip net0
# ipadm create-addr -T dhcp net0/addr
Example 2-4  Adding a Persistent Default Route

After configuring an IP interface and address, add a persistent default route as follows:

# route -p add default 10.163.198.1
add net default: gateway 10.163.198.1
add persistent net default: gateway 10.163.198.1

For detailed instructions, see Creating Persistent (Static) Routes in Configuring and Administering Network Components in Oracle Solaris 11.2 .