LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ubuntu Server ip address (https://www.linuxquestions.org/questions/linux-newbie-8/ubuntu-server-ip-address-874380/)

ansrewdps 04-11-2011 02:12 PM

Ubuntu Server ip address
 
I've installed a new copy of Ubuntu Server 10.10. To test that I executed a "ping hostname" at command line.I see that the ip address is set to the loopback(lo) inet addr:127.0.0.1. "ifconfig" returns the etho details which look good to me.

I've read somewhere that it sets to the loopback inet addr initially.Also,it doesn't allow me to ping/ssh from external machines to test it.

How,do I set the machine to use the address in etho0.

Thanks

Andrew

paulsm4 04-11-2011 02:23 PM

The machine's address *is* the IP address you see in ifconfig.

Which, I presume, is NOT 127.0.0.1 ;)

If you can't "ping" other hosts (or they can't "ping" you), that's a separate problem:

1. Use DHCP, if possible.

2. If you have multiple hosts, they should use DHCP if possible, too.

3. Each host should be able to "ping" it's gateway.

4. Each host should be able to "ping" each other...

5. ... UNLESS your firewall prohibits ICMP

'Hope that helps .. PSM

PS:
Using "localhost" (127.0.0.1) for local connectivity is a Good Thing. But you can change this behavior by editing /etc/hosts (among other ways).

ansrewdps 04-11-2011 02:34 PM

Thanks Paul,

I can "ping" other hosts. Also,when I ping from other hosts to the new machine,it says

PING hostname(ip addr) 56(84 bytes of data) and stucks there.ip addr which showed up when I ping from other hosts is different from the inet address(under eth0) I get when I run "ifconfig".I guess that should be the problem.How do I configure this from command line?I don't GUI on the new machine for now

Andrew

ansrewdps 04-11-2011 03:36 PM

"ping hostname" looks for different ipaddr and ifconfig(for eth0) returns different ipaddr. I guess this should the problem that worrying me.

Is there anyway I can set eth0 such that it looks for same addr.I tried "ifconfig etho 129.***.**.*** up" and restarting the network.And I noticed that the inet addr was reset to previous value for eth0

Any suggestions

Andrew

paulsm4 04-11-2011 04:24 PM

Quote:

I executed a "ping hostname" at command line...is set to the loopback(lo) inet addr:127.0.0.1. "ifconfig" returns the etho details which look good to me.

I guess this should the problem that worrying me.
Don't let it worry you :)
The "127.0.0.1" address is expected, it's normal ... and it's a Good Thing.

sibe 04-11-2011 05:01 PM

Quote:

Originally Posted by ansrewdps (Post 4321309)

PING hostname(ip addr) 56(84 bytes of data) and stucks there.ip addr which showed up when I ping from other hosts is different from the inet address(under eth0) I get when I run "ifconfig".I guess that should be the problem.How do I configure this from command line?I don't GUI on the new machine for now

Andrew

I think that could be the problem; the machine from which you're pinging has translated the hostname to a different IP. Try to ping the IP address, not hostname, and see if it still stucks.

If it does, check the output from ifconfig eth0 command, the good thing that you're looking for is lying around the fourth line, it must be saying

Code:

UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
If it's not UP and RUNNING, then your interface is offline, you need to bring it online (i.e. restarting network service).

One thing, what you have configured through the command prompt will be lost once you restart the service, nor it will survive in the event of reboot. To be persistent, you need to put it in your configuration file (e.g. /etc/network/interfaces).

Is there any intermediate device between your pinging machine and the troubled one?


----
sibe

paulsm4 04-11-2011 09:26 PM

sibe -

I don't think the OP has a problem per se. I believe he's just under the mistaken impression if "ping hostname" returns 127.0.0.1, that's somehow a Bad Thing.

IMHO ...

ansrewdps 04-12-2011 10:31 AM

"ifconfig " returns expected output in the eth0(fourth line)...

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Sorry about that...Let me make my problem clear if thats confusing you guys...

I've recently installed Ubuntu Server 10.10 on the machine and
1. from new server machine: "ifconfig" returns an output with eth0 inetaddr:129.***.**.*** and ping hostname(new machine hostname) works well.
2. from other hosts: "ping hostname"(new machine hostname) looks for different ip address other than it returned in eth0 addr which I believe is the problem.
3. "ping ipaddr"(of the new machine's eth0 inet addr) from other hosts works again

So,is there any way I can configure the machine so every host look for same ip address thats returned in eth0 inet addr. I guess ping from other hosts are looking for wrong ipaddr.


Andrew

ansrewdps 04-12-2011 12:22 PM

I guess the hostname is pointing to different ip address which I need to set it to correct address.May be something to do with DCHP??not sure. Any idea on how to do this?

Thanks

repo 04-12-2011 12:35 PM

Is 129.x.x.x
a public IP given to you by your ISP?
Are you pinging from inside the local network(LAN)
or from outside the network?
If ping <hostname> times out, it means it can't resolve the IP
Do you have a DNS setup to resolve 129.x.x.x to your hostname?
Code:

dig 129.x.x.x
Kind regards

ansrewdps 04-12-2011 01:11 PM

If I understood your question,it uses DHCP to get an IP and I'm pinging from inside the LAN.

I'd the DNS setup but still I get the problem

repo 04-12-2011 01:21 PM

Code:

I'd the DNS setup but still I get the problem
What did you do?
What is the hostname?
How did you setup your network?
Code:

router => ubuntu server => internal network
or do you have a different setup?
If the IP doesn't has a DNS entry, you can't resolve it.
what is the output from
Code:

nslookup hostname
from a machine on your local network.

Kind regards

ansrewdps 04-12-2011 01:34 PM

It returns

Server: ipaddr1
Address: ipaddr1#53

name: hostname
address: ipaddr2

But the ipaddr2 is different from the eth0 inet address.Shouldn't both the address be same??

Thanks

Andrew

repo 04-12-2011 01:40 PM

Quote:

But the ipaddr2 is different from the eth0 inet address.Shouldn't both the address be same??
Depends how the network is setup
Do you have a router, a modem?
How is the setup from the router, how is the setup from the network?
Does eth0 receives an ip from the router, or directly from the provider?
Is eth0 also your external IP, or is it setup via DHCP from the router?
To find the external IP from your network, got to
http://www.whatismyip.com
The DNS should resolve to the external ip from the router/modem
Do you have a fixed IP?

Kind regards

ansrewdps 04-12-2011 01:56 PM

It is connected via switch...But I'm pretty sure that they should have the same ip because it's how the other server that's connected to the same switch is behaving(which is infact working fine).It has the same eth0's inet addr and in nslookup.
However,the new server has different addresses.


All times are GMT -5. The time now is 04:39 PM.