LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 11-07-2011, 11:32 AM   #1
Neelabha Banerjee
LQ Newbie
 
Registered: Nov 2011
Posts: 2

Rep: Reputation: Disabled
query related to alias IP


Hello Experts,

I wanted to add alias IP to my ifcfg-eth0 ... i searched the net (as i lack knowledge in this area)and found the following command which i executed

echo -e "IPADDR_0=192.168.0.1\n
> NETMASK_0=255.255.255.128\n
> LABEL_0=0\nPREFIXLEN_0=''" >> /etc/sysconfig/network/ifcfg-eth0

which seems to work fine and if i do ifconfig i can see an entry for eth0:0

Now one to add another entry ... can i execute something like this (below)... will it create eth0:1

echo -e "IPADDR_1=192.168.0.2\n
> NETMASK_1=255.255.255.128\n
> LABEL_1=1\nPREFIXLEN_1=''" >> /etc/sysconfig/network/ifcfg-eth0

I would appreciate if you can validate whether its the right way (right command).

Regards,
Neel
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 11-07-2011, 11:40 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,805

Rep: Reputation: 8223Reputation: 8223Reputation: 8223Reputation: 8223Reputation: 8223Reputation: 8223Reputation: 8223Reputation: 8223Reputation: 8223Reputation: 8223Reputation: 8223
Quote:
Originally Posted by Neelabha Banerjee View Post
Hello Experts,
I wanted to add alias IP to my ifcfg-eth0 ... i searched the net (as i lack knowledge in this area)and found the following command which i executed

echo -e "IPADDR_0=192.168.0.1\n
> NETMASK_0=255.255.255.128\n
> LABEL_0=0\nPREFIXLEN_0=''" >> /etc/sysconfig/network/ifcfg-eth0

which seems to work fine and if i do ifconfig i can see an entry for eth0:0

Now one to add another entry ... can i execute something like this (below)... will it create eth0:1

echo -e "IPADDR_1=192.168.0.2\n
> NETMASK_1=255.255.255.128\n
> LABEL_1=1\nPREFIXLEN_1=''" >> /etc/sysconfig/network/ifcfg-eth0

I would appreciate if you can validate whether its the right way (right command).
While you CAN do it that way...I wouldn't. The proper way to configure the interface is with the ifconfig (interface configuration), command. Read the man page on it.

All you're doing is editing the files in /etc/sysconfig/network with echo statements...which could lead to problems, since you're just shoving stuff in there at the end, without knowing what's above it. You CAN edit those files with any editor, too (as root, of course), which would be a safer method.
 
2 members found this post helpful.
  


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
Query related to syslog? your_shadow03 Linux - Newbie 5 05-15-2009 10:32 AM
A Query related to Git? your_shadow03 Linux - Newbie 10 04-23-2009 11:35 PM
Query related to sudo? your_shadow03 Linux - Newbie 2 04-22-2009 12:21 AM
shell related query !!!!!!!!!!! iacharyya Linux - General 10 06-09-2008 06:39 PM
One query related libstdc++.so.5 utkarshrawat Linux - Newbie 2 05-27-2008 02:01 AM

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

All times are GMT -5. The time now is 10:59 PM.

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