retrieving and changing the ip address

N

niksniil

Guest
can anybody have some idea where the ip address of the system actually stored ? i am using macmini. can anybody have the code to retrieve and change the ip of a system? i know... this will look as funny as we can change the ip manually... but i want to do it by a code.
 
OP
K

Kokopelli

Guest
When you say "do it by a code" what do you mean?
I would use network locations if they can suit your needs. If not ifconfig probably works on OS X, though I have not tried changing my address using it....

To get the address though here is the simple way:
Code:
ifconfig | grep 'broadcast' | awk '{print $2}'
 
OP
N

niksniil

Guest
Kokopelli said:
When you say "do it by a code" what do you mean?
I would use network locations if they can suit your needs. If not ifconfig probably works on OS X, though I have not tried changing my address using it....

To get the address though here is the simple way:
Code:
ifconfig | grep 'broadcast' | awk '{print $2}'
hope u wont mind, i dont know whether its possible or not? but my belief is that if we can change the IP manually by going thru System preferences->network->configure, then its also possible to do it by a program. But the thing is to find the correct destination. I mean to where to make change? It still remains a question for me. There will be system calls like ioctl() through which we can access hardware or caches to make the changes in IP. So i am trying ... inform u ppl if there is any improvement.. and pls help me by sharing ur ideas
-----------------------------------
mac mini 1.44g, os x
 
OP
K

Kokopelli

Guest
Again though you are not being specific enough. ioctl() is probably a little lower leve than you need or want. Since you seem to want to actually want to write a program to handle this though.... The System Configuration Framework is probably what you are looking for.

http://developer.apple.com/documentation/Networking/Conceptual/SystemConfigFrameworks/index.html

This is a lot more work than necessary though depending upon what you are trying to achieve. If you want to code it though that is where to start.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top