Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have Ubuntu Server 12.04 installed with no GUI. I installed ownCloud and webmin a few months ago with no problem, so I know my internet used to work. The power went out while the PC was on one day 2 months ago and I did not turn the PC back on until yesterday. Now I have no internet connection. Does anyone know how I can fix this, or should I just reinstall Ubuntu?

this is the output of ifconfig -a:

 eth0   link encap:Ethernet  HWaddr 00:06:4f:4a:66:f0
BROADCAST MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth1   link encap:Ethernet  HWaddr 00:16:ec:05:c8:9c 
    BROADCAST MULTICAST  MTU:1500  Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo     Link encap:Local Loopback
    inet addr 127.0.0.1  Mask:255.0.0.0
    inet6 addr:  ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:65536  Metric:1
    RX packets:1800 errors:0 dropped:0 overruns:0 frame:0
    Tx packets:1800 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:143896 (143.b KB)  TX bytes:143896 (143.8 KB)

I have a wired connection.
Here are the contents of etc/network/interfaces:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

I tried assigning a static IP to eth2, which is a adapter I just added, and now when I run ifconfig it shows a inet addr of 192.168.1.100. So I have an ip now. When trying to add the default gateway, I typed route add default ge 192.168.1.1, and it said,

Usage: inet route [-vF] del {-host|-net} Target[/prefix] [gw GW] [metric M] [[dev] if]

There are 5 more lines of writing associated with this route error, but I do not want to type all that out unless it is needed. Does anyone know what to do?

share|improve this question
    
Maybe you need to request an ip from the router. Try running sudo dhclient eth0. –  Seth Mar 9 at 0:17
1  
Also, have you checked the router? Is it on? Is it the same one you use for the rest of the network? –  terdon Mar 9 at 0:22
    
Yes, the router is fine. I am posting this on it right now. And yes it's used for my home network. I will try running sudo dhclient. –  Skateguy Mar 9 at 0:29
    
Are you sure you don't have internet now that you have an IP? Why do you want a default route? –  Seth Mar 14 at 1:08
    
I meant to say default gw. And I am only trying to do that because of what the user that responded with the answer below me said. I will post a current ifconfig when in front of the server again. –  Skateguy Mar 14 at 1:21

1 Answer 1

Looking at your ifconfig output, I don't see any IP address assigned, there are many ways of troubleshooting this issue, assuming you have your cable connected to the first Ethernet port eth0 on your server.

  1. send new DHCP request

    dhclient eth0 
    
  2. Try and assign static IP if DHCP request failed.

     ifconfig eth0 192.168.1.100/24 up 
    

then add default gw

route add default gw 192.168.1.1 
  1. try and ping 8.8.8.8 and hopefully you will get a response.
share|improve this answer
    
why would my ip address ever have been un-assigned if it used to work? –  Skateguy Mar 13 at 15:57
    
I can't answer that question, I'm not sure about your environment setup, do you know the rule of thumb, you always assign static IP address to servers. –  user1007727 Mar 13 at 17:13
    
I know now thank you for telling me. I am new to the world of linux and servers so I am trying to learn and do the best I can. I thought you have to pay money for a static ip address but I guess that only applies to the external ip? I will try your answer soon when I am at the server again. –  Skateguy Mar 13 at 17:35
    
if you are behind a router (LAN) you are on a private ip subnet, meaning you can use any IP unless its being used by another device. private subnets allow you to use upto 254 IPs However you do generally need to pay for static address for on the other side of the router ( WAN) public ip subnet. –  user1007727 Mar 13 at 18:13
    
When I try sudo dhclient eth2(I added a new adapter that's not listed) it says command not found. I think assigning the static ip worked because now when I do ifconfig eth2 shows up and it says inet addr:192.168.1.100. When adding the default route I dont think it worked right because a few lines of stuff came up, I will type it out up above in the question area. –  Skateguy Mar 13 at 20:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.