Networking


Change or bind new IP address to an interface

To change IP address of an NIC

  • Change the IP address in /etc/hosts associated with the hostname for the IP address change to take effect after reboot.
  • Change /etc/defaultrouter with the address of the host's default gateway, if applicable.
  • Change /etc/netmasks file if the new IP address is in different subnet.
  • Chage the IP address and default route (if different subnet) for the changes to take effect immediately.
       ifconfig hem0 down
       ifcofnig hme0 unplumb
       ifconfig hme0 plumb
       ifconfig hme0 <IP address> netmask <subnet mask> up 
       route delete default <old-gateway IP>
       route add default <new-gateway IP>
  • Also, check /etc/inet/ipnodes file if it is solaris 10.

To bind an IP address to a network interface card

 # ifconfig qfe0 plumb
 # ifconfig qfe0 <IP Address> netmask <subnet> up
  • Create a file on /etc directory - hostname.qfe0 with hostname entry
  • Add entry on /etc/netmasks if IP address is on different subnet
  • Add entry on /etc/inet/hosts file with IP address and hostname


How to set mutiple IP address for a NIC in solaris?

To set multiple IP addresses for interface hme0, run the following commands

     ifconfig hme0:1 plumb
     ifconfig hme0:1 <ip-address> netmask <sub-net> up
     or
     ifconfig hme0 addif 192.168.1.10/24 up (it will add in the next pseudo interface like hme0:1)

Removing the pseudo interface and associated address is done with

     ifconfig hme0:1 0.0.0.0 down
     ifconfig hme0:1 unplumb
     or
     ifconfig hme0:1 down unplumb

As with physical interfaces, all you need to do is make the appropriate /etc/hostname.IF:X file.

  other example
   ifconfig hme1 plumb
   Ifconfig hme1 inet xxx.xxx.xxx.xxx netmask yyy.yyy.yyy.yyy broadcast + up
     Where x and y are the number for your IP address and netmask. The + sign after broadcast is telling ifconfig to calculate the broadcast address from the IP and netmask.

Solaris allows to set the maximum number of virtual interfaces upto a hard maximum of 8192. This value can be set using ndd command.

     /usr/sbin/ndd -set /dev/ip ip_addrs_per_if 4000


How to change the default Route in Solaris systems?

modify the /etc/defaultrouter file and add the default router there.



How to change the network speed and Duplex settings?

Solaris is often unable to correctly auto-negotiate duplex settings with a link partner. You can force the NIC into 100Mbit full-duplex by disabling auto-negotiation and 100Mbit half-duplex capability.

Example with hme0:

01. To make the changes to the running system, run the following commands.

     ndd -set /dev/hme adv_100hdx_cap 0
     ndd -set /dev/hme adv_100fdx_cap 1
     ndd -set /dev/hme adv_autoneg_cap 0

02. To preserve the speed and duplex settings after a reboot, add the following lines to /etc/system file.

     set hme:hme_adv_autoneg_cap=0
     set hme:hme_adv_100hdx_cap=0
     set hme:hme_adv_100fdx_cap=1

Note: the /etc/system change affects all hme interfaces if multiple NICs are present (ex. hme0, hme1). In case you have multiple instances, you need to select the specific hme instance first, e.g., use the following to select hme1:

     ndd -set /dev/hme instance 1

03. To see which parameters are supported by the hme driver

    ndd /dev/hme \?

More information about setting network speed in solaris can be found here

I have a script which can be used to determine the network speed in all types of Ethernet cards. That script can be downloaded here.



How to determine the current speed and duplex settting of NIC?

  ndd -get /dev/hme link_mode	  # 0 = halfdumplex; 1 = fullduplex
  ndd -get /dev/hme link_speed 	  # 0 = 10 Mbps; 1 = 100 Mbps


What is the commnad used to capture and inspect network packets?

'snoop' command captures packets from the network and displays their contents. Captured packets can be displayed as they are received, or saved to a file for later inspection.

To monitor hme0 port of packets coming from IP address 202.40.224.14

 # snoop -d hme0 | grep 202.40.224.14

To monitor hme1 ports of all packets

 # snoop -d hme1


To rename the hostname

    There are four files that must be modified in order to rename the hostname:
    1)  /etc/hosts
    2)  /etc/net/ticlts/hosts
    3)  /etc/net/ticolts/hosts
    4)  /etc/nodename
    5)  /etc/hostname.hmex
    6)  /etc/net/ticotsord/hosts


IP Multipathing:
http://docsun.cites.uiuc.edu/sun_docs/C/solaris_9/SUNWaadm/IPNETMPADMIN/p1.html
http://docs.sun.com/source/820-0184-10/link_aggregation.html

Adding defautl route
http://www.cyberciti.biz/faq/howto-configuring-solaris-unix-static-routes/
















Jeeva September 16, 2005, at 05:00 PM