#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    79
    Rep Power
    15
    Hello,
    I need to run ifconfig eth0:ip.ip.ip.ip
    when Linux server reboot.
    But How can I do this ?

    Thanks
  2. #2
  3. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    'ifconfig' command not found or something? Can you be more specific?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    79
    Rep Power
    15
    Hello,
    No, I can found ifconfig,
    But it need to run automatically.
    (when linux reboot)

    Thanks
  6. #4
  7. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    Which linux distribution, Redhat?
    Have you configured your network interface thru Control Panel/Network Configurator?
    What NIC? Is it ISA or PCI? which module?
    Static IP or DHCP?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    79
    Rep Power
    15
    Ya,
    I use RedHat Linux 6.0,
    and it can run ifconfig eth0:0 xx.xx.xx.xx under [@linux]#.
    But, each time when linux reboot,
    I must run ifconfig again.
    Therefore, I hope linux can run this command aotumatically.

    Thanks
  10. #6
  11. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    Since you haven't provided me other info, I will use Dlink DFE530TX NIC as an example with Redhat 6.0:
    1) create rc.modules file with the following 2 lines in it..
    #!/bin/sh
    insmod /lib/modules/2.2.5-15/net/via-rhine.o
    (2) Place this rc.modules to /etc/rc.d/ (as /etc/rc.d/rc.modules) and chmod
    it to 755.
    3) /etc/conf.modules:
    alias eth0 via-rhine
    #############################
    note: dlink 530tx uses via-rhine.o. Check your /etc/conf.modules to find out which module your nic uses.
    Verify if it's found in /lib/modules/2.2.5-15/net, I don't remember the exact dir path for redhat 6.0 since I no longer run any linux for quite a while (been running freebsd since then), you need to find out if it's the correct path to your nic's driver.
    If your nic is ISA, not PCI, you should specify some opton in your /etc/conf.modules like..
    options eth0 io=0xf880 irq=10
    alias eth0 via-rhine
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    79
    Rep Power
    15
    Does linux has batch file like autoexec.bat of DOS ?
    for example,
    I need to run "ls" command on the text mode when linux reboot.

    Thanks
  14. #8
  15. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    Yes. Like those rc* in your /etc directory.
    As for the ls thing, do not run the ls itself. Write a script and put what you want there, then put the line to execute the script to /etc/rc.d/rc.local
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    79
    Rep Power
    15
    Oh,
    Would u please tell me a example for How to write a script?
  18. #10
  19. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    ## /etc/rc.d/rc.local file:
    #!/bin/sh
    /usr/local/apache/bin/apachectl graceful

    ## /usr/local/apache/bin/apachectl is a script (written by my former co-worker )

    ## another script sample:
    #!/bin/sh
    ls -Al

    You can even write a perl script and place it in rc.local.
    ## /tmp/script:
    #!/usr/bin/perl
    open(NEWFILE,">>/tmp/newfile");
    print NEWFILE "hello world";
    close(NEWFILE);

    ## /etc/rc.d/rc.local file:
    #!/bin/sh
    perl /tmp/script

    Doing so will create a new file called "newfile" in /tmp directory with one line "hello world" in it after reboot.
  20. #11
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    11
    Rep Power
    0
    Why would you need to do this in the first place? Are you changing the IP address on each reboot?

    For a static IP you should be able to just create the file in /etc/sysconfig/network-scripts/ifcfg-ethX (where X is the card you're setting, 0 for the first one). If you set an address during installation or with linuxconf, the file should already be there and you can just edit it.

    Sorry if I misunderstood the issue.

    -Joe

IMN logo majestic logo threadwatch logo seochat tools logo