<P>
  <BR>
I want to add an alias IP into a particular interface through ioclt<BR>
call. I used SIOCSIFADDR and SIOCSIFNETMASK to add the IP with the<BR>
netmask. one problem here i am facing, instead of adding the alias IP it<BR>
replace the actual IP of that interface. In my code i gave the interface<BR>
name as "eth0" not "eth0:0 or eth0:1" due to some constrain.<BR>
<BR>
int add_alias_ip(){<BR>
        struct ifreq   ifr;<BR>
        int sockfd;<BR>
<BR>
<BR>
        if( (sockfd=socket(AF_INET,SOCK_DGRAM,0))<0){<BR>
          .....................<BR>
          .....................                <BR>
        }<BR>
        memset (&ifr, '\0', sizeof (ifr));<BR>
<BR>
        ifr.ifr_addr=AF_INET;<BR>
        ifr.ifr_dstaddr=AF_INET;<BR>
        ifr.ifr_netmask=AF_INET;<BR>
<BR>
        strncpy (ifr.ifr_name, "eth0", 4);<BR>
<BR>
        ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr =<BR>
inet_addr("192.168.50.11");<BR>
<BR>
        if (ioctl(sockfd, SIOCSIFADDR, &ifr) < 0) {<BR>
                .................<BR>
          .................<BR>
        }<BR>
<BR>
        ((struct sockaddr_in *) &ifr.ifr_netmask)->sin_addr.s_addr =<BR>
inet_addr("255.255.255.192");<BR>
        if (ioctl(sockfd, SIOCSIFNETMASK, &ifr) < 0) {<BR>
             ...................<BR>
          ...................<BR>
        }<BR>
<BR>
        return 0;<BR>
}<BR>
<BR>
pls give some suggestion.........<BR>

</P>


Kanhu Charan Rauta <br>
Innomedia Techonologies Pvt. Ltd <br>
#3278,12Th Main, <br>
HAL 2nd stage. <br>
Banglore-560008.<br><br>
<a href="http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3"><IMG SRC="http://adworks.rediff.com/cgi-bin/AdWorks/sigimpress.cgi/www.rediff.com/signature-home.htm/1963059423@Middle5?OAS_query=null&PARTNER=3" BORDER=0 VSPACE=0 HSPACE=0></a>