HOw do i change the ip address using command line

i need to change teh ip address from 64.34.228.250 to 64.34.135.56.

I used the command

ifconfig net0 64.34.135.56 netmask 255.255.255.240 (with and without up) and it would work but when i rebooted the old ip came back.

Please help, and it keep very simple as i am a novice with no training in linux.
KoolandrewAsked:
Who is Participating?
 
cycle303Connect With a Mentor Commented:
Did my solution work?
0
 
cbmmCommented:
what flavor of linux?
0
 
almilyoCommented:
try using /usr/sbin/system-config-network
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
cbmmCommented:
the command you are using to change the ip address is only temporarily
0
 
almilyoCommented:
Sorry, didn't explain that very well, system-config-network has a gui that works in the console and lets you save changes to the network configuratrion, which is stored in /etc/sysconfig.

It's pretty intuitive to use
0
 
KoolandrewAuthor Commented:
i am using centos 4.5
please help with a step by step solution

0
 
cbmmCommented:
edit etc/sysconfig/network/<interfacename>
0
 
KoolandrewAuthor Commented:
i somehow muddled my way through it. Could someone please tell me how to add a second ip.

I used ifconfig eth0:1 64.34.135.54 netmask 255.255.255.240 but it didnt work.

thanks
0
 
cycle303Commented:
Create this file
/etc/sysconfig/network-scripts/ifcfg-eth0:1
Edit the file with whatever program you wish (nano, vi)
Here are the settings:
DEVICE=eth0:1
  BOOTPROTO=static
  BROADCAST=69.34.135.63
  IPADDR=69.34.135.54
  NETMASK=255.255.255.240
  ONBOOT=yes

You should also have a file
/etc/sysconfig/network-scripts/ifcfg-eth0
This file should be set with your first IP address info

0
 
KoolandrewAuthor Commented:
what does that mean, create this file.

I am linux newbie. I copied and pasted and got the following. Please provide more details..


[root@localhost ~]# /etc/sysconfig/network-scripts/ifcfg-eth0:1
-bash: /etc/sysconfig/network-scripts/ifcfg-eth0:1: No such file or directory
[root@localhost ~]# ifconfg
-bash: ifconfg: command not found
[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:09:6B:A3:7B:D3  
          inet addr:64.34.135.56  Bcast:64.34.135.63  Mask:255.255.255.240
          inet6 addr: fe80::209:6bff:fea3:7bd3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5377 errors:0 dropped:0 overruns:0 frame:0
          TX packets:487 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:463579 (452.7 KiB)  TX bytes:204637 (199.8 KiB)
          Interrupt:185

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:14479 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14479 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1131736 (1.0 MiB)  TX bytes:1131736 (1.0 MiB)

[root@localhost ~]#
0
 
cycle303Commented:
try this
nano /etc/sysconfig/network-scripts/ifcfg-eth0:1
if this command fails try
vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
This should allow you to start editing the new file.
0
 
KoolandrewAuthor Commented:
i did as you suggested with vi

this is the file i input and below is the result

DEVICE=eth0:1
  BOOTPROTO=static
  BROADCAST=64.34.135.63
  IPADDR=64.34.135.54
  NETMASK=255.255.255.240
  ONBOOT=yes


ifconfig
eth0      Link encap:Ethernet  HWaddr 00:09:6B:A3:7B:D3  
          inet addr:64.34.135.56  Bcast:64.34.135.63  Mask:255.255.255.240
          inet6 addr: fe80::209:6bff:fea3:7bd3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15697 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1135 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1309670 (1.2 MiB)  TX bytes:429102 (419.0 KiB)
          Interrupt:185

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:38929 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38929 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2961572 (2.8 MiB)  TX bytes:2961572 (2.8 MiB)
0
 
KoolandrewAuthor Commented:
Sorry, did i need to reboot?
0
 
cycle303Commented:
I was just goint to ask that..
0
 
cycle303Commented:
BTW, if you hate how VI works (as I do),  install NANO.  This program will work a lot like most windows based txt editors.
0
 
cycle303Commented:
/etc/init.d/network restart
Run this to restart the network services
0
 
KoolandrewAuthor Commented:
i think i did it, thanks
0
All Courses

From novice to tech pro — start learning today.