Solved

ifconfig settings are lost after reboot

Posted on 2010-09-13
5
963 Views
Last Modified: 2012-06-21
how do i make them stay after rebooting?

samething with gw and dns.

assuming theres somekind of process on startup that enables dhcp.....

centos 5.5
0
Comment
Question by:Kylo Ren
  • 2
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
ddiazp earned 225 total points
ID: 33664505
open the file:

/etc/sysconfig/network-scripts/ifcfg-ethX (depending on your ethernet device)

And post the contents. You want to make sure that it's enabled on startup and PROTO is DHCP.

DHCP should automatically populate the /etc/resolv.conf file with the nameserver and domain search. If not, edit your /etc/resolv.conf file like this:

search domain.com
nameserver <ip of DNS Server1> <ip of DNS Server2>

to verify the default gateway, type the command  "route"  and show the output; if there's none, you might need to put it in yourself:

route add -net default gw X.X.X.X (put ip of default gateway)


All these should be automatically updated with DHCP, but if it's not doing it, once you set it up manually as above, they should stay permanently.

You can test with ` service network restart`
0
 
LVL 4

Author Comment

by:Kylo Ren
ID: 33665415
device=eth0
bootproto=dhcp
onboot=yes

********************

I need to set it to static so i set it up as follows and saved.

BOOTPROTO=static
    IPADDR=192.168.0.8
    NETMASK=255.255.255.0
    NETWORK=192.168.0.0
    BROADCAST=192.168.0.255
    GATEWAY=192.168.0.1

it didnt work....


dhcp works but i need a static ip

thanks for the help!!

0
 
LVL 19

Assisted Solution

by:jools
jools earned 25 total points
ID: 33665554
if you have bootproto set to static then it should be static.

have you got any typos? Post the whole file back here.

if you want to create the config using the gui you can use system-config-network.

J
0
 
LVL 10

Expert Comment

by:ddiazp
ID: 33665699
have you restarted the network service since that change?

can you type ifconfig -a and post the output?

When you say 'it didn't work', you mean the interface didn't get that IP address after network was restarted?
0
 
LVL 4

Author Closing Comment

by:Kylo Ren
ID: 33665967
i accidently typed in a ip that was already in use which prevented the interface from coming up.  kept everything the same except for the ip and voila.  thanks guys
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

706 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now