LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-20-2007, 08:13 AM   #1
natv
Member
 
Registered: Mar 2006
Posts: 66

Rep: Reputation: 15
adding IP alias to eth0 via SSH?


Hi guys,

I'm running CentOS 4.4

I know how to add an IP address (aliased to eth0, such as eth0:1) via the GUI based system-config-network

But how is this done via SSH only? Using system-config-network-tui, I only see an option to configure the Ethernet, I tried just changing all the settings to:

Name: eth0:1
Device: eth0
Static IP: the new IP
..etc

(hoping that it would still keep my eth0 config and simply add eth0:1, but I don't really know what I'm doing here..)

but that didn't seem to take effect (ifconfig didn't show the new IP on eth0:1)

I did:

service network restart

and still no show. Is that the right way to add an IP alias to the network card via SSH, or maybe I'm not restarting the network properly?


Thanks
Nat
 
Old 02-20-2007, 04:56 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Post output from ifconfig -a
Post the contents of the files in /etc/sysconfig/network-scripts/
ifcfg-eth0
ifcfg-eth0:1

Brian
 
Old 02-20-2007, 05:53 PM   #3
natv
Member
 
Registered: Mar 2006
Posts: 66

Original Poster
Rep: Reputation: 15
about ifcfg-eth0

Thanks Brian,

Let me make sure I understand, I have these ifcfg* files under /etc/sysconfig/network-scripts/

-rw-r--r-- 3 root root 188 Feb 20 09:14 ifcfg-eth0
-rw-r--r-- 1 root root 254 Jun 20 2001 ifcfg-lo


This is what is in my ifcfg-eth0 file:

[root@server ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0:1
BOOTPROTO=none
BROADCAST=192.168.1.255
HWADDR=00:11:2f:71:54:d0
IPADDR=192.168.1.111
NETMASK=255.255.255.0
NETWORK=192.168.1.0
TYPE=Ethernet
GATEWAY=192.168.1.1
ONPARENT=yes



If I wanted to add say 192.169.1.112 to my box, would I add another entry in this *same* file (ifcfg-eth0) and list the device as eth0:2 ?


I only have on NIC card in the box.


Thanks
Nat
 
Old 02-21-2007, 03:51 PM   #4
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
No it will be a seperate file. Look at this site for detail look of files and their contents. http://www.ducea.com/2006/07/15/linu...based-systems/

What you have it your current ifcfg-eth0 does not look right at all. Check this for a reference.
Code:
# Realtek|RTL-8139/8139C/8139C+
DEVICE=eth0
BOOTPROTO=none
BROADCAST='tion: --broadcast'
# HWADDR=00:90:F5:0D:2F:85
IPADDR=192.168.1.58
NETMASK=255.255.255.0
NETWORK='option: --network'
ONBOOT=no
TYPE=Ethernet
GATEWAY=192.168.1.1
USERCTL=no
PEERDNS=yes
IPV6INIT=no
Brian
 
Old 02-21-2007, 04:02 PM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
in the past i've been caught out by some scripts not liking the : in the file name. the name of the file is probably easier delt with as ifcfg-eth0_1 for example. just a tip that may be irrelevant these days.
 
  


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
ssh problem after creating an ssh alias. porotothorpe Linux - General 2 01-25-2006 07:56 PM
sendmail sending on alias IP eth0:1 Finlay Linux - Networking 10 11-28-2005 12:27 PM
Eth0 IP Alias Problem assyrian47 Slackware 1 04-20-2005 11:50 AM
ifcfg-eth0:X alias problem dgenne Linux - Networking 1 03-17-2002 01:43 AM

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

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