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 so I have no GUI. When I do the command ifconfig, I cannot find my internl ip address. it says inet addr: 127.0.0.1 .

here is 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 seperate 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.

share|improve this question
1  
@AvatarParto Those are for interfaces facing public access, this question is about internal networks... –  Bruno Pereira Mar 7 at 14:17
    
Out of curiosity, what does /etc/network/interfaces have in it? –  Powerlord Mar 7 at 15:54
    
I know how to use the change directory command, but I do not know how to list the files once there, how would I do this? –  Skateguy Mar 7 at 16:05
    
ls will list files in a directory. ls -l will give a detailed listing. To list contents of a particular directory, ls -l /etc/network. To change into a directory and list contents cd /etc/network ;ls -l. To read the contents of etc/network/interfaces (this is a file) sudo pico /etc/network/interfaces. (pico is a lightweight text editor - good for reading & basic editing, and less intimidating than vi.) –  douggro Mar 7 at 16:18

2 Answers 2

up vote 10 down vote accepted

These commands will tell you all network info

ifconfig -a

or

ip addr show

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

share|improve this answer
    
when I log in it tells me there are a few upgrades or updates, so I assume it has to talk to official ubuntu website to know it has updates, So i think my internet is working. –  Skateguy Mar 7 at 13:35
    
@Skateguy try to open askubuntu.com and please print all ifconfig -a –  kamil Mar 7 at 13:36
    
I have no GUI, i am about to type it out though. –  Skateguy Mar 7 at 13:53
    
How can I answer the questions that your two options pose? –  Skateguy Mar 7 at 14:58
    
@Skateguy First it seems you don't have a dhcp server and you will have to set your ip manually. can you tell us your network topology, how are you connected to the internet. and please post the output of the following command in your terminal: host askubuntu.com –  kamil Mar 7 at 17:01

I think it worth mentioning that running ifconfig along with -a option will display all interfaces wether or not the interface has an IP.

running ifconfig alone, will display only interfaces with IPs assigned.

Here is a nice trick you could use to display only IPs using Perl.

# ifconfig | perl -nle'/dr:(\S+)/ && print $1'
192.168.1.100
127.0.0.1

Your network card is recognized by the system, that why its showing up eth0 and eth1

here is a quick way of assigning IP to your interface, use valid IP/Subnet accordingly.

 ifconfig eth0 192.168.1.200/24 up 

then we need to add a default route

route add default gw 192.168.1.1

Best,

share|improve this answer
    
I would try this method but you will have to break it down a little more for me to understand it, as in how to find or know a valid IP, subnet and a valid default route. –  Skateguy Mar 8 at 23:30
    
this is a static IP assignment for your network interface, meaning if you are behind a router with subnet of 192.168.1.0/24 then you can ping an ip ex. 192.168.1.200 and if you get no response, then go a head and use ifconfig interface_name IP_ADDRESS/MASK up Your default gw needs to be added after assigning IP. –  user1007727 Mar 12 at 19:17

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.