LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-26-2011, 05:50 AM   #1
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Rep: Reputation: 16
setting up static ip using shell command


Hi,

Is there a command in linux to set-up static ip from command prompt?
I don't want to change it through configuration files and any similar mechanism. I need to change it directly from command prompt.


Thanks in advance.
 
Old 10-26-2011, 05:55 AM   #2
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
Code:
ifconfig ethX x.x.x.x netmask x.x.x.x
will do it, but it will be overridden by the config files on reboot, or network restart.
 
Old 10-26-2011, 06:15 AM   #3
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Original Poster
Rep: Reputation: 16
can gateway be configured using ifconfig?
 
Old 10-26-2011, 06:18 AM   #4
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
nope, you would need route for that..
Code:
route add default gw x.x.x.x
your probably also going to want to edit /etc/resolv.conf
Code:
nameserver x.x.x.x
 
Old 10-26-2011, 06:29 AM   #5
avee137
Member
 
Registered: Apr 2010
Location: bangalore,india
Distribution: ubuntu 9.10,CentOS 5
Posts: 120

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by fukawi1 View Post
nope, you would need route for that..
Code:
route add default gw x.x.x.x
your probably also going to want to edit /etc/resolv.conf
Code:
nameserver x.x.x.x
thank you!
 
  


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
setting static IP on linux PCs with no static IP address from internet provider? solvetek Linux - Networking 1 10-22-2011 09:04 AM
Setting static IP callumacrae Linux - Server 2 11-12-2009 01:12 PM
Setting a static IP dreakon SUSE / openSUSE 2 10-02-2005 04:08 PM
Setting a static IP hongman Linux - Networking 6 02-22-2005 06:07 AM
Setting a Static IP wh33t Mandriva 1 12-20-2003 06:04 AM


All times are GMT -5. The time now is 04:12 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration