Ubuntu – How to find the internal ip address

networking

I have Ubuntu server 12.04 installed, so I have no GUI. When I do the command ifconfig, I cannot find my internal IP address. It says inet addr: 127.0.0.1.

Here 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)

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

If someone could edit this for me, the contents of etc/network/interfaces should be on separate lines.

The output of host askubuntu.com was:

;; connection timed out; no servers could be reached.

I set up owncloud and webmin a few months ago and was using them for a month with no problems. I think the power went off one day 2 months ago and I never turned the server back on until yesterday. I haven't done anything that would have affected the internet setup So i'm not sure why it doesn't work anymore. As far as my network topology goes, I have a pci-e network card for the pc. The ethernet line goes from the network card to a switch, and then to a modem/router from there.

Best Answer

These commands will tell you all network info

ip add

or

ifconfig -a

If as you say it only gives you 127.0.0.1 then there are two options:

  1. Your network card is not attached or not recognized by the system

  2. Your network DHCP server is not runnning or not connected

Related Question