LinuxQuestions.org
Visit Jeremy's Blog.
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-31-2002, 01:40 PM   #1
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Rep: Reputation: 31
Changing IP address in Red Hat 7.2


I set my IP address by editing the following file:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

After entering the IP address that I want, I restart the network:

/etc/rc.d/init.d/network restart

However, after doing this, I type /sbin/ifconfig and my IP address is unchanged.

What is going on here?
 
Old 01-31-2002, 01:48 PM   #2
d3funct
Member
 
Registered: Jun 2001
Location: Centralia, WA
Posts: 274

Rep: Reputation: 31
Try this:

/sbin/ifconfig eth0 address 10.10.10.10

This should change the IP address for eth0 to 10.10.10.10.

Then do service network restart , run ifconfig again and see if that works.
 
Old 01-31-2002, 02:06 PM   #3
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
and if you like gui you can always use the netconfig utility... or type setup to get to it.
 
Old 01-31-2002, 02:08 PM   #4
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Original Poster
Rep: Reputation: 31
d3funct, yes that works, but it is only temporary. After a reboot, the IP address goes back to what it was before.

I don't want to use netconfig, I want to do it from the command line. How?
 
Old 01-31-2002, 02:18 PM   #5
d3funct
Member
 
Registered: Jun 2001
Location: Centralia, WA
Posts: 274

Rep: Reputation: 31
I've never had a problem doing it that way. Do 'man ifconfig' to see if you're missing something in the command.
 
Old 01-31-2002, 02:35 PM   #6
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Original Poster
Rep: Reputation: 31
The commad that I would issue is:

/sbin/ifconfig eth0 <IP Address>

But, that is only temporary. After a reboot, it goes back to whatever the startup script sets it to.

I thought the startup scripts was located here:

/etc/sysconfig/network-scripts/ifcfg-eth0

When I edit that file and type in the IP address that I want, and then restart my network, it doesn't change my IP address. So how do I permanently change my IP address, without using a graphical tool.
 
Old 01-31-2002, 03:05 PM   #7
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Original Poster
Rep: Reputation: 31
I figured it out. The command /etc/rc.d/init.d/network restart doesn't restart the /etc/sysconfig/network-scripts/ifcfg-eth0 script. To restart that script, you have to reboot.
 
Old 02-01-2002, 01:47 AM   #8
Paul_assheton
Member
 
Registered: Nov 2000
Location: Ware (Nr London, England
Posts: 114

Rep: Reputation: 15
I think the following commands should re-read the
/etc/sysconfig/network-scripts/ifcfg-eth0 script without rebooting.

ifdown eth0
ifup eth0
 
Old 02-01-2002, 09:04 AM   #9
d3funct
Member
 
Registered: Jun 2001
Location: Centralia, WA
Posts: 274

Rep: Reputation: 31
I pretty sure Paul is correct. I usually down my NIC prior to changing the IP and then up it using those commands. I do this everytiime that it's just become natural which is why I didn't even mention it, sorry.
 
Old 02-01-2002, 11:15 AM   #10
glock19
Member
 
Registered: Aug 2001
Distribution: Debian Etch
Posts: 510

Original Poster
Rep: Reputation: 31
Ah, that's right. Thanks. Now I don't have to reboot if I want to permanently change my IP address. Thanks again.
 
Old 03-05-2002, 10:34 PM   #11
gui10
Member
 
Registered: Mar 2001
Distribution: enigma, slack8
Posts: 677

Rep: Reputation: 30
i have a question. my ifcfg-eth0 file has the following entries:

DEVICE=eth0
BOOTPROTO=dhcp
NETMASK=255.255.255.0
ONBOOT=yes

where do i change the ip address? and since i am assigning an ip address to the machine, what happens to the BOOTPROTO line? do i change it to something else and where can i read up on the options availabe?

thanks in advance...
 
Old 03-05-2002, 11:09 PM   #12
bbenz3
Member
 
Registered: Feb 2002
Location: Orlando
Distribution: Whatever I feel like at the time I install.
Posts: 284

Rep: Reputation: 30
If you modify this file:
/etc/sysconfig/network-scripts/ifcfg-eth0
you can make it automatically set whatever IP you want on boot.
Here is my file.

DEVICE=eth0
IPADDR=192.168.168.1 (*)
NETMASK=255.255.255.0 (*)
BROADCAST=192.168.168.255 (*)
ONBOOT=yes
BOOTPROTO=none (or dhcp if you want to get IP from server)
NAME=xxxx (whatever you want for the alias)
*= Leave these blank if you use dhcp for BOOTPROTO
 
Old 03-06-2002, 09:44 AM   #13
gui10
Member
 
Registered: Mar 2001
Distribution: enigma, slack8
Posts: 677

Rep: Reputation: 30
thanks for answering both my posts... sorry about that...

thanks for your info... it's very useful...
 
Old 10-28-2012, 10:47 PM   #14
abidadnan
LQ Newbie
 
Registered: May 2011
Posts: 3

Rep: Reputation: 0
Steps to change IP Address on Linux Redhat / Centos

Steps to change IP Address on Linux Redhat / Centos

http://www.ittechguru.net/?p=657
 
  


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
Red Hat 9.1 Desktop Changing Elite_Gamer04 Linux - Software 3 05-22-2004 10:37 AM
How do I access the DNS Address in Red Hat 7.3 mustang05 Linux - General 2 03-24-2004 11:38 PM
Changing resolution in Red Hat PennyroyalFrog Linux - Newbie 2 03-14-2004 05:51 PM
red hat enterprise download address teddmcload Red Hat 1 11-08-2003 03:44 AM
How do you release an IP address in Red Hat 7.3 Nsean Linux - Networking 16 07-22-2002 01:27 PM


All times are GMT -5. The time now is 01:29 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration