Thursday, October 25, 2012

Change network speed and duplex mode on Solaris 10

When I try to FTP some files using an interface, the speed is unexpectedly slow. Then I try to see the network interfaces status:

root@sunserver # dladm show-dev
nxge0           link: down      speed: 0     Mbps       duplex: unknown
nxge1           link: down      speed: 0     Mbps       duplex: unknown
nxge2           link: unknown   speed: 0     Mbps       duplex: unknown
nxge3           link: unknown   speed: 0     Mbps       duplex: unknown
igb0            link: up        speed: 100   Mbps       duplex: half
igb1            link: unknown   speed: 0     Mbps       duplex: half
igb2            link: up        speed: 100   Mbps       duplex: full
igb3            link: up        speed: 1000  Mbps       duplex: full


Seems 100 Half is a wrong setting. Since the speed is set by auto negotiation mode, we have to change it manually:

First, check the interface properties by "ndd":
root@sunserver # ndd -get /dev/igb0 ?
?                             (read only)
mtu                           (read and write)
min_allowed_mtu               (read only)
max_allowed_mtu               (read only)
adv_autoneg_cap               (read and write)
adv_1000fdx_cap               (read and write)
adv_1000hdx_cap               (read only)
adv_100fdx_cap                (read and write)
adv_100hdx_cap                (read and write)
adv_10fdx_cap                 (read and write)
adv_10hdx_cap                 (read and write)
adv_100T4_cap                 (read only)
link_status                   (read only)
link_speed                    (read only)
link_duplex                   (read only)
autoneg_cap                   (read only)
pause_cap                     (read only)
asym_pause_cap                (read only)
1000fdx_cap                   (read only)
1000hdx_cap                   (read only)
100fdx_cap                    (read only)
100hdx_cap                    (read only)
10fdx_cap                     (read only)
10hdx_cap                     (read only)
lp_autoneg_cap                (read only)
lp_pause_cap                  (read only)
lp_asym_pause_cap             (read only)
lp_1000hdx_cap                (read only)
lp_1000fdx_cap                (read only)
lp_100fdx_cap                 (read only)
lp_100hdx_cap                 (read only)
lp_10fdx_cap                  (read only)
lp_10hdx_cap                  (read only)
link_autoneg                  (read only)
tx_copy_thresh                (read and write)
tx_recycle_thresh             (read and write)
tx_overload_thresh            (read and write)
tx_resched_thresh             (read and write)
rx_copy_thresh                (read and write)
rx_limit_per_intr             (read and write)
intr_throttling               (read and write)
adv_pause_cap                 (read only)
adv_asym_pause_cap            (read only)


As those "read only" properties are not useful, let's filter out further:



root@sunserver # ndd -get /dev/igb0 ? |grep write
mtu                           (read and write)
adv_autoneg_cap               (read and write)
adv_1000fdx_cap               (read and write)
adv_100fdx_cap                (read and write)
adv_100hdx_cap                (read and write)
adv_10fdx_cap                 (read and write)
adv_10hdx_cap                 (read and write)
tx_copy_thresh                (read and write)
tx_recycle_thresh             (read and write)
tx_overload_thresh            (read and write)
tx_resched_thresh             (read and write)
rx_copy_thresh                (read and write)
rx_limit_per_intr             (read and write)
intr_throttling               (read and write)


Setting the speed is straight forward, just use ndd -set and toggle the settings:
root@sunserver # ndd -set /dev/igb0 adv_10hdx_cap 0
root@sunserver # ndd -set /dev/igb0 adv_10fdx_cap 0
root@sunserver # ndd -set /dev/igb0 adv_100hdx_cap 0
root@sunserver # ndd -set /dev/igb0 adv_100fdx_cap 1
root@sunserver # ndd -set /dev/igb0 adv_1000fdx_cap 0
root@sunserver # ndd -set /dev/igb0 adv_autoneg_cap 0



The above command lines are to disable 10Half, 10Full, 100Half, 1000Full and auto negotiation, and only enable 100Full. After running those command (without a reboot), let's check again:
root@sunserver # dladm show-dev
nxge0           link: down      speed: 0     Mbps       duplex: unknown
nxge1           link: down      speed: 0     Mbps       duplex: unknown
nxge2           link: unknown   speed: 0     Mbps       duplex: unknown
nxge3           link: unknown   speed: 0     Mbps       duplex: unknown
igb0            link: up        speed: 100   Mbps       duplex: full
igb1            link: unknown   speed: 0     Mbps       duplex: half
igb2            link: up        speed: 100   Mbps       duplex: full
igb3            link: up        speed: 1000  Mbps       duplex: full


oops, not difficult at all !

3 comments:

Poor IT Guy said...

* please be reminded that those ndd commands do NOT make configuration persistent. To make the setting permanent, prepare a script and include it in rc (eg. /etc/rc2.d/S68net-tune)

#!/usr/bin/ksh
# /etc/rc2.d/S68net-tune
PATH=/usr/bin:/usr/sbin
echo "Implementing Solaris ndd Tuning Changes "
# Force igb0 to 100fdx autoneg off
ndd -set /dev/igb0 adv_1000fdx_cap 0
ndd -set /dev/igb0 adv_100fdx_cap 1
ndd -set /dev/igb0 adv_100hdx_cap 0
ndd -set /dev/igb0 adv_10fdx_cap 0
ndd -set /dev/igb0 adv_10hdx_cap 0
ndd -set /dev/igb0 adv_autoneg_cap 0

saeed said...

Thanks a lot after trying so much and nothing worked but finally your solution did worked for me ....

saeed said...

Thanks a lot your Solution worked for me . it really helped me