LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 01-27-2010, 10:24 AM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,712
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Ubuntu (server) can't handle multiple (alias) IP addresses (well)


I should have known that these minor glitches were telling me of coming problems:

1. I was getting multiple messages about OpenSSH being restarted, just after a reboot.

2. Sometimes, not all IP addresses would be configured.

But the big one I had to dig into first was:

3. The nsd daemon would not run.

I diagnosed the nsd issue to a failure to bind to an interface address. After some time investigating I found that by the time nsd was being started, only ONE IP address had been configured (I inserted an "ifconfig" command in "/etc/init.d/nsd3" to write to a file). This happened EVERY time.

I manually configured 1000 IP addresses for a test (using a bash loop, not 1000 commands typed in) and it worked in less than 1 second. So it was not a kernel "feature" to slow down IP address aliasing.

Eventually I tracked down that whatever script was running to configure the IP addresses, it was doing it SLOOOOOOOWLY! And the daemons were being started before that script was done. Well, if it ran so slow, I can imagine someone deciding not to wait on it.

Anyone have any idea what is wrong with the network configuration that makes the additional IP addresses start slowly? Is it a problem with my "/etc/network/interfaces file" ...
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 172.30.0.20
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

auto eth0:0
iface eth0:0 inet static
        address 172.30.0.21
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

auto eth0:1
iface eth0:1 inet static
        address 172.30.0.4
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

auto eth0:2
iface eth0:2 inet static
        address 172.30.0.5
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

auto eth0:3
iface eth0:3 inet static
        address 172.30.0.11
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

auto eth0:4
iface eth0:4 inet static
        address 172.30.0.12
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

auto eth0:5
iface eth0:5 inet static
        address 172.30.0.13
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255
What I want is for ALL static IP addresses on ALL interfaces to be configured (and this won't take very long at all) BEFORE any network daemons are started.

It looks like the culprit is that the network script is trying to restart certain daemons (via special restart scripts) when interfaces are added (and maybe also when deleted). That would be great for interfaces that do get added later. But for static IP addresses for fixed interfaces, this just doesn't do the job. Anyone know how to make it DTRT and configure every IP address all at once first, and wait for that to finish (whether succeed or fail) before starting any daemons?

Oh, I tried /etc/network/interfaces like this:
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 172.30.0.20
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

        address 172.30.0.21
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

        address 172.30.0.4
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

        address 172.30.0.5
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

        address 172.30.0.11
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

        address 172.30.0.12
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255

        address 172.30.0.13
        netmask 255.255.0.0
        network 172.30.0.0
        broadcast 172.30.255.255
Hint: have a rescue CD handy ... the system won't come up (and obviously from this, the program to handle this isn't very robust).
 
Old 01-29-2010, 08:40 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Try syntax like this:

Code:
auto eth0
iface eth0 inet static
  address 207.192.69.555
  netmask 255.255.255.0
  gateway 207.192.69.1
  up ifconfig eth0 add 207.192.69.777
Results in:
Code:
eth0      Link encap:Ethernet  HWaddr fe:fd:cf:c0:45:97
          inet addr:207.192.69.555  Bcast:207.192.69.255  Mask:255.255.255.0
          inet6 addr: fe80::fcfd:cfff:fec0:4597/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5470536 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5060894 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:711169238 (678.2 MiB)  TX bytes:2883653760 (2.6 GiB)
          Interrupt:28

eth0:0    Link encap:Ethernet  HWaddr fe:fd:cf:c0:45:97
          inet addr:207.192.69.777  Bcast:207.192.69.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:28
 
Old 02-01-2010, 07:27 AM   #3
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,712

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Thanks! Man page for ifconfig said "add" was for IPv6. But it works (for now) for IPv4 (just tried it).
 
Old 02-01-2010, 07:32 AM   #4
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,712

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Oops! The corresponding "del" in ifconfig does not work correctly. It takes down the first alias regardless of which is specified. Methinks a rewrite of the whole ifconfig command is long overdue (it needs CIDR support and some more intelligence).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can DHCP handle two static addresses with same hostname? wheelsg Linux - Networking 2 11-08-2008 04:00 PM
how does the OS handle multiple processors? mkrems Linux - General 3 05-01-2008 09:20 PM
How do you set the primary IP on a RHEL4 server w/ multiple IP addresses? systemsengineer Linux - Server 2 02-20-2008 08:23 PM
creating server socket program to handle multiple client at same time cranium2004 Programming 2 03-14-2005 10:58 AM
Multiple IP Addresses meshcurrent Linux - Networking 1 10-12-2002 05:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 08:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration