LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   static ip issue (https://www.linuxquestions.org/questions/linux-newbie-8/static-ip-issue-4175412266/)

sarahER 06-19-2012 08:40 AM

static ip issue
 
hello,

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.'

thanks

montel 06-19-2012 10:04 AM

Does this not work for in your network and externally? If you ping 192.168.1.1, it wont return anything? Or is it only when trying to connect out?

I have had a problem like that and had to declare the nameservers in /etc/network/interfaces.
auto eth1
iface eth1 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
#I dont know if you have anything internally, just using google's DNS as an example.
dns-nameservers 8.8.8.8 8.8.4.4

Im not sure if you are using Ubuntu Server or Desktop, but this guide may be helpful for you: Ubuntu Server Guide

david1941 06-19-2012 10:06 AM

The output from ifconfig would tell us what is actually set up. Please post it between code tags(
Code:

output
):

sarahER 06-19-2012 11:33 AM

Sometimes it works just for a while 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

montel 06-19-2012 12:36 PM

I'm out of ideas for the moment, but will try to do some research on what this problem could be/how to solve it. I was just going on previous experiences before. I have had a problem before where the dhclient still has a dhcp lease from the router and will mess with your static settings, but I am not sure...I haven't had a lot of experience in this area.

The more logs/errors you can find or supply would be helpful :)

I have a bit of work to do, but will look back later today. Hopefully someone can give some help.

sarahER 06-19-2012 03:58 PM

I forgot to mention something: when I did sudo /etc/init.d/services restart, I also got the message ignoring unknown interface eth0=eth0

montel 06-19-2012 05:10 PM

Can you try running this and see if it gives you back the correct results?

lshw -C network

sarahER 06-19-2012 05:20 PM

What do you mean by correct results ?
Yes I think it does, that's sort of the hardware I bought, though I wouldn't be sure they're part of the motherboard so I'm not that familiar with the internal names of each motherboard component. But yeah this is it, it's not where the problem comes from.

montel 06-19-2012 05:42 PM

Sorry about that, by correct, just that it noticed the right hardware, and gave the right ethernet interface for what you were using.

I asked this because of what you said before:

"My computer has two interfaces, eth0 and eth1.
I'm not sure which one my wire is plugged into right now."

I was thinking that this would give some information on which interface to troubleshoot. (I am in uncharted territory though, I have some experience with Linux, but have only been at it off and on for a couple years)

montel 06-19-2012 06:03 PM

Also, are you using Ubuntu Desktop or Server?

sarahER 06-19-2012 06:06 PM

I actually found out it's eth0 by unplugging and plugging back and looking at dmesg.
It's the desktop edition

montel 06-20-2012 10:21 AM

I was messing around on my machine at home last night and was thinking it could be a dhclient issue. Your Ubuntu box runs fine on dhcp but not when you want a static IP right?

Try running ps ax | grep dhclient
If it is running, kill the processes, then restart /etc/init.d/networking.

That might help?


All times are GMT -5. The time now is 05:43 PM.