LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   setting up static ip using shell command (https://www.linuxquestions.org/questions/linux-newbie-8/setting-up-static-ip-using-shell-command-910220/)

avee137 10-26-2011 04:50 AM

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.

fukawi1 10-26-2011 04:55 AM

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.

avee137 10-26-2011 05:15 AM

can gateway be configured using ifconfig?

fukawi1 10-26-2011 05:18 AM

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

avee137 10-26-2011 05:29 AM

Quote:

Originally Posted by fukawi1 (Post 4508664)
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!


All times are GMT -5. The time now is 07:20 AM.