LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 03-30-2007, 09:20 AM   #1
izvrashenj
LQ Newbie
 
Registered: Jul 2006
Posts: 7

Rep: Reputation: 0
Two or more different ip addresses on one NIC?


So please tell me which is the best way to assign two or more external (internet) ip addresses to one network card? I have a server. And i one to use on it many ip addresses.
I have Debian Linux 2.6.20.1 etch.
In /etc/network/interfaces i have:

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet static
address 81.198.23.99
netmask 255.255.255.224
network 81.198.23.0/26
broadcast 81.198.23.192
gateway 81.198.23.97

So, is it ok to make my nic to use also second ip address in this way:

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet static
address 81.198.23.99
netmask 255.255.255.224
network 81.198.23.0/26
broadcast 81.198.23.192
gateway 81.198.23.97

allow-hotplug eth0:0
iface eth0:0 inet static
address 81.198.23.100
netmask 255.255.255.224
network 81.198.23.0/26
broadcast 81.198.23.192
gateway 81.198.23.97


??? Please tell me cause my server is about 100 miles from me and i don't want to take it down with wrong settings..

Last edited by izvrashenj; 03-30-2007 at 09:34 AM.
 
Old 03-30-2007, 02:08 PM   #2
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,178

Rep: Reputation: 49
You're definitely on the right track -- I've done this recently for a server with one NIC and 13 usable IP addresses. I did a quick Google search for "virtual interface" and the first results were all useful.

It's not difficult once you get the hang of it.
Enjoy!
 
Old 03-30-2007, 04:50 PM   #3
izvrashenj
LQ Newbie
 
Registered: Jul 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Poetics
You're definitely on the right track -- I've done this recently for a server with one NIC and 13 usable IP addresses. I did a quick Google search for "virtual interface" and the first results were all useful.

It's not difficult once you get the hang of it.
Enjoy!
Ok thanks i'll try it out
Then eth0:0 is fine as second interface or i should use eth0:1?
and for all other ips eth0:2 eth0:3 eth0:4 etc?
 
Old 03-30-2007, 04:56 PM   #4
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 48
Here is a snippet from /etc/network/interfaces on a machine with multiple addresses on its second, NIC, eth1.

Code:
auto eth0
iface eth0 inet static
        address 205.185.197.100
        netmask 255.255.255.0

auto eth1
iface eth1 inet static
        address 192.168.102.252
        netmask 255.255.255.0
        network 192.168.102.0
        broadcast 192.168.102.255
        gateway 192.168.102.2

auto eth1:1
iface eth1:1 inet static
        address 10.0.0.252
        netmask 255.255.255.0

auto eth1:2
iface eth1:2 inet static
        address 192.168.100.252
        netmask 255.255.255.0

auto eth1:3
iface eth1:3 inet static
        address 192.168.101.252
        netmask 255.255.255.0
Peace,
JimBass
 
  


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
multiple ip addresses on 1 nic? houler Linux - Networking 4 04-26-2005 03:53 PM
Multiple addresses on one NIC via DHCP - possible? babzog Linux - Networking 0 03-25-2004 10:43 AM
1 NIC with 2 IP addresses bucklake Linux - Networking 3 02-20-2004 10:44 AM
Multiple addresses for a single NIC grub Programming 1 08-04-2003 02:24 AM
Multiple IP addresses on one NIC hrr Linux - Networking 2 03-07-2003 12:04 PM


All times are GMT -5. The time now is 01:39 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration