AddThis button
    Add Me    
Syndicate content

Assigning multiple IP addresses to the same Network Card

Reserve your domain name now!

Today I got a new IP address for a server and I had to assign it to the same NIC as my current IP address.

So?! How do you do that on a Debian or Ubuntu server?

It is actually very simple. On Ubuntu you go to /etc/network and edit the interfaces file. It should already include a definition for eth0 (virtual machines will have something else than eth0).

  # The loopback network interface
  auto lo
  iface lo inet loopback

  # The primary network interface
  auto eth0
  iface eth0 inet static
        address 192.168.1.1
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

  auto eth0:0
  iface eth0:0 inet static
        name Alias for Foo
        address 192.168.1.2
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

I marked in red what is different between both definitions.

Once you write that file to disk, you can start that interface with the ifup command:

  ifup eth0:0

Now it is up and running (unless you got tons of errors?) Obviously, the eth0 interface is expected to already be up. You cannot start an alias if the main interface is not running.

To verify that the new interface is up and running, use the ifconfig command as in:

  ifconfig

This command lists all the interfaces, including aliases. Note that aliases do not list the number of packets transfered since they are considered 100% similar to the main interface. This also applies to the firewall. In other words, you probably won't have to make any changes to your firewall...1

You can add more changing the number after the colon, for instance eth0:1, eth0:2, etc.

To be noted: You are limited to 254 aliases (0 to 254 + main interface, that's 255 IPs per NIC!)

  • 1. Yes. If you want a highly secure setup, you want to have two NICs.
Check this out!

Having problems with your WYSIWYG editor adding empty paragraphs?
Got people randomly adding empty lines everywhere in your posts?
Using modules that add info at the bottom of the page?

We have your solution: MO Paragraph trimmer filter to automatically
remove empty paragraphs from your Drupal website pages.

Syndicate content

     

Terms of Site Index

Find the page/content you are looking for with our index.

  • CD-ROM
  • .dylib
    Dynamic Library--the Mac OS/X naming convention for dynamic libraries. Not too sure why they choose that extension since FreeBSD uses .so just like most other Unices... To confuse people, maybe?
  • run
  • screen
  • sha1