Search My Techie Guy

Saturday, September 4, 2010

Network Interface configuration-Unix (Solaris )

Configuring unix network interfaces often becomes challenging for the new sysadmins and new owners of unix systems . This post details the steps involved in setting up of Solaris network interfaces and can be used as a check list if you are already familiar with Solaris network configuration .#ifconfig command is used in Solaris to configure the network interfaces .

The following lines describes the activities needed to configure a freshly installed network card from the root prompt. 

1. Enable the network card
#ifconfig hme0 plumb

#ifconfig -a should now show the following output which means device is enabled and is ready to configure ip address and netmask :


hme0: flags=842<BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 0.0.0.0 netmask 0
ether 3:22:11:6d:2e:1f

2. Configure ipaddress and netmask and bring the interface up
#ifconfig hme0 192.9.2.106 netmask 255.255.255.0 up
#ifconfig -a will now show the ip address , netmask and UP status as follows :hme0: flags=843<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.9.2.106 netmask ffffff00 broadcast 192.9.2.255
ether 3:22:11:6d:2e:1f


The file /etc/netmasks is used to define netmasks for ip addresses .

127.0.0.1, is the standard loop back  route and 127.0.0.0 is the default loopback ipaddress used by the kernel  when no interface is configured this will be the only entry dispalyed by the system on invoking ifconfig -a command.


3. Configuring Virtual interface
A virtual interface can be configured to enable hme0  reply to more than one ip addresses. This is possible by using hme0 alias which can be configured by ifconfig command only . The new  alias device name now becomes hme0:1  hme:2 etc.

#ifconfig hme0:1 172.40.30.4 netmask 255.255.0.0 up

#ifconfig -a will now show the original hme0 and alias interface :

hme0: flags=843<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.9.2.106 netmask ffffff00 broadcast 192.9.2.255
ether 3:22:11:6d:2e:1f
hme0:1: flags=842<BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.40.30.4 netmask ffff0000 broadcast 172.40.255.255
 
4. Ip-forwarding

IP forwarding allows you to forward all requests coming for a certain port or  URL to be redirected to a specified IP address.
ip forwarding becomes enabled automatically when the system detects more than one interface at boot time. The file involed is /etc/rc2.d/S69inet
ipforwarding is on by default but can be turned off by following command :

#ndd -set /dev/ip ip_forwarding 0
5. Default router Configuration
After interfaces and ipaddresses have been configured the system needs a default router to be able to talk to the world outside its local network .
You can specify a particular route for a particular address using the following command:

#route add -net 10.0.0.0 -netmask 255.0.0.0 172.40.30.1 1

6. Speed of the NIC (Half/Full duplex)

Command to check the speed of your interfaces (Solaris 5.10)

# dladm show-dev

The ndd utility is used to examine and set kernel parameters, namely the TCP/IP drivers.
Most kernel parameters accessible through ndd can be adjusted without rebooting the system. To see which parameters are available for a particular driver, use the following ndd command:

#ndd /dev/ce \?

Here /dev/ce is the name of the driver and  command lists the parameters for this particular driver.  Use of backslash in front of "?"  prevents the shell from interpreting the question mark as a special character.
Using \? will list all parameters for the driver and indicate whether the parameter is read only or read and write. The current parameter value or status information can be read by specifying the driver and parameter names. Only the parameters marked as read and write can be changed.

#ndd -set /dev/ce adv_autoneg_cap 0

  configurable parameters include:

        adv_1000fdx_cap         1000Mbps full duplex
        adv_100fdx_cap          100Mpbs full duplex
        adv_100hdx_cap          100Mbps half duplex
        adv_10fdx_cap           10Mpbs full duplex
        adv_10hdx_cap           10Mpbs half duplex

For example, to prevent the device 'ce' from advertising gigabit capabilities, enter (as super-user):


# ndd -set /dev/ce adv_1000hdx_cap 0
# ndd -set /dev/ce adv_1000fdx_cap 0

All capabilities default to enabled. Note that changing any capability parameter causes the link to go down while the link partners renegotiate the link speed/duplex using the newly changed capabilities.
You can obtain the current parameters settings using 'ndd -get'. In addition, the driver exports the current state, speed, duplex setting, and working mode of the link via ndd parameters (which are read only and may not be changed).

For example, to check link state of device nge0:

# ndd -get /dev/nge0 link_status
1
# ndd -get /dev/nge0 link_speed
100
# ndd -get /dev/nge0 link_duplex
2
# ndd -get /dev/nge0 link_rx_pause
1
# ndd -get /dev/nge0 link_tx_pause
1
The output above indicates that the link is up and running at 100Mbps full-duplex with rx/tx direction pause capability turned on.

for more information on Solaris NIC speeds and duplex settings, and how to apply these changes and make them persistent - i really recommend this article, has nice and easy to read stuff; http://www.brandonhutchinson.com/Solaris_NIC_speed_and_duplex_settings.html

Have fun :-)
Post a Comment