Friday, November 28, 2008

Network Troubleshooting Tips for the Solaris 9 OS

http://www.sun.com/bigadmin/content/submitted/troubleshoot_network.jsp

Ross Moffatt, December 2006

Contents

Overview

This How-To covers some basic networking setup and troubleshooting on the Solaris 9 OS.

Two Tips for Network Performance Checking

a. Use FTP to copy a large file between hosts. Make sure you copy the file in both directions, as network performance problems can be directional. A possible cause of performance issues is autonegotiation being enabled at either the host or the router/switch. (See the Checking Network Settings section of this article for more details.)

b. Use ping with small (1Kbyte) and large (10K) packet sizes: Sometime routers in the network can have issues depending upon the size of the packet, as some use different queues within the router depending upon packet size.

Network Connectivity Troubleshooting

Here is a checklist to help you locate and resolve network connectivity problems.

1. Use ifconfig -a to check that interfaces are plumbed; that is, that they exist in the output. Also, check the network address and netmask of the interface.

To plumb an interface, run the command ifconfig plumb, for example:

# ifconfig ce1 plumb

Use ifconfig to see if the interface now exists.

# ifconfig -a
lo0: 
flags=1000849 
mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
ce0: 
flags=1000843 
mtu 1500 index 2
        inet 444.555.666.7 netmask ffffff00 broadcast 
444.555.666.255
        ether 5:3:de:de:de:de
ce1: 
flags=1000842 
mtu 1500 index 6
        inet 0.0.0.0 netmask 0
        ether 3:4:aa:bb:cc:dd

Give the interface its ipaddress and netmask.

ifconfig ce1 555.66.77.88 netmask 255.255.255.0 up

2. Ping the interface address; it should work!

3. Ping your router/switch. If you see => fail, then check your network settings. (See the Checking Network Settings section of this article.)

4. Ping a host on another network. If that doesn't work, check the routing table. (See the Checking Routing Settings section of this document.)

Checking Network Settings

You can check or set the status and configuration of a network interface with the ndd command. To use the ndd command, you first need to use the ifconfig command to find out what the device file is for the network interface in which you are interested.

# ifconfig -a
lo0: 
flags=1000849 
mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
ce0: 
flags=1000843 
mtu 1500 index 2
        inet 444.555.666.7 netmask ffffff00 broadcast 
444.555.666.255
        ether 5:3:de:de:de:de

This example shows only one interface plumbed, ce0, so the interface type is ce, and it is instance 0.

Now sometimes the ndd command uses a generic device file, e.g. /dev/ce, and you need to set the instance number first to know which instance is being interrogated. Otherwise, an instance-specific device file, e.g. /dev/bge0, is used. You can use ls -ld /dev/* to see if instance-specific device files exist, for example, ls -ld /dev/ce*.

# ls -l /dev/ce*
lrwxrwxrwx 1 root root 28 Mar 3 2006 /dev/ce ->
.../devices/pseudo/clone@0:ce

or

# ls -ld /dev/bge*
lrwxrwxrwx 1 root root 29 Oct 14 2005 /dev/bge ->
.../devices/pseudo/clone@0:bge
lrwxrwxrwx 1 root root 39 Oct 14 2005 /dev/bge0 ->
.../devices/pci@1f,700000/network@2:bge0
lrwxrwxrwx 1 root root 41 Oct 14 2005 /dev/bge1 ->
.../devices/pci@1f,700000/network@2,1:bge1
lrwxrwxrwx 1 root root 39 Oct 14 2005 /dev/bge2 ->
.../devices/pci@1d,700000/network@2:bge2
lrwxrwxrwx 1 root root 41 Oct 14 2005 /dev/bge3 ->
.../devices/pci@1d,700000/network@2,1:bge3

The following scripts print out all variables available via ndd. One is for a generic device file, and the other is for an instance-specific device file. The script is run with the instance required as a command-line option, that is, 0. You would need to change the script to have the correct interface device type. For example, you may need to replace ce with eri if your interface device file is /dev/eri.

#!/bin/sh
# ndd generic device script
ndd -set /dev/ce instance $1
for p in `ndd /dev/ce \\? | awk '{print $1}' | grep -v \\?`
do echo \"$p: `ndd /dev/ce $p`\"
done
 
Output.
# ./script 0
"instance: 0"
"adv_autoneg_cap: 0"
"adv_1000fdx_cap: 0"
"adv_1000hdx_cap: 0"
"adv_100T4_cap: 0"
"adv_100fdx_cap: 1"
"adv_100hdx_cap: 0"
"adv_10fdx_cap: 0"
"adv_10hdx_cap: 0"
"adv_asmpause_cap: 0"
"adv_pause_cap: 0"
"master_cfg_enable: 0"
"master_cfg_value: 0"
"use_int_xcvr: 0"
"enable_ipg0: 1"
"ipg0: 8"
"ipg1: 8"
"ipg2: 4"
"rx_intr_pkts: 8"
"rx_intr_time: 3"
"red_dv4to6k: 0"
"red_dv6to8k: 0"
"red_dv8to10k: 0"
"red_dv10to12k: 0"
"tx_dma_weight: 0"
"rx_dma_weight: 0"
"infinite_burst: 1"
"disable_64bit: 0"
"accept_jumbo: 0"
"laggr_multistream: 0"
 
 
 
#!/bin/sh
# ndd specific device script
for p in `ndd /dev/bge$1 \\? | awk '{print $1}' | grep -v \\?`
do echo \"$p: `ndd /dev/bge$1 $p`\"
done
 
Output.
# ./script 0
"autoneg_cap: 0"
"pause_cap: 1"
"asym_pause_cap: 1"
"1000fdx_cap: 0"
"1000hdx_cap: 0"
"100T4_cap: 0"
"100fdx_cap: 1"
"100hdx_cap: 0"
"10fdx_cap: 0"
"10hdx_cap: 0"
"adv_autoneg_cap: 0"
"adv_pause_cap: 1"
"adv_asym_pause_cap: 1"
"adv_1000fdx_cap: 0"
"adv_1000hdx_cap: 0"
"adv_100T4_cap: 0"
"adv_100fdx_cap: 1"
"adv_100hdx_cap: 0"
"adv_10fdx_cap: 0"
"adv_10hdx_cap: 0"
"lp_autoneg_cap: 0"
"lp_pause_cap: 0"
"lp_asym_pause_cap: 0"
"lp_1000fdx_cap: 0"
"lp_1000hdx_cap: 0"
"lp_100T4_cap: 0"
"lp_100fdx_cap: 0"
"lp_100hdx_cap: 0"
"lp_10fdx_cap: 0"
"lp_10hdx_cap: 0"
"link_status: 1"
"link_speed: 100"
"link_duplex: 1"
"link_autoneg: 0"
"link_rx_pause: 1"
"link_tx_pause: 0"
"loop_mode: 0"

I have found it best to set the network devices to disable autonegotiation on both the host and the router to which the host is connected. This is done by setting the following parameters: autoneg_cap, 1000fdx_cap, 1000hdx_cap, 100T4_cap, 100fdx_cap, 100hdx_cap, 10fdx_cap, 10hdx_cap, and adv_autoneg_cap.

I use this script in the /etc/rc2 directory to set the network parameters.

smart1 # more /etc/rc2.d/S95net_tune
#!/sbin/sh
PATH=$PATH:/usr/sbin;export PATH
case "$1" in
'start')
        /usr/sbin/ndd -set /dev/bge0 adv_1000fdx_cap 0
        /usr/sbin/ndd -set /dev/bge0 adv_1000hdx_cap 0
        /usr/sbin/ndd -set /dev/bge0 adv_100fdx_cap 1
        /usr/sbin/ndd -set /dev/bge0 adv_100hdx_cap 0
        /usr/sbin/ndd -set /dev/bge0 adv_10fdx_cap 0
        /usr/sbin/ndd -set /dev/bge0 adv_10hdx_cap 0
        /usr/sbin/ndd -set /dev/bge0 adv_autoneg_cap 0
        ;;
 
'stop')
        ;;
 
*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
esac
exit 0

The bge interface shows you the currently running status with the following parameters: link_status, link_speed, and link_duplex.

For information on interface device drivers, look in the man pages, in Section 7: Devices and Network Interfaces.

Checking Routing Settings

To see your current routing configuration, use netstat -r, and add the -n option depending on whether you want to see DNS names or IP addresses. For example:

smart1 # netstat -rn
Routing Table: IPv4
  Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
222.333.444.0 222.333.444.21 U 1 104943 bge0
default 222.333.444.1 UG 163805900
127.0.0.1 127.0.0.1 UH 538851300 lo0
smart1 # netstat -r
 
Routing Table: IPv4
  Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
222.333.444.0 myhost U 1 104943 bge0
default router UG 163805927
localhost localhost UH 538851327 lo0

If the default route is missing, then use the ifconfig command to add it on the fly:

ifconfg add default 222.333.444.1

Changing the IP Address

The following startup files need to be modified to change a host's IP address.

/etc/inet/hosts: Change the IP address, file format, IPhostname.

/etc/inet/netmasks: Add a new netmask, file format, networknetmask.

/etc/defaultrouter: Specify the new gateway for this subnet, file format, ipaddress.

About the Author

Ross Moffatt has been a UNIX System Administrator for more than 10 years. He can be contacted at ross.stuff@telstra.com.

No comments: