Solaris : Things to know about Solaris Virtual Interfaces

Know Everything about Solaris  Virtual Interfaces Solaris TCP/IP allows multiple logical interfaces to be associated with a physical network interface. This allows a single machine to be  assigned multiple IP addresses, even though it may have only one network interface.
In Solaris 8 and above you can go greater than 256 ( 0-255 ) which is configurable with NDD. The command “ndd -set /dev/ip ip_addrs_per_if 1-8192” will permit you to configure as many as your addressing structure will permit (up to 8191 virtual hosts.)

Steps to create Virtual Interfaces

1.  Create an entry in the /etc/hosts file ( or nis host map) for each of the virtual interfaces with the hostname and IP address you want to use.  Don’t forget to add the hostname to /etc/hosts NIS, NIS+, and/or DNS database.
 
2.  Create a /etc/hostname. file for each of the interfaces.    
Example :   /etc/hostname.nxge0:1, hostname.nxge0:2, hostname.nxge0:3…nxge0:255
The file can contain a single line with either the ip number or hostname reference. For example, if you are using the nxge0 interfaces ( this can also be done for an hme or any other interface. ) , you would create the following files:
            
    /etc/hostname.nxge0:1   
    /etc/hostname.nxge0:2
       
  and so on.         
 
 
3.  If subnetting is being used, there should be an entry in the /etc/netmasks file in the following format:
        
    network_address     netmask
 
    The network_address should be the network address before subnetting.  For example, a class B network that is subnetted to a Class C would have an entry such as:
 
    157.145.0.0  255.255.255.0
 
4.  Reboot the system
 
5.  Verify changes with an ifconfig -a
 
Important Note : Multiple interfaces in the same subnet is not recommended unless they are in an ipmp group.  So, while configuring virtual interfaces, care must be taken to make sure that 1) they are in a different subnet or 2) if they are in the same subnet, they are in an ipmp group.  
 

Troubleshooting:

Below will give you guideline to troubleshoot Virtual interface related below issues:
  •  Can not ping virtual ip address
  •  Can not ping virtual hostname
  •  System is not accessible via virtual IP address
  •  No connection to system virutal IP/hostname
  •  ifconfig return physical interfaces setup only
  •  network configuration gone after system reboot
:::: Verify the Physical links and Network Devices
1. Verify the physical link level and network device media is working fine. Always check if there are any problem on network hardware level as the logical interfaces are always bound to the physical interface. As the virtual interface is dependent on the physical link and the network connect,  the virtual interfaces/hosts bound to the affect physical link will also be affected.  Please  refer to the following document to troubleshoot the physical link problems.
Perform Ethernet cable and switch connection checks when cable or connection are suspect.
2. Verify the network driver is loaded and physical interfaces are plumbed up .
a. Check if driver module has been loaded properly.
 
 # modinfo |grep hme
 
117 7bb6a000   f798   7   1  hme (10/100Mb Ethernet Driver v1.180)
 
b. Use the kstat(1M) and netstat(1M) commands to check driver kernel statistic and interface status.
 
For example:
 
 
# netstat -i
 
Name  Mtu  Net/Dest      Address        Ipkts  Ierrs Opkts  Oerrs Collis Queue
lo0   8232 loopback      localhost      572    0     572    0 0      0
hme0  1500 chilli        chilli         2698454 0     78747  0 0 0
Further details of the various kstat(1M) statistics on network interfaces can be found in Document: 1008010.1 – “hme” and   qfe  kstat – fast ethernet driver statistics.
 
c. Checked that the interfaces are plumbed using the ifconfig(1M) command:
 
 
# ifconfig -a
 
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL>
mtu 8232 index 1
 inet 127.0.0.1 netmask ff000000
hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 150- index 2
 inet 129.158.137.27 netmask ffffff00 broadcas
129.158.137.255
 ether 8:0:20:b8:6:a6
hme0:2: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
 inet 10.158.169.10 netmask ffffff00
3. Verify the  the name service is properly defined in the name service switch file (nsswitch.conf(4)) and the hostname is defined in the hosts database, e.g. hosts(4) file.
Name switch file /etc/nsswitch.conf contains the information of  name service sources and lookup order. Make sure all the entries are properly specified in the intent search orders of the configured name service database.
The /etc/hosts file is used as local file database if the ‘file’ keyword appear in /etc/sswitch.conf entry definition. The hostname and the associating IP address for the virtual interface should be defined in the /etc/hosts file.
For example:
 
In /etc/hosts
10.158.169.10   logical-host hme0:2
4. Verify that logical interfaces IP address or hostname entry is permanently configured.
In order to create a permanent virtual interface associated with a physical ethernet interface, the file  /etc/hostname.<network interface:#>  must exists. The  actual hostname assigned in the hosts database (e.g.: /etc/hosts) or just the IP address, must be configured  in /etc/hostname.<network_interface:#> file.
For example:   With actual IP address in /etc/hostname.hme0:2:
# cat /etc/hostname.hme0:2
10.169.158.10
Or with the hostname which has been defined in the hosts database (e.g. /etc/hosts) in /etc/hostname.hme0:2:
# cat /etc/hostname.hme0:2
logical-host
 
5. Once configured, reboot the system for the changes to take effect. Execute the ifconfig(1M) and ping(1M) utilities to further verify the virtual interface status.
After reboot, simply run ‘ifconfig’ to confirm if the configuration done successfully.
# ifconfig -a
 
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
  inet 127.0.0.1 netmask ff000000
hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
  inet 129.158.137.27 netmask ffffff00 broadcast 129.158.137.255
ether 8:0:20:b8:6:a6
hme0:2: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
  inet 10.158.169.10 netmask ffffff00
# ping -s 10.158.169.10
PING 10.158.169.10: 56 data bytes
64 bytes from logical-host (10.158.169.10): icmp_seq=0. time=0.404 ms
64 bytes from logical-host (10.158.169.10): icmp_seq=1. time=0.220 ms
64 bytes from logical-host (10.158.169.10): icmp_seq=2. time=0.216 ms
64 bytes from logical-host (10.158.169.10): icmp_seq=3. time=0.201 ms
64 bytes from logical-host (10.158.169.10): icmp_seq=4. time=0.231 ms
^C
—-10.158.169.10 PING Statistics—-
5 packets transmitted, 5 packets received, 0% packet loss
round-trip (ms)  min/avg/max/stddev = 0.201/0.254/0.404/0.084
6. If you have reached this stage and the virtual interface configured is not persistent, further troubleshooting is required.   Generate troubleshooting output/data using the latest version of the Solaris Explorer script for the Oracle Support Call.

How do we create More virutual interfaces ( say … 1024) without creating multiple hostname.xxx files.?

we can use a startup script to create many logical  interfaces without having to use multiple /etc/hostname.hme0:xx files.
Step 1:  At the bottom of S69inet, place the following lines:
if [ -f /virtinterface_up ]
then
               /virtinterface_up
fi
 
2) create a file “/virtinterface_up”, make it executable and put the following lines  of code in the file:
#!/bin/ksh
 
# set this value to the number of logical interfaces you want per physical interface
typeset -i N=1024
 
#set these to the starting IP_addr of the range you want to configure, e.g. first IP_addr == 172.16.10.1
typeset -i IP3=172
typeset -i IP2=16
typeset -i IP1=10
typeset -i IP0=1
 
# set this value to 1 greater than the number of logical interfaces you want per physical interface
ndd -set /dev/ip ip_addrs_per_if 1025
 
# set this to the correct type of physical interface 
PIF=hme0
 
typeset -i n=0                                   
while ((n<N))
do
  n=n+1
  addr=”$IP3.$IP2.$IP1.$IP0″
  ifconfig $PIF:$n $addr up
  IP0=IP0+1
  if ((IP0==255))
  then
  IP0=1
  IP1=IP1+1
  if ((IP1==255))
  then
  IP1=0
  IP2=IP2+1
  fi
  fi
done
Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

1 Response

  1. September 16, 2015

    […] Read – Things to know about Solaris Virtual Interfaces […]

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us