LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 12-19-2008, 11:26 AM   #1
sharkhuang
LQ Newbie
 
Registered: Dec 2008
Posts: 5

Rep: Reputation: 0
Mutil IP issue


What is the different between multi IP on one real interface and multi IP on one true interface and alias interface. For example:

Both 10.0.0.1 and 10.0.0.2 IP attach on eth0
IP addr add 10.0.0.1/24 dev eth0
IP addr add 10.0.0.2/24 dev eth0

VS

10.0.0.1 on eth0
10.0.0.2 on eth0:1

ifconfig eth0 up 10.0.0.1
ifconfig eth0:1 up 10.0.0.2

Last edited by sharkhuang; 12-19-2008 at 11:48 AM.
 
Old 12-19-2008, 11:32 AM   #2
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
Hi,

You simply can't have multiple IPs on one interface without using aliases (ethx:x).

So to use 10.0.0.1 and 10.0.0.2 use eth0, you need to have:

eth0 - 10.0.0.1
eth0:0 - 10.0.0.2

Hope this helps
 
Old 12-19-2008, 11:36 AM   #3
sharkhuang
LQ Newbie
 
Registered: Dec 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by eco View Post
Hi,

You simply can't have multiple IPs on one interface without using aliases (ethx:x).

So to use 10.0.0.1 and 10.0.0.2 use eth0, you need to have:

eth0 - 10.0.0.1
eth0:0 - 10.0.0.2

Hope this helps
No! I can if I use the IP addr add xxxx command.
 
Old 12-19-2008, 11:53 AM   #4
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
?
Please explain with an example.
Thanks
 
Old 12-20-2008, 04:52 AM   #5
sharkhuang
LQ Newbie
 
Registered: Dec 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by eco View Post
?
Please explain with an example.
Thanks
Both 10.0.0.1 and 10.0.0.2 IP attach on eth0
IP addr add 10.0.0.1/24 dev eth0
IP addr add 10.0.0.2/24 dev eth0

VS

10.0.0.1 on eth0
10.0.0.2 on eth0:1

ifconfig eth0 up 10.0.0.1
ifconfig eth0:1 up 10.0.0.2
 
Old 12-20-2008, 05:32 AM   #6
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
I men, what command would you use to set two IPs on the same interface without using an alias?

I'd guess the second command would nullify the first.

Still, if that where possible, the alias permits you to route through a device rather than an IP I supose.
 
Old 12-20-2008, 05:56 AM   #7
sharkhuang
LQ Newbie
 
Registered: Dec 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by eco View Post
I men, what command would you use to set two IPs on the same interface without using an alias?

>> ip addr add

I'd guess the second command would nullify the first.

Still, if that where possible, the alias permits you to route through a device rather than an IP I supose.

I got some answer:

> Just wondering what the differences between using "ip addr add ..."
> and defining an interface alias with "ifconfig eth0:0 ..." are.
Aliases have been in use in times before Christ - they define different
interfaces (so different routing rules, tc, firewall...).
ip addr is reasonable approach to 'one if, several addresses' problem.
Use the latter only or mess with inconvenient problems that arise.

> Any (dis)advantages in either method?
> Any experiences?
As I wrote above.
 
Old 12-20-2008, 06:02 AM   #8
sharkhuang
LQ Newbie
 
Registered: Dec 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Other answer

Damian 'legion' Szuberski a écrit :
> On 2007-04-10, kianusch@gmail.com wrote:
>
>>Just wondering what the differences between using "ip addr add ..."
>>and defining an interface alias with "ifconfig eth0:0 ..." are.
>
> Aliases have been in use in times before Christ - they define different
> interfaces (so different routing rules, tc, firewall...).

No they don't - at list on Linux. The eth0:0 thing is not an interface
but only a kind of label associated to the address. The label does not
exist for kernel networking functions such as routing, packet filtering
and so on. Only the real interface and its addresses (including the
aliases) exist.

Once created, I have not seen any operational difference between aliases
created by ifconfig and addresses added by "ip addr". Both add addresses
and direct routes to network interfaces. However addresses created by
"ip addr" without an explicit label (default label is the interface
name) do no show in ifconfig (but it works the same). Also, alias
handling in ifconfig is somehow inconsistant : you set the label DOWN
(like an interface, which it is not) to delete it.

Note that you can also add an IP address to an interface (and create an
alias) with "ifconfig ethX add...".
 
  


Reply



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
SuSE10.2 networking issue Inter. connect. issue LVSuSE Linux - Networking 3 08-31-2007 02:42 AM
Sendmail issue (did not issue MAIL/EXPNVRFY/ETRN ...) Blackout_08 Linux - Server 0 08-08-2007 01:10 PM
Mutil function printer Richie55 Linux - Hardware 4 04-04-2007 03:31 AM
Slack 10.1 -- Mouse issue / X11 issue Pozican Linux - General 4 04-19-2005 03:44 AM
Having Issue w/ Truetype fonts - Mozilla Issue clove Linux - Software 4 02-18-2004 08:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:13 AM.

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