3

I recently installed Ubuntu Desktop 13.10 and I am trying to set up static IP by changing the /etc/network/interfaces file from:

# interfaces(5) file used by ifup(8) and ifdown(8)                                                                                                                        
auto lo
iface lo inet loopback

iface eth0 inet dynamic

to:

# interfaces(5) file used by ifup(8) and ifdown(8)                                                                                                                        
auto lo
iface lo inet loopback

iface eth0 inet static
address 192.168.1.70
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8

Using whatever I gleaned from these FAQ/Tutorial Sites

I have double checked those numbers, and they are the same values I use on 2 different computers at the office (NOTE: those 2 computers, raspis, are connected to a network switch then the router, whereas the desktop currently in question connect directly to the router). However, when I enable static addresses and restart, the machine does not get the ip address I requested (192.168.1.70), instead getting a different one (192.168.1.111) disabling the NIC altogether. I have also tried requesting a different ip address (192.168.1.199) in case the old one was taken, but that too results in the NIC being disabled.

I am asking this question here as google/SO does not seem to have an answer specifically pertaining to what users should do, and how they should proceed when simply "googling the problem" and quickly updating a single file does not result in static addresses. I am specifically requesting the following:

  1. An answer as to why this may not be working (ie. whether this is Ubuntu 13.10 related).
  2. How to debug the network initialization during boot.
  3. How to finally set up static ip addressing.

EDIT:

As per Atari's requests, I tried setting the IP using the GUI instead of the command line. To do this, I had to purge the /etc/network/interfaces file first (by commenting out the static related lines), restarting, then trying again. If I do not do this, I can not even access the options of my NIC. This did assign a static IP to my computer, however, now I only have local access to and from it (via ssh) with absolutely no access to the internet.

puk
  • 1,161
  • 5
  • 14
  • 24
  • Do you have the desktop installed on the problem computer? Or are you working CLI only? – Atari911 Oct 28 '13 at 22:24
  • @Atari911 I have the desktop installed, out of preference I am using the terminal to update this file – puk Oct 28 '13 at 22:36
  • Thats what i was wondering. Have you tried to change it using the GUI? Just to check that works? – Atari911 Oct 28 '13 at 22:38
  • @Atari911 I will try that and edit the question to include the outcome – puk Oct 28 '13 at 22:38
  • It seems like maybe there is another program that is taking the network settings from some other config. Im thinking this because you are good until you reboot. – Atari911 Oct 28 '13 at 22:40
  • @Atari911 Oh man I really messed up on account of having 2 ethernet cards. Turns out if I set up static addressing the NIC fails and I have **no** internet. I added a strikeout to address this. Sorry – puk Oct 28 '13 at 22:51
  • @Atari911 your suggestion worked when using the GUI. Add it as an answer and I will accept it if you like. Also, any idea why this is happening? I don't feel comfortable using a GUI version without understanding why the command line version failed – puk Oct 28 '13 at 22:53

7 Answers7

2

I would try to use the GUI to set the static IP. If that works then you know that you are using the NetworkManager package to control that NICs IP. The package should disable itself for the interface if it is mentioned in the manual config (as per: https://wiki.debian.org/NetworkManager) But that seems to not be happening.

You can also remove the NetworkManager completely with...

sudo apt-get install network-manager-gnome

sudo apt-get remove network-manager

...and then attempt to change it manually.

Atari911
  • 572
  • 4
  • 6
  • Also, now that you mentioned having two NICs... Make sure that you are referencing the correct interface in the config. NetworkManager will disable for that interface only if it is explicitly mentioned in the /etc/network/interfaces. – Atari911 Oct 28 '13 at 23:20
  • That's a good idea actually as eth1 is not mentioned in `/etc/network/interfaces`, only eth0 – puk Oct 28 '13 at 23:34
  • Thank you for all your help, but ultimately I will have to go with BillThor's answer as I am pretty sure I was missing `auto eth0` – puk Oct 29 '13 at 00:09
  • Also, to anyone taking Atari's advice, I went ahead and stupidly (and blindly) added `iface eth1 inet dynamic` to my `/etc/network/interfaces` file and it mucked up my boot and I had to drop down to recovery mode to fix it...do not make the same mistake I made. – puk Oct 29 '13 at 00:11
  • Yea, I guess I should have looked at the configuration you made a little closer. Well, know you know how to mess with the networkmanager! lol – Atari911 Oct 29 '13 at 05:08
  • This is not an acceptable answer in cases where you don't have connection to the internet :) – Henry Aloni Dec 29 '13 at 09:00
2

You are missing the line which will cause the configuration to be run at startup.

Edit your /etc/network/interfaces configuration and add the line:

auto eth0

In the mean time, you can set the static address with the command:

sudo ifup eth0

It you want to have the interface to start only when you are connected to a specific network, check the documentation and examples for the ifupdown package. In particular, look at the mapping command. The ping-places.sh command can be useful in identifying which network you are on.

BillThor
  • 4,628
  • 18
  • 22
  • Can you be more specific when you say `Edit your configuration`...which configuration? `/etc/network/interfaces`? – puk Oct 28 '13 at 23:34
  • @puk I've edited the post to be more specific. – BillThor Oct 28 '13 at 23:38
  • This may be entering the realm of stupid question, but should I remove any other `auto` commands already in there, like `auto lo` – puk Oct 28 '13 at 23:41
  • I think it was the fact that I was missing `auto eth0`. It *seems* to be working at the moment – puk Oct 29 '13 at 00:11
2

It seems I am a little late, but still: Since I think 12.04 you are screwed if you want to invest little work and get stuff done via the old /etc/network/interfaces.

But there's hope ! :D

Just use /etc/NetworkManager/system-connections/CONNECTIONS

If you take a standard system connected via ethernet the file usually looks like this:

filename: Wired connection 1

content:

[802-3-ethernet]
duplex=full
mac-address=xx:xx:xx:xx:xx:xx

[connection]

id=Wired connection 1
uuid=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
type=802-3-ethernet
timespamp = xxxxxxxxxx

[ipv6]

method=auto

[ipv4]

method=manual
dns=192.168.0.1
address=192.168.0.123/24,192.168.0.1
Seth
  • 57,282
  • 43
  • 144
  • 200
N8c
  • 21
  • 1
1

I found this is easily done on your router. I don't know what type of router you may have but there should be an option where you can have your MAC address map to a specific IP address on your LAN. This is the setup I have...

1

You're almost there. ssh works, a fixed IP is ok. Now the only thing missing is of course the dns. That's why you fail to get on the internet. Your gateway is 192.168.1.1 and that's presumably a router. Many of them provide dns, so simply try 192.168.1.1 as nameserver

Braiam
  • 66,947
  • 30
  • 177
  • 264
jdeca
  • 11
  • 1
1

need the auto eth0, other than that once you have the code do a full reboot and the change will take place.

ifconfig eth0 up/down does not make the change.

Braiam
  • 66,947
  • 30
  • 177
  • 264
mmcclellan
  • 19
  • 1
0

When you use the ifdown and ifup use the -v option to print any error after that you should kill the dhcp deamond by pressing Ctrl+Alt+T (to open a terminal ) and type : sudo killall dhcp and enter your password .

αғsнιη
  • 35,092
  • 41
  • 129
  • 192
Sarastro
  • 197
  • 1
  • 3
  • 11