1

I just installed ubuntu 12.04 and I'm trying to set up my internet access. I just have a wired connection so it should be quite simple.

My computer has two interfaces, eth0 and eth1.

I'm not sure which one my wire is plugged into right now.

At first it was working correctly, but then I tried to set a static IP address, and from there it's not working anymore, even if I cancel the modifications I made. I even tried the other interface, and it's not working either. Right now I just want it to work regardless of the interface.

Please help me to figure out what is not working properly.

One thing I'm sure of is that both the cable and the router do work, so it's a linux configuration problem.

Here's what I've done:

I've been to /etc/network/interfaces and I've added the following:

auto eth1
iface eth1 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1

I doubled checked that these are the correct values for my network. Then I did:

/etc/init.d/network restart

and even tried:

ifdown eth1
ifup eth1

I sometimes got the message 'RTNETLINK answers: file exists - error when doing ifup on alias eth1:1 on RHEL5.'

Sometimes it works just for a while and I don't understand what's wrong.

Right now it's not working again.

If I ping the gateway I get an answer from one of my own interfaces (apparently) saying icmp host unreachable

I can't copy paste so it's hard to copy the whole output of ifconfig. I would have to do it by hand. But if you ask me for a specific line I can give it to you. It roughly returns:

lo:    
127.0.0.1    
eth0:    
link:ethernet    
inet addr: 192.168.1.3 (this address range can only come from the dhcp)
bcast: 192.168.1.255    
mask 255.255.255.0    
eth1:    
192.168.1.100    
bcast: 192.168.1.255    
mask 255.255.255.0
fschl
  • 149
  • 7
timZEI
  • 11
  • 1
  • 3
  • Check your DHCP range in the router, and try to assign a static IP outside that range. – Mitch Jun 19 '12 at 18:04
  • I did, it's out of the range. – timZEI Jun 19 '12 at 18:05
  • type: `ifconfig > filename.txt`, this saves the console output in a textfile and makes it easy to copy-paste – fschl Jun 19 '12 at 18:09
  • You wrote you are "not sure which one my wire is plugged into right now". If you get an address from DHCP on eth0, wouldn't eth0 be the interface which is connected? – elmicha Jun 19 '12 at 18:10
  • I would first figure out which interface you are using, and just configure that one. You have a link light? – belacqua Jun 19 '12 at 18:12
  • @F.S. yes I know that but it's not the same computer (obviously, since I am talking about lack of internet connection) and I don't have a shared medium to transfer that file. – timZEI Jun 19 '12 at 18:15
  • @elmicha Yes I guess so, although I have switched from one interface to the other multiple times so I guess this could be from a previous setup. I'm not doing anything anymore now and waiting for your instructions, I'm tired of trying to fix it and making it even worse. – timZEI Jun 19 '12 at 18:16
  • @timZEI *facepalm* yea ok alright :D – fschl Jun 19 '12 at 18:17
  • @belacqua what is a 'link light' ? How would I proceed to be sure which interface my ethernet wire is plugged into ? – timZEI Jun 19 '12 at 18:17
  • Link light assumes you are looking at the actual system -- most ether adapters have lights for various things -- protocol up, speed, etc.. Usually, checking that you've got green lights where the line is plugged is the first step. You can also plug/unplug the cable and check `dmesg` . – belacqua Jun 19 '12 at 18:24
  • Oh and there I thought it had a special tech meaning lol. yeah as a matter of fact it's orange. What does that mean ? – timZEI Jun 19 '12 at 18:27
  • Hah -- vendors usually call orange 'amber' -- means something's not right (usually no full connectivity, though it can also mean 100 versus 1000 Mbits). – belacqua Jun 19 '12 at 18:29
  • Well that something is not right I already knew lol. But what is ? – timZEI Jun 19 '12 at 18:30
  • Unfortunately I've got to run, but see my (start of an) answer and see if you can at least get back on solid ground, then start working on the static part). – belacqua Jun 19 '12 at 18:34
  • I'm not sure whether you can have eth0 and eth1 in the same network (192.168.1.*) at the same time - if the system wants to reach 192.168.1.1, how can it decide whether it should use eth0 or eth1? Can you please disable/remove the lines for either eth0 or eth1? – elmicha Jun 19 '12 at 18:35
  • Ok so I found out I'm on eth0 right now, thanks to dmesg. – timZEI Jun 19 '12 at 18:39
  • @belacqua I can't even get back to solid grounds, as stated in a comment to your answer. – timZEI Jun 19 '12 at 18:39
  • @elmicha your answer makes sense. What is a 'line' exactly, and how do I disable it ? – timZEI Jun 19 '12 at 18:40
  • I meant the lines (rows of text) in /etc/network/interface. You can disable the lines (for eth1) by putting a "#" at the start of the line. Or you can remove (delete) these lines. – elmicha Jun 19 '12 at 19:22
  • Ok sorry for not understanding. I commented out the lines relative to eth1. The problem still remains. However when I did sudo /etc/init.d/network restart to apply the changes, a message (which had appeared before under similar circumstances by the way, but I had forgotten to mention it) said: ignoring unknown interface: eth0=eth0. – timZEI Jun 19 '12 at 20:52
  • I see that nobody asked why you wanted to edit /etc/network/interfaces in the first place, we all assumed that you have to do it. So, do you really need to edit /etc/network/interfaces or did you read a guide that might be outdated? You can certainly use a static IP address with the normal network manager (if you are using a GUI, at least). – elmicha Jun 20 '12 at 16:46
  • Well I'm coming to a point where I don't care how I get to the solution, as long as it works. I would have preferred a command line solution for many reasons, one of which is that it's easy to reproduce elsewhere. But if you find me a solution using the network manager, I'll take it ! I am indeed using a GUI, and I actually also tried the network manager way right now, and I still don't have an internet connection. – timZEI Jun 20 '12 at 18:05
  • @timZEI - remember this is a Q&A site - so please re-edit your question with further information. Comments should be only used to obtain further information. Can I suggest you summarise the information above as an edit of your question and delete your comments. Thanks – fossfreedom Jun 20 '12 at 20:49

2 Answers2

1

I would first figure out which interface you are using, and just configure that one. Do you have a link light?

Link light assumes you are looking at the actual system -- most ether adapters have lights for various things -- protocol up, speed, etc.. Usually, checking that you've got green lights where the line is plugged is the first step.

You can also plug/unplug the cable and check dmesg.

Here's what I see from dmesg when I unplug/replug my ethernet cable:

[16661.901920] e1000e: eth0 NIC Link is Down
[16666.460518] e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx

You might want to at first go back to a known good configuration. Perhaps test thaqt you can still get DHCP. Here's my basic /etc/network/interfaces for dhcp:

auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp

Also see How do you configure desktop for a static IP address? .

belacqua
  • 22,880
  • 23
  • 88
  • 108
  • yeah that's the sad thing it appears I can't even get back to a known good configuration. As stated above in my comment, the link light is amber. dmesg actually told me something: the link I am right now is eth0. If I unplug and plug back my wire, I get a dmesg that says r8169 0000:0a:00.0: eth0: link down (and then link up) – timZEI Jun 19 '12 at 18:38
0

Network Manager is the issue. You need to set your network settings in Network Manager (in the right upper corner of your screen) instead of via /etc/network/interfaces.

Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493