Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I configured a network interface with the following commands:

ifconfig eth0 up
ip addr add dev eth0
route add default gw

This works. However, when I reboot the machine I lose all the configurations made. How can I make sure this is persistent? I'm using CentOS 6.3.

share|improve this question
check this stackoverflow.com/questions/6016713/… – harish.venkat Dec 29 '12 at 18:18
The other (and more correct) option will be setting the corresponding values in your system configuration files. Which Linux distro are you using? (If that's Linux, of course) – Leonid Dec 29 '12 at 19:02
@harish.venkat That's the wrong way to configure things for your network. – gertvdijk Dec 29 '12 at 20:46
Are you using GUI or a CLI-only? – gertvdijk Dec 29 '12 at 20:48
up vote 6 down vote accepted

First of all, your given configuration of the default gateway is not valid. is not within the network of I suspect you made a typo, so I assume you meant as the default gateway here.

Referring to the RHEL 6 Deployment Guide section 8.2 for the address and section 8.4 for routes:

  1. Create/edit a file /etc/sysconfig/network-scripts/ifcfg-eth0 containing:

    NETMASK= # this is /28
  2. Create/edit the route configuration file /etc/sysconfig/network-scripts/route-eth0:

    default dev eth0
share|improve this answer
@UlrichDangel Good point. Wasn't completely awake I guess. Fixed. – gertvdijk Dec 29 '12 at 21:31
@gertvdijk got it,just provided a quick fix. – harish.venkat Dec 30 '12 at 3:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.