# ifconfig alias digital accounting inconvenience.



## bagas (Nov 26, 2021)

Hello.
Why are network aliases still being counted?

```
ifconfig_ix0_alias0="inet 1.1.1.1 netmask 255.255.255.255"
ifconfig_ix0_alias1="inet 1.1.1.2 netmask 255.255.255.255"
```
Digital accounting creates inconvenience when there are about 200 aliases in the system.
And you need to delete the alias number 97, after which you have to rebuild the alias numbering.
Very uncomfortable.


----------



## covacat (Nov 26, 2021)

sh mkalias.sh 10-20 7 12 44-99 88-200

```
#!/bin/sh
MASK=32
NET=1.1.1
IFACE=bce0
PREF="ifconfig_${IFACE}_alias"
LIST=$1
j=0
while [ "$1" != "" ]
do
for i in $1
 do
  MIN=${i%-*}
  MAX=${i#*-}
  for t in $(seq $MIN $MAX)
   do
   echo ${PREF}${j} $NET.$t/$MASK
   j=$(($j+1))
   done
  done
 shift
 done
```


----------



## SirDice (Nov 26, 2021)

bagas said:


> Why are network aliases still being counted?


Stuff in rc.conf are shell variables.


----------



## bagas (Nov 26, 2021)

What I have indicated is an example.
Subnets are used differently and there are up to 30 subnets.
a more correct example.


> ifconfig_ix0_alias0="inet 9.10.1.1 netmask 255.255.255.255"
> ifconfig_ix0_alias1="inet 1.131.1.2 netmask 255.255.255.255"
> ...
> ...
> ...


----------



## bagas (Nov 26, 2021)

SirDice said:


> Stuff in rc.conf are shell variables.


It is more convenient to use without alias numbering.


----------



## SirDice (Nov 26, 2021)

bagas said:


> It is more convenient to use without alias numbering.


How do variables work in the shell?

```
#!/bin/sh 

FOO="bar"
FOO="something else"

echo $FOO
```
Guess what this outputs.

What would you suggest to change? And how would that work?


----------



## bagas (Nov 26, 2021)

hmm.
List aliases in a separate file.
Generate activation of aliases at server start automatically.
Something like this.
It is much more convenient than redoing the list of aliases with different subnets, from 50 or 150 aliases.
It's my opinion.


----------



## SirDice (Nov 26, 2021)

bagas said:


> It is much more convenient than redoing the list of aliases with different subnets, from 50 or 150 aliases.


It begs the question though, why do you need so many aliases?


----------



## bagas (Nov 26, 2021)

SirDice said:


> It begs the question though, why do you need so many aliases?


Example.
There are web projects that live for six months and after that it is not relevant and have to clean it.
Promotional stubs for the project.


----------



## covacat (Nov 26, 2021)

you can use a script and put it's output in rc.conf.d/netif to not spam rc.conf


----------



## bagas (Nov 26, 2021)

covacat said:


> you can use a script and put it's output in rc.conf.d/netif to not spam rc.conf


could be so.


----------

