About Linux FAQ

Browse More FAQs:

How to bind a range of IP’s in Debian / Ubuntu Linux

Posted by Vivek Gite [Last updated: May 2, 2008]

Q. I’ve recently installed Debian Linux 4.0 on my server and Ubuntu Linux 7.04 on Laptop. I would love to have a multiple IP address that I can use for verity of purposes. I would like to bind 4 IP's to the 'eth0' device or NIC. How do I do that?

A.. Let us assume that your eth0 IP address is 192.168.1.1. You need to create alias or binding using eth0:0, eth0:1...eth0:N devices. You need to add range of IP's in /etc/network/interfaces config file under Debian/Ubuntu Linux. First make a backup of existing file:
# cp /etc/network/interfaces /root/working.interfaces
Now open file using vi text editor:
#vi /etc/network/interfaces
OR
$ sudo vi /etc/network/interfaces
Modify as follows:

auto eth0
auto eth0:0
auto eth0:1

iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.248
gateway 192.168.1.254

iface eth0:0 inet static
address 192.168.1.2
netmask 255.255.255.248
gateway 192.168.1.254

iface eth0:1 inet static
address 192.168.1.3
netmask 255.255.255.248
gateway 192.168.1.254
# add rest of alias / binds below

Save and close the file.

Now restart networking, enter:
# /etc/init.d/networking restart
OR
$ sudo /etc/init.d/networking restart

Updated for accuracy.

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Discussion on This FAQ

  1. Stephen G Says:

    Did you possibly make a type for the 192.168.1.3 assignment?

    shows:
    iface eth0:0 inet static
    address 192.168.1.3
    netmask 255.255.255.248
    gateway 192.168.1.254

    should be (?):
    iface eth0:1 inet static
    address 192.168.1.3
    netmask 255.255.255.248
    gateway 192.168.1.254

  2. Darkall Says:

    Yes, he meant to type iface eth0:1 instead of iface eth0:0 :) He typo’d

  3. redsonic Says:

    Hi,

    Thank you a lot for this very nice howto.

    It was very helpful

    :)

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.