System and network administrators regularly use three main network interface configuration files. The use of configuration files enables changes, or additions, to persist across reboots so that the network interfaces are automatically configured when the system goes through the boot process. These files are
/etc/hostname.< interface >The Solaris installation program configures the primary network interface for you. It does this by creating the necessary /etc/hostname.< interface > file. For example, if your system has an hme0 primary interface, the file /etc/hostname.hme0 is created and populated with either the hostname or IPv4 address that is associated with the interface. When the system reboots, the startup script, /etc/rcS.d/S30network.sh , configures and enables the interface. /etc/inet/hostsThe /etc/inet/hosts file provides IPv4 address-to-hostname mapping, so that you don't have to always specify a host by its IPv4 address. It allows normal names to be assigned, such as ultra10 or server1 . This file also allows aliases and comments, permitting a system to have several names.
The following is a typical /etc/inet/hosts file: # cat /etc/hosts # # Internet host table # localhost 192.168.28.11 test1 192.168.28.19 inetpc 192.168.28.25 winpc 192.168.28.28 ultra10 ultra10.mobile-ventures.net loghost 192.168.28.127 sparc5 nismaster 209.67.50.203 www.mobile-ventures.net The /etc/inet/hosts file is referenced when the system boots and configures the network interfaces. /etc/nodenameThis file contains a single entrythe hostname of the systemand is used to identify the authoritative name by which applications and remote systems will know this system. This name is called the canonical name canonical because it is the ultimate authority (derived from canonical law in the church ) that is to be believed. Configuring a Network InterfaceDuring the Solaris 9 installation program, only the primary network interface is configured, so any other network interfaces must be configured manually. For example, if you have a system with a primary interface, hme0 , and a second interface, hme1 , then you will have to configure hme1 . The following instructions will achieve this:
The configuration is permanent and persists across subsequent reboots of the system. Sometimes, such as when a company reorganizes, it becomes necessary to change a system's hostname. There are two ways of achieving this:
Logical InterfacesLogical interfaces, also known as virtual interfaces, enable you to assign more than one IPv4 address to a single network interface, and each IPv4 address can be of a different unicast class. It is a very simple way to make a single system appear as many systems. You might want to use logical interfaces when
Each logical interface that is configured is assigned its own unique IPv4 address and a unique hostname, and appears as if it is a completely separate network interface. The main advantages of using logical interfaces are
The disadvantages are
Configuring a Logical InterfaceA logical interface is configured using the same command ( ifconfig ) that is used to configure a physical network interface. For example, in a system with a physical interface hme0 , the first logical interface is named hme0:1 , the second hme0:2 , and so on. To view the current network interface configuration, enter the ifconfig -a command as shown here: #ifconfig -a lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 192.168.28.28 netmask ffffff00 broadcast 192.168.28.255 ether 8:0:20:b3:41:13 To create a logical interface hme0:1 , with an IPv4 address of 192.168.28.128 , use the following command: #ifconfig hme0:1 plumb 192.168.28.128 up Now, view the current network interface configuration again to see the newly created logical interface: #ifconfig -a lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 192.168.28.28 netmask ffffff00 broadcast 192.168.28.255 ether 8:0:20:b3:41:13 hme0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 192.168.28.128 netmask ffffff00 broadcast 192.168.28.255 At this point, you can add an entry to /etc/inet/hosts for the new IPv4 address and reference this as if it were a separate system.
Alternatively, rather than having to remember the next logical interface number, you can use the addif option of ifconfig to select the next number for you. The following command creates an additional logical interface, which is named hme0:2 , with an IPv4 address of 192.168.28.29 : #ifconfig hme0 addif 192.168.28.29 up Created new logical interface hme0:2 View the current network interface configuration to see the second logical interface: #ifconfig -a lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 192.168.28.28 netmask ffffff00 broadcast 192.168.28.255 ether 8:0:20:b3:41:13 hme0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 192.168.28.128 netmask ffffff00 broadcast 192.168.28.255 hme0:2: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 192.168.28.29 netmask ffffff00 broadcast 192.168.28.255
Removing a Logical InterfaceA logical interface is removed in the same way a physical interface is removed: by using the ifconfig command. To remove the hme0:2 interface, created in the previous subsection, enter the following command: #ifconfig hme0:2 down unplumb
Alternatively, if you know the IPv4 address of the logical interface you want to remove, you can use that instead. The following command removes the logical interface that was created in the previous subsection, with an IPv4 address of 192.168.28.128 : #ifconfig hme0 removeif 192.168.28.128 |