LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   problems with /etc/rc.d/rc.local and ifconfig (https://www.linuxquestions.org/questions/slackware-14/problems-with-etc-rc-d-rc-local-and-ifconfig-246335/)

designguy79 10-23-2004 10:18 AM

problems with /etc/rc.d/rc.local and ifconfig
 
Hi,

I am trying to add a second IP address "alias" to my NIC. Running this as root works fine every time:

/sbin/ifconfig eth0:1 inet 69.41.0.59 broadcast 69.41.0.63 netmask 255.255.255.192 up

However, when I reboot it, the setting gets lost. So, I did some searching around, and thought I could add that line to the bottom of /etc/rc.d/rc.local

No dice.

However, if I call that script manually after I SSH in, it does run that line.

Thanks in advance!

gsgleason 10-23-2004 10:33 AM

try adding stuff to /etc/rc.d/rc.inet1.conf

TKS 10-23-2004 11:06 AM

or you could just use the 'netconfig' command which will edit your rc.inet1.conf file for you.

Don't forget that you'll need to make sure that you have your modules set up in /etc/rc.modules for each of your NICs.

TKS

designguy79 10-23-2004 11:24 AM

I only have 1 NIC, so I cannot do anything in the 'modules' file.

I tried adding the following line to /etc/rc.d/rc.inet1.conf

ETH0_ALIAS[0]="69.41.0.59"

and rebooted, and it didn't add it.

Then I tried

ETH0_ALIAS[0]="69.41.0.59/24"

and nothing.

Thanks again...

Ghost_runner 10-23-2004 11:19 PM

try this: use vi to make a file named netstart or something similar, in your /etc

#!/bin/bash
#start designguy79's network
/sbin/ifconfig eth0:1 inet 69.41.0.59 broadcast 69.41.0.63 netmask 255.255.255.192 up

then make sure the program is owned by root
sudo chown root.root netstart

and make it executable
chmod 700 netstart

then add this to the end of rc.local, or the end of /etc/pcmcia/network
source /etc/netstart

see if that works

Shade 10-23-2004 11:26 PM

Instead of using the Eth0[alias] function in /etc/rc.d/rc.inet1.conf, just add your command verbatim to /etc/rc.d/rc.inet1

I think what's happening is that rc.local is being called before your interface is initialized to begin with -- can't assign an alias if the interface isn't up.

Plus, it makes for a cleaner system if you have all your network related configurations within one script. You can add your command to the end of rc.inet1 below a comment, such as "#eth0 alias"

--Shade

designguy79 10-24-2004 01:37 PM

Shade,

Thanks for the suggestion -- that is actually what I tried recently, and it works great now. Thanks again, everyone!


All times are GMT -5. The time now is 05:01 AM.