Hir@ has asked for the wisdom of the Perl Monks concerning the following question:

hi i want to know that if i change the device name in (network configuration) like eth0 to xxxx and then save, in which file all this information will save?? etc itself is a directory....i want to know the file!!!! i have to write a perl script that takes the input from that file.. for that reason i should know the file where all network configuration are saved.... kindly help me.. Regards.
  • Comment on etc file that contains the device (eth0 eth1...) information

Replies are listed 'Best First'.
Re: etc file that contains the device (eth0 eth1...) information
by zentara (Cardinal) on Feb 13, 2010 at 13:06 UTC
    If you are on linux, or unix-style os, type 'ifconfig' , and read "man ifconfig"

    For example, if you are root or have sudo priviledges for ifconfig:

    open DH, "/sbin/ifconfig 'eth0' | " or die "Could not run ifconfig"; my $data = join "", <DH>; close DH; close DH; print "$data
    You can also set properties with ifconfig, as shown in the man page, or google searches.But you will almost certainly need to be root, with all the permissions in the deep network layers.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku
      i hav almost done my task... :) anyways thnx 4 giving the information
Re: etc file that contains the device (eth0 eth1...) information
by ahmad (Hermit) on Feb 13, 2010 at 07:00 UTC

    it depends on your OS, it might be

    /etc/network/interfaces
    OR
    /etc/sysconfig/network-scripts
      yeah right... i hav done my task :)... thanx alot .
Re: etc file that contains the device (eth0 eth1...) information
by Anonymous Monk on Feb 13, 2010 at 07:03 UTC