How to change IP when /etc/network/interface file is missing?

2,412

Solution 1

You typed:

sudo vi /etc/network/interface

You should have typed this:

sudo vi /etc/network/interfaces 

You forgot the s.

Solution 2

Ubuntu uses Network Manager to manage the network configuration.

Run nm-connection-editor to set a static IP.

Solution 3

Adapted from: Create a Static IP from the Command Line


Basically, steps needed are:

Find out you current settings:

ifconfig eth0

Edit /etc/network/interfaces to meet your requirements.

Look for these two line:

auto eth0
iface eth0 inet dhcp

Change them to instead be: (example IP addresses)

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
    address 192.168.0.130
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
    gateway 192.168.0.1
    dns-nameservers 192.168.0.1

Then re-start your server.

It should now be using: 192.168.0.130

Share:
2,412

Related videos on Youtube

Joe
Author by

Joe

Updated on September 18, 2022

Comments

  • Joe
    Joe over 1 year

    I've recently upgraded my mac to 10.9 and having reinstalled Xcode and the command line tools I now get this error when I run g77:

    g77 myprog.f -o myprog
    ./myprog
    

    Gives the following error:

    dyld: no valid entry point
    
    Trace/BPT trap: 5
    

    Does any one have any ideas what this means and how I fix it?

    Thanks!

  • charlesbridge
    charlesbridge over 11 years
    12.04 also needs dns-nameservers 192.168.0.x as they changed how resolv.conf works.
  • david6
    david6 over 11 years
    Sorry, I cribbed from my old notes for 10.04 LTS server.
  • Themelis
    Themelis almost 4 years
    ifconfig is kind of obsolete now