Solaris 10 networking has a particular behaviour when handling multiples interfaces on a same subnet :

e1000g36001:2:flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 9
       inet 172.16.20.44 netmask fffffc00 broadcast 172.16.23.255
e1000g36001:3: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 9
       inet 172.16.20.41 netmask fffffc00 broadcast 172.16.23.255

In this case the output interface for this network could either be e1000g36001:2 or e1000g36001:3 :

$ netstat -nrv

IRE Table: IPv4
  Destination             Mask           Gateway          Device Mxfrg  Rtt  Ref Flg  Out  In/Fwd
 -   - - - - - --
172.16.20.0          255.255.252.0   172.16.20.44         e1000g36001:2  1500*    0   1 U      846     0
172.16.20.0          255.255.252.0   172.16.20.41         e1000g36001:3  1500*    0   1 U        0     0
default              0.0.0.0         172.16.23.254                1500*    0   1 UGS 9427622     0


In fact Solaris uses the first working interface, no matter if the interface number or last bit is the highest or not. The problem could become very annoying for filtering or NAT configurations as we can't guess the output IP of this machine.

Example: in the following configuration, a default bind is set on 172.16.20.44 to allow this machine to make output connections on other networks :

Virtual server: V_OUT_TEST           Status: enabled  IP: 111.222.333.444
     default ---> R_OUT_TEST: 172.16.20.44,  default (Active)

If the other IP 172.16.20.41 is used for output, the NAT won't work.


The solution is to use the -setsrc option of the route command to force the output interface. In our example, we'd put the command on a script at boot time :

$ route add default 172.16.31.254 -setsrc 172.16.20.44 

$ route get default
    route to: default
destination: default
       mask: default
   gateway: 172.16.23.254
      setsrc: <my-output-interface-hostname>
  interface: e1000g36001:2
       flags: <UP,GATEWAY,DONE,STATIC,SETSRC>
 recvpipe  sendpipe  ssthresh    rtt,ms rttvar,ms  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0


Notes :

  • The old -ifp modifier may work too :
$ route add -ifp e1000g36001:2 default 172.16.23.254
  • For IPv6, ifconfig has a preferred argument.
  • If the setsrc interface looks broken, Solaris will use another interface alias available on this network (in the above example if e1000g36001:2 is broken, e1000g36001:3 will be used). To avoid this, use the DEPRECATED flag of ifconfig.