Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-03-15
3
Medium Priority
?
678 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 525 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 225 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
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…
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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

886 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