Changing the IP address progrmmatically.

This is a discussion on Changing the IP address progrmmatically. within the Linux Networking forums, part of the Linux Forums category; Hello, Can anybody tell me if there exists a way to programmatically change, retrieve the IP of a NIC and ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-25-2003
Praveen
 
Posts: n/a
Default Changing the IP address progrmmatically.

Hello,
Can anybody tell me if there exists a way to programmatically change,
retrieve the IP of a NIC and modifying the routes in Linux..

I tried doing it with rtnetlink but since i din't get any good
documentation on it other than man pages, have got stuck up.. any
pointers to some good documentation on the same or some tutorials will
be of gr8 help to me..

Thanx in advance..
-Praveen M Nair.
Reply With Quote
  #2 (permalink)  
Old 11-25-2003
Neil Horman
 
Posts: n/a
Default Re: Changing the IP address progrmmatically.

Praveen wrote:
> Hello,
> Can anybody tell me if there exists a way to programmatically change,
> retrieve the IP of a NIC and modifying the routes in Linux..
>
> I tried doing it with rtnetlink but since i din't get any good
> documentation on it other than man pages, have got stuck up.. any
> pointers to some good documentation on the same or some tutorials will
> be of gr8 help to me..
>
> Thanx in advance..
> -Praveen M Nair.

The ioctl system call is what you want. You need to open a socket and
call ioctl on the socket descriptior to issue the SIOCGIFADDR/
SIOCSIFADDR commands. These allow you to specify a data structure which
contains both an interface name and address to set or retrieve.

HTH
Neil

--
/************************************************** *
*Neil Horman
*Software Engineer
*Red Hat, Inc., http://people.redhat.com/nhorman
*gpg keyid: 1024D / 0x92A74FA1
*http://www.keyserver.net
************************************************** */

Reply With Quote
  #3 (permalink)  
Old 11-29-2003
Praveen
 
Posts: n/a
Default Re: Changing the IP address progrmmatically.

Neil Horman <nhorman@rNeOdShPaMt.com> wrote in message news:<bpvijd$kf6$1@stan.redhat.com>...
> Praveen wrote:
> > Hello,
> > Can anybody tell me if there exists a way to programmatically change,
> > retrieve the IP of a NIC and modifying the routes in Linux..
> >
> > I tried doing it with rtnetlink but since i din't get any good
> > documentation on it other than man pages, have got stuck up.. any
> > pointers to some good documentation on the same or some tutorials will
> > be of gr8 help to me..
> >
> > Thanx in advance..
> > -Praveen M Nair.

> The ioctl system call is what you want. You need to open a socket and
> call ioctl on the socket descriptior to issue the SIOCGIFADDR/
> SIOCSIFADDR commands. These allow you to specify a data structure which
> contains both an interface name and address to set or retrieve.
>
> HTH
> Neil


Thanx Neil. But i have another dilemma, that is i have known that
ioctls don't work for IPV6, but in some sample codes for ioctls i have
come accross lines where they are checks for IPV6. any comments on
this will be helpful...

-Praveen M Nair.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:32 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0