LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 07-30-2006, 08:52 AM   #1
noorudin
Member
 
Registered: Jan 2006
Posts: 47

Rep: Reputation: 15
change ip by command line


I am using suse 10.1 with static ip address 192.168.40.100.
And I want to change ip by command line permanently.How can I do?
 
Old 07-30-2006, 09:57 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 656Reputation: 656Reputation: 656Reputation: 656Reputation: 656Reputation: 656
Which distro are you using? See if you have a /etc/sysconfig/network/ifcfg-eth0 file. You need to su to root to edit it. ( Note: I'm guessing that your interface is named eth0 )

Change the IP address listed after "IPADDR=".
Quote:
from the ifcfg.template file:
# If using a static configuration you have to set an IP address and a netmask
# or prefix length. The following examples are equivalent:
# 1) IPADDR=192.168.1.1
# NETMASK=255.255.255.0
# 2) IPADDR=192.168.1.1
# PREFIXLEN=24 # NETMASK will be ignored
# 3) IPADDR=192.168.1.1/24 # NETMASK and PREFIXLEN will be ignored
 
Old 07-31-2006, 10:53 AM   #3
crep
Member
 
Registered: Aug 2004
Location: US
Distribution: Fedora, FBSD, Solaris
Posts: 46

Rep: Reputation: 15
/sbin/ifconfig eth0 new.ip.goes.here

this will only change it for the time being, at reboot it gets reset to the ip in sysconfig/ifcfg-eth0 (above)
 
Old 08-31-2006, 07:19 PM   #4
sudipta_cht
LQ Newbie
 
Registered: Oct 2003
Location: Austin, Texas
Distribution: Ubuntu
Posts: 6

Rep: Reputation: 0
Hi,

Can someone help me and tell me how to implement this on Ubuntu? I have been taking a look at /etc/sysctl.conf, /etc/init.d/networking and the different files in /etc/network but I haven't yet been able to figure out how to do this permanently.

Thanks a lot
Sudipta
 
Old 08-31-2006, 10:14 PM   #5
crep
Member
 
Registered: Aug 2004
Location: US
Distribution: Fedora, FBSD, Solaris
Posts: 46

Rep: Reputation: 15
can't tell you exactly where it is, but likely in /etc/sysconfig/network-scripts there will be a file ifcfg-eth0.

Edit that file to the new ip. If you need details on how to do it, post that file here and I'll help you.
 
Old 09-07-2006, 05:29 PM   #6
sudipta_cht
LQ Newbie
 
Registered: Oct 2003
Location: Austin, Texas
Distribution: Ubuntu
Posts: 6

Rep: Reputation: 0
Umm.. nothing like /etc/sysconfig in Ubuntu. Any pointers to what the equivalent of that directory is in Ubuntu?
 
Old 09-07-2006, 05:44 PM   #7
crep
Member
 
Registered: Aug 2004
Location: US
Distribution: Fedora, FBSD, Solaris
Posts: 46

Rep: Reputation: 15
as root do: updatedb
then do: locate ifcfg

so edit ifcfg-eth0 (post it if you still need help)
 
Old 09-07-2006, 06:11 PM   #8
sudipta_cht
LQ Newbie
 
Registered: Oct 2003
Location: Austin, Texas
Distribution: Ubuntu
Posts: 6

Rep: Reputation: 0
Thumbs up

Quote:
Originally Posted by crep
as root do: updatedb
then do: locate ifcfg

so edit ifcfg-eth0 (post it if you still need help)
Crep, hey!

Thanks for the help. Even after the updatedb nothing was found: even tried a find . -name and left it for 2 hours to come back with no such file.

However, I found what I was looking for: as it turns out, Ubuntu systems use /etc/network/interfaces to maintain ip addresses and all, and so I edited that file manually and could get the system to change its ip address.

Thanks for all the help, though: I appreciate
 
Old 09-07-2006, 06:13 PM   #9
crep
Member
 
Registered: Aug 2004
Location: US
Distribution: Fedora, FBSD, Solaris
Posts: 46

Rep: Reputation: 15
glad you got it
 
  


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
change background via command line verbose Linux - General 10 07-19-2012 10:31 AM
how to change workspace by command line melinda_sayang Slackware 29 07-21-2011 03:51 AM
change the time from the command line juanb Linux - Newbie 3 10-31-2007 02:11 AM
how do I change the command line resulution? sunpascal Linux - Software 9 03-11-2006 10:20 AM
Change workspace from command line 3saul Linux - Software 4 11-18-2005 06:02 PM


All times are GMT -5. The time now is 08:34 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration