Interface Configuration


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 >

  • /etc/inet/ hosts

  • /etc/nodename

/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/hosts

The /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.

graphics/alert_icon.gif

The file /etc/hosts is a symbolic link to /etc/inet/hosts and is included for BSD compatibility. The actual file is /etc/inet/hosts , so be aware of this because it is a frequent exam question.


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/nodename

This 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 Interface

During 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:

  1. Edit the file /etc/inet/hosts and assign an IPv4 address and hostname for this interface. To use the IPv4 address 192.168.28.79 and the hostname testnet , add the following entry to the file:

     192.168.28.79    testnet 

    Save the file and exit the editor.

  2. Edit the file /etc/hostname.hme1 and insert the hostname of the system you just entered. In this case the file contains the single entry, testnet .

  3. Reboot the system and the network interface is automatically configured.

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:

  • Run the sys-unconfig command, which will reset the system to its "as-manufactured" state and shut down. When you start the system again, you have to re-enter the configuration information that was entered when the Solaris operating system was installed. You can assign a new hostname at this point. You should note that this command does not affect the file systems and data held on disks; only the system identification is affected.

  • Modify the following six files to reflect the new hostname, and then reboot the system:

    • /etc/inet/hosts

    • /etc/nodename

    • /etc/hostname.< interface > files, such as /etc/hostname.hme0

    • /etc/net/ticlts/hosts This file is referenced by the Transport Layer Interface (TLI).

    • /etc/net/ticots/hosts This file is referenced by the Transport Layer Interface (TLI).

    • /etc/net/ticotsord/hosts This file is referenced by the Transport Layer Interface (TLI).

Logical Interfaces

Logical 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

  • A Web server requires multiple URLs to appear to have multiple Web resources

  • An application server runs multiple applications, where each application requires a dedicated IP address or hostname

  • You are running a high-availability failover mechanism where a logical interface can act as a failover for another network interface

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

  • Cost There is no need to purchase additional network cards.

  • Administration With everything on a single system, rather than multiple systems, the administration overhead is reduced.

  • Appearance Your department appears to be much larger than it really is.

The disadvantages are

  • Network load Even though the appearance of multiple interfaces might look good, logical interfaces are actually tied to a specific physical network interface, so the network traffic could increase, creating potential network problems.

  • Startup overhead When a system boots, each interface, including logical interfaces, is configured and enabled, so if a number of logical interfaces are operational, the boot time will increase significantly.

Configuring a Logical Interface

A 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.

graphics/alert_icon.gif

Note that a logical interface contains the same index number as the physical interface when you use the ifconfig -a command to view it because it is physically tied to the physical interface.


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 
graphics/note_icon.gif

When you use ifconfig -a to view the network interface configuration, only the physical interface displays an associated ethernet address. Logical interfaces do not have their own ethernet address because they are tied to the physical interface.


Removing a Logical Interface

A 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 
graphics/alert_icon.gif

The down option must come before the unplumb option to ensure the logical interface is first disabled, then unconfigured. Exam questions frequently offer several alternative syntax options; make sure you get the right one.


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 


Solaris 9 Network Administration Exam Cram 2 (Exam Cram CX-310-044)
Solaris 9 Network Administrator Exam Cram 2 (Exam CX-310-044)
ISBN: 0789728702
EAN: 2147483647
Year: 2003
Pages: 174
Authors: John Philcox

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net