Hardcoded static IP assignment for eth1

7,186

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:
7,186

Related videos on Youtube

Tina J
Author by

Tina J

Updated on September 18, 2022

Comments

  • Tina J
    Tina J over 1 year

    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?

  • Tina J
    Tina J almost 10 years
    I've done this, and unfortunately after restarting, ubuntu failed to show networks! look at here: askubuntu.com/questions/213614/…
  • Girol
    Girol about 6 years
    @TinaJ did you solve this?
  • Tina J
    Tina J about 6 years
    It was a long time back. I don't remember.