Solved

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

Posted on 2011-03-15
3
667 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

728 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