Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 192.168.47.1 netmask 255.255.255.0

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

1 Answer 1

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
    address 192.168.47.1
    netmask 255.255.255.0

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: askubuntu.com/questions/213614/… –  Tina Jasmin Jun 2 at 18:03

Your Answer

 
discard

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.