LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-26-2011, 08:46 AM   #1
bhushanj_a1
LQ Newbie
 
Registered: Aug 2010
Posts: 4

Rep: Reputation: 0
Unhappy What is difference in ip and ifconfig command when usage is for adding alias.?


Hello,

What is the difference in the execution of below two commands??

1. ifconfig eth1:1 10.0.0.2/24 broadcast 10.0.0.255
On success, one can see the alias getting added to the list of interfaces. Checked by ifconfig

2. ip addr add 10.0.0.2/24 broadcast 10.0.0.255 dev eth1
On success, one can not see the alias getting added in the list of the interfaces. But, returns 0 and on failure returns 2.

Does any one know how the working differ?
 
Old 12-27-2011, 07:50 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by bhushanj_a1 View Post
2. ip addr add 10.0.0.2/24 broadcast 10.0.0.255 dev eth1
On success, one can not see the alias getting added in the list of the interfaces. But, returns 0 and on failure returns 2.
Try this command
Code:
ip addr add 10.0.0.2/24 broadcast 10.0.0.255 label eth1:1 dev eth1
With it the pseudo interface will also show up with the ifconfig command

I guess the both commands work similar when setting up the interface, but differ in the way they list them. I can't find the associated /proc entry to see how the two tools differ in their display format.

What I'm thinking about right now if the names of the interace have any further meaning beside just beeing names. Don't know if a command like iptables -A INPUT -i eth1:1 would work...
 
Old 12-28-2011, 12:04 AM   #3
bhushanj_a1
LQ Newbie
 
Registered: Aug 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks zhjim for you inputs.

Addition of label eth1:1 is correct but without label system does makes an entry. Only the mystery is where that can be found.
 
Old 12-28-2011, 07:46 AM   #4
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
I looked up the source code of the ifconfig command (Can be found here http://sourceforge.net/projects/net-tools/) but to no avail. Seems like it opens a socket and gets the infos from there. But I don't understand how it is done.
 
  


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
Alias - Adding Command with Arguments bichonfrise74 Linux - Newbie 2 10-23-2008 01:29 AM
IP alias in ifconfig barrythai SUSE / openSUSE 1 07-30-2005 04:30 AM
Adding Network Interface alias from command line WireLine Fedora 2 06-08-2005 11:08 PM
openbsd ifconfig alias question mylesridgely Linux - Networking 1 09-06-2003 07:19 AM
What script for adding an ifconfig command? snocked Linux - Newbie 19 02-17-2003 05:06 PM

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

All times are GMT -5. The time now is 10:56 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