Solved

How to save a modifed IP permanently in linux system by using ifconfig?

Posted on 2011-03-15
3
664 Views
Last Modified: 2012-08-14
Dear,

I have debian server with a default DHCP. I change the IP of the system by using ifconfig as below:

/ifdown eth0
 
/ifconfig eth0 192.168.1.2 netmask 255.255.255.0 up

It is getting the new static IP, but when reboot it will get back as dhcp and a new IP is assigned such as 192.168.1.100

I need to save the new IP in the system and stop the dhcp. how?

Nabil
0
Comment
Question by:nabilhammoud
3 Comments
 
LVL 15

Accepted Solution

by:
Insoftservice earned 175 total points
ID: 35136071
hi,

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

change bootproto from dhcp to static.
assign the ip to it.
u can do the same thing via
cmd =>  neat

0
 
LVL 16

Assisted Solution

by:Blaz
Blaz earned 75 total points
ID: 35147124
To further clarify insoftservice's suggestion the file /etc/sysconfig/network-script/ifcfg-eth0 should look like

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
NETMASK=255.255.255.0
IPADDR=192.168.1.2
USERCTL=no
PEERDNS=yes
TYPE=Ethernet
IPV6INIT=no
0
 

Author Closing Comment

by:nabilhammoud
ID: 35154387
THX
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question