LinuxQuestions.org
Help answer threads with 0 replies.
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 01-19-2011, 07:23 AM   #1
quark_arc
LQ Newbie
 
Registered: Dec 2010
Posts: 7

Rep: Reputation: 0
Permanent IP address


Hi,

We have a Linux 5.4 version running on HP DL380. I assigned the IP address to the eth0 interface using the menu Settings --> Networks --> interface. Then I rebooted the machine and used "ifconfig -a" to check the IP, but it didn't show any IP assigned to eth0.

Then I manually added the IP to eth0 as follows:

ifconfig eth0 10.125.9.161 netmask 255.255.255.248
route add default gw 10.125.9.166

ifconfig -a showed the IP address assigned. However on reboot, it didn't show any IP to eth0.

To permanently assign the IP address, do I have to define it in some configuration file?
 
Old 01-19-2011, 07:28 AM   #2
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
Yes you do. Use the system-config-network tool or directly edit /etc/sysconfig/network-scripts/ifcfg-eth0
 
Old 01-19-2011, 08:46 AM   #3
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, Kali Linux, Raspbian
Posts: 166

Rep: Reputation: 10
do check *onboot* should be *yes* in configuration file.
 
Old 01-19-2011, 09:30 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by kaushalpatel1982 View Post
do check *onboot* should be *yes* in configuration file.
Sorry, this is bad advice, and doesn't address the OP's question, and is incorrect to boot. The option is STARTMODE, and it should be set to 'onboot'.

Also, the OP asked how to assign a static address, not how to make sure the interface is active on boot. acid_kewpie posted the correct solution, which is to use the system configuration tool, or edit the file. In the file, the OP needs to set the IPADDR and NETMASK parameters, along these lines:
Code:
STARTMODE='onboot'
BOOTPROTO='static'
IPADDR='10.9.8.7'
NETMASK='255.255.255.0'
telling the interface to start on boot, use the IP address/netmask as shown, and that it's a static address, not DHCP provided.
 
Old 01-19-2011, 10:37 AM   #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
Personally I've never seen a "STARTMODE" parameter. No sign of it in the init scripts of ifup scripts on centos 5.5
 
Old 01-19-2011, 11:29 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by acid_kewpie View Post
Personally I've never seen a "STARTMODE" parameter. No sign of it in the init scripts of ifup scripts on centos 5.5
Huh...I've got it in openSUSE...that's one of my interface-config scripts, with only the address changed. I've seen "onboot" and "manual" in there.
 
Old 01-19-2011, 09:22 PM   #7
kaushalpatel1982
Member
 
Registered: Aug 2007
Location: INDIA
Distribution: CentOS, RHEL, Fedora, Debian, Ubuntu, LinuxMint, Kali Linux, Raspbian
Posts: 166

Rep: Reputation: 10
TB0ne, I have just followed the line give below.

Quote:
ifconfig -a showed the IP address assigned. However on reboot, it didn't show any IP to eth0.
 
Old 01-20-2011, 08:31 AM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by kaushalpatel1982 View Post
TB0ne, I have just followed the line give below.
Then you didn't enter and/or save the values correctly.

You SHOULD go through the system-network configuration tool, and make sure you set a static address, and that everything is set correctly. If not, edit /etc/sysconfig/network-scripts/ifcfg-eth0 as you were told above, and put the values in as shown.

The line you quoted is a command that sets is temporarily...both myself and acid_kewpie gave you the answer, neither of which involve running ifconfig. Follow the instructions given.
 
  


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
[SOLVED] How to make a network address permanent? lucmove Linux - Networking 13 09-12-2009 11:23 AM
the following address had a permanent error igsen Linux - Newbie 3 04-17-2009 05:43 AM
Permanent Ethernet Address tuhinbose Linux - Hardware 1 01-09-2008 04:42 AM
Making default gateway address permanent in SuSe 10 alienmagic SUSE / openSUSE 9 01-02-2008 10:29 AM
Permanent IP address linksocc Linux - Networking 2 10-10-2003 10:56 PM

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

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