Reducing 124 ifconfig lines in rc.conf to just 1
Redd Vinylene
reddvinylene at gmail.com
Sat Aug 2 19:59:55 UTC 2008
On Sat, Aug 2, 2008 at 9:24 PM, Polytropon <freebsd at edvax.de> wrote:
> Hi!
>
> On Sat, 2 Aug 2008 21:11:47 +0200, "Redd Vinylene" <reddvinylene at gmail.com> wrote:
>> Greetings!
>>
>> I got 124 ifconfig lines going from ifconfig_rl0_alias0="inet
>> 80.252.2.3 netmask 255.255.255.255" to ifconfig_rl0_alias124="inet
>> 80.252.2.127 netmask 255.255.255.255".
>>
>> Is it possible reducing it all to just 1 line using a for loop or jot
>> or something?
>
> I'm thinking of a "two stage procedure" that can be implemented
> well with /etc/rc.conf. Stupid idea, I know, but it should work,
> allthough you could make it more tidy:
>
> # First create /etc/ifconfig.conf if not already there
> if [ ! -f /etc/ifconfig.conf ]; then
> echo "#!/bin/sh" > /etc/ifconfig.conf
> ALIAS=0
> while [ ${ALIAS} -lt 125 ]; do
> echo 'ifconfig_rl0_alias${ALIAS}="inet 80.252.2.`expr ${ALIAS} + 4` netmask 255.255.255.255" >> /etc/ifconfig.conf
> ALIAS=`expr ${ALIAS} + 1`
> done
> fi
>
> # Now source it into /etc/rc.conf
> . /etc/ifconfig.conf
>
> # Done.
>
>
> --
> Polytropon
> From Magdeburg, Germany
> Happy FreeBSD user since 4.0
> Andra moi ennepe, Mousa, ...
>
That will probably work. Looks a bit messy though, I'll use it if
nobody else knows of a simpler solution.
Thanks!
--
http://www.home.no/reddvinylene
More information about the freebsd-questions
mailing list