Glomation
 
Advanced Search
Welcome, Guest. Please login or register.

Login with username, password and session length
May 20, 2012, 02:08:17 AM
News: Welcome to GLomation peer support forum
Pages: [1]
Topic Tools  
Read July 18, 2009, 01:50:29 PM #0
davest

Changing IP address

Hi,

Can any one point me toward some focused reading and/or sample code for changing the IP address on the eth0 device from code 'on the fly'.

I know how to do it using the configuration files that are read on boot/linux startup.  I could have my program adjust those files and then force the user to re-boot.  I am hoping there is a way to have the user edit the IP address through my program and then make it take effect.

Thanks,  Dave S.
 
Read July 20, 2009, 08:55:27 AM #1
admin

Re: Changing IP address

You can use system call to change it,

  system("ifconfig eth0 xxx.xxx.xxx.xxx");

The program must have the privilege to run ifconfig command.
 
Pages: [1]
Jump to:  

Theme Update by Runic Warrior Originally created by m3talc0re