Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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'm setting up a NAT, and need to assign a static IP to my eth1 interface. The problem is that once in a while, it resets, and I need to run the following command again:

sudo ifconfig eth1 netmask

I was wondering if I can hardcode this static IP to this interface. Probably there should be a file which we would just need to modify, or so?

share|improve this question

If you are using Ubuntu Desktop, you can use Network Manager to configure the static IP address. For Ubuntu server (or manual configuration on Ubuntu Desktop), you can edit the /etc/network/interfaces file:

sudo nano /etc/network/interfaces

And add the following content:

auto eth1
iface eth1 inet static

You can apply the settings by restarting the networking service:

sudo service networking restart
share|improve this answer
I've done this, and unfortunately after restarting, ubuntu failed to show networks! look at here:… – Tina J Jun 2 '14 at 18:03

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.