# [SOLVED - Kinda] Slow assigning IPs....

## gixer

Hope someone out there can help. I have searched, but cannot find an answer to this.

On one of my servers, I have an entire class C assigned to eth0. During bootup, while it's assigning IPs (via /etc/conf.d/net) it takes FOREVER to go through all these IPs.. it does one... a second or two passes, then [OK]... next one........ [OK]...... UGH! Is there any way to speed this up?! 

Thank you very much in advance!

-Allan

----------

## richard.scott

How is your /etc/conf.d/net written?

----------

## gixer

Like so:

config_eth0=(

        "123.123.123.12/26"

        "123.123.123.{2..9}/26"

        "123.123.123.{11..61}/26"

        "123.123.123.{67..68}/26"

        "123.123.123.{71..119}/26"

        "123.123.123.{121..125}/26"

        "222.222.222.{2..254}/24"

)

routes_eth0=( "default via 123.123.123.1" )

Obviously those aren't my real IPs, but it is the conf, i mearly changed the first 3 octets. xxx.xxx.xxx

----------

## richard.scott

Ah ok.. that looks fine to me.

Your just gonna have to wait for each IP to be added one at a time... or re-write this code and move it into local.start instead?

Rich.

----------

## gixer

There HAS to be a way to speed this up.... This is a production server, and it takes 20 minutes just for it to assign all these ips! it's crazy! I cannot reboot this box for any reason simply because I cannot have this server down for 20 minutes for a simple reboot! I mean, it IS Linux, it's not like I have to reboot once a week, the last time this server was rebooted was 389 days ago, and that was only because that's the day it was put in production. But we had to move cages this last weekend, and so I had to shut it down. When it came up, I was beside myself waiting for it to assign a class C, plus 64 more ips on a different subnet, plus a few other misc IPs.

I looked at /etc/init.d/net.lo to see if there was something I could do. I was looking for an option like 'broadcast this ip, wait for any reply, no reply, assign ip' .... or something along that line, because that's what it seems its doing, like it's verifying that IP isn't already assigned. I remember Gentoo didn't used to do this, it used to fly through IP assignments. This is a recent development, like within the last 2 years. 

I don't have a whole lotta free time on my hands, so it's gonna have to wait for now, but if anyone knows a 'trick' to speed it up, I would appreciate it very much. I realize that I could put a bunch of 'ifconfig' statements in /etc/conf.d/local.start, but that's not the 'correct' solution as far as I'm concerned. The net config is supposed to go in /etc/conf.d/net, and that's where I would like it.

Anyway, thanks for your time tho Rich, I appreciate it.

-Allan

----------

## richard.scott

do you have this in your net setup:

```
modules_force=( "iproute2" )
```

Apparently this can offer a speed boost on configuration... not sure by how much tho.

Obviously you need to emerge iproute2 before rebooting   :Smile: 

Rich

----------

## gixer

I've found out something interesting, this system is not using OpenRC! I'm 'stuck' on baselayout 1.12.13. This is a hardened server, running hardened-sources 2.6.28-hardened-r9, using the hardened profile. I recently built another server, using the hardened profile and sources, yet that one does use OpenRC, and it's on baselayout 2.0.1. OpenRC is masked....Any ideas?

-Allan

----------

## richard.scott

All my systems are still baselayout 1.x

I don't know how to upgrade to 2.x or OpenRC as I've never needed it.

Perhaps you have unmasked baselayout or something?

Rich

----------

## gixer

I see where the problem lies. Due to this server using the 'old' baselayout, in the net.lo script, it calls arping_address_exists.... this in turn, looking around in these scripts, sends an arp request out to see if the address is already assigned. I would like to SKIP this step.... or just figure out WHY baselayout 2 and openrc are both masked.... i checked package.* nothing in there.... 

-Allan

----------

## richard.scott

are you using the same profile:

```
ls -al /etc/make.profile
```

Perhaps its something to do with that?

or perhaps the portage tree is newer/older on one system as that's where the profile info comes from?

Are you using layman on either server?

Just a thought

Rich.

----------

## gixer

Ok, so I figured out a way around this. The reason that IP assignment is so slow is because the init script calls /sbin/arping on EVERY ip assignment, to check to see if that IP is already in use on the network. Since ALL of my IP assignments are, well, assigned to me, I know for a fact that they are correct, there's no need to check them. I also don't have an hour to wait for 1 box to come up because it's assigning an entire class C (255 IPs). My 'solution', and I realize it's not ideal, perhaps now that I know the 'issue' someone can tell me how to do this 'correctly', is i simply rename the executable, arpingold, so that the script doesn't find the program. Result? All ips are VERY quickly assigned. If someone knows a better solution, I'm all ears.

----------

## AngelKnight

 *gixer wrote:*   

> Ok, so I figured out a way around this. The reason that IP assignment is so slow is because the init script calls /sbin/arping on EVERY ip assignment, to check to see if that IP is already in use on the network. Since ALL of my IP assignments are, well, assigned to me, I know for a fact that they are correct, there's no need to check them. I also don't have an hour to wait for 1 box to come up because it's assigning an entire class C (255 IPs). My 'solution', and I realize it's not ideal, perhaps now that I know the 'issue' someone can tell me how to do this 'correctly', is i simply rename the executable, arpingold, so that the script doesn't find the program. Result? All ips are VERY quickly assigned. If someone knows a better solution, I'm all ears.

 

Use the Gentoo network config in /etc/conf.d/net to add 1 IP, then use /etc/conf.d/local.start to add the others in a loop with "ip addr add $NEWADDR dev $DEV" in a loop, then call it a day.

----------

