[Q] Linux and localAddress

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

[Q] Linux and localAddress

Edgar J. De Cleene
Folks:

I playing with Linux and wish know why World reportLocalAddress report
127.0.01 and ifconfig on Linux console gives me 192.168.1.4.

The Linux is SimplyMepis 6.5, installing from his repositories ( via console
synaptic package manager) brings me Squeak 3.8, and I figure out how
transfer and run the 3.10 needed files

The computer is on small Lan connected to router with Mac and Windows, so I
could test Squeak 3.10 on the three systems.

Any lead ?

Edgar




Reply | Threaded
Open this post in threaded view
|

Re: [Q] Linux and localAddress

Philippe Marschall
2007/10/29, Edgar J. De Cleene <[hidden email]>:

> Folks:
>
> I playing with Linux and wish know why World reportLocalAddress report
> 127.0.01 and ifconfig on Linux console gives me 192.168.1.4.
>
> The Linux is SimplyMepis 6.5, installing from his repositories ( via console
> synaptic package manager) brings me Squeak 3.8, and I figure out how
> transfer and run the 3.10 needed files
>
> The computer is on small Lan connected to router with Mac and Windows, so I
> could test Squeak 3.10 on the three systems.
>
> Any lead ?

I already asked this some time ago and was told this was correct
because there are many interfaces on linux and one just happens to be
127.0.0.1. I don't know why the corresponding method is not changed to
a quick return that always returns this, since it is always correct.

Cheers
Philippe

Reply | Threaded
Open this post in threaded view
|

Re: [Q] Linux and localAddress

Bert Freudenberg
In reply to this post by Edgar J. De Cleene
On Oct 29, 2007, at 10:44 , Edgar J. De Cleene wrote:

> Folks:
>
> I playing with Linux and wish know why World reportLocalAddress report
> 127.0.01 and ifconfig on Linux console gives me 192.168.1.4.

I doubt that - ifconfig most certainly gives you *both*, 127.0.0.1  
and 192.168.1.4.

> The Linux is SimplyMepis 6.5, installing from his repositories  
> ( via console
> synaptic package manager) brings me Squeak 3.8, and I figure out how
> transfer and run the 3.10 needed files
>
> The computer is on small Lan connected to router with Mac and  
> Windows, so I
> could test Squeak 3.10 on the three systems.
>
> Any lead ?

The old socket plugin only supported returning one address, it picked  
the first one, and depending on how your Linux box is configured,  
could pick the wrong one.

Ian Piumarta extended the plugin to actually support getting more  
addresses, it is in his latest sources. I think work is underway to  
port this to other platforms. To use the extended primitives you need  
new support code, which is ... somewhere, Michael Rüger did that.  
It's in the OLPC image, for example (which needed to support IPv6 and  
that was the reason for the new plugin).

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: [Q] Linux and localAddress

Davide Arrigo
In reply to this post by Edgar J. De Cleene
2007/10/29, Edgar J. De Cleene <[hidden email]>:
> Folks:
>
> I playing with Linux and wish know why World reportLocalAddress report
> 127.0.01 and ifconfig on Linux console gives me 192.168.1.4.
>
Hi Edgar, your system answer correctly, in Unix/Linux each network
interface has an IP address. This is the ifconfig output on my Linux
server:

[arrigo@aleph ~]$ /sbin/ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0A:5E:05:9A:30
          inet addr:192.168.1.200  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:3694 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3776 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:744868 (727.4 KiB)  TX bytes:1465239 (1.3 MiB)
          Interrupt:19 Base address:0x8000

eth1      Link encap:Ethernet  HWaddr 00:0A:5E:61:E4:1A
          inet addr:192.168.150.1  Bcast:192.168.150.255  Mask:255.255.255.0
          inet6 addr: fe80::20a:5eff:fe61:e41a/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:5712 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6028 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:940605 (918.5 KiB)  TX bytes:6432999 (6.1 MiB)
          Interrupt:20 Base address:0x4000

eth3      Link encap:Ethernet  HWaddr 00:0F:EA:3B:1D:F1
          inet addr:192.168.200.251  Bcast:192.168.200.255  Mask:255.255.255.0
          inet6 addr: fe80::20f:eaff:fe3b:1df1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17510798 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16697957 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:396599015 (378.2 MiB)  TX bytes:2907114630 (2.7 GiB)
          Interrupt:17

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:16436  Metric:1
          RX packets:348589 errors:0 dropped:0 overruns:0 frame:0
          TX packets:348589 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:329493617 (314.2 MiB)  TX bytes:329493617 (314.2 MiB)

As you can see there are many eth interface with its IP address and at
least the localhost 127.0.0.1. Maybe you have to change your request
and ask for a specific interface.

Best Regards


--
--------------------------
Davide Arrigo

Reply | Threaded
Open this post in threaded view
|

Re: [Q] Linux and localAddress

Edgar J. De Cleene



El 10/29/07 7:44 AM, "Davide Arrigo" <[hidden email]> escribió:

> As you can see there are many eth interface with its IP address and at
> least the localhost 127.0.0.1. Maybe you have to change your request
> and ask for a specific interface.
>
> Best Regards
Thanks, very illustrative, I having some similar to yours


I see if I could load CommandShell and OSProcessV4 and test if could do
ifconnfig from Squeak.

Seems I need eth0 answer and not lo answer.

Edgar



Reply | Threaded
Open this post in threaded view
|

Re: [Q] Linux and localAddress

Edgar J. De Cleene
In reply to this post by Bert Freudenberg
El 10/29/07 7:39 AM, "Bert Freudenberg" <[hidden email]> escribió:

> I doubt that - ifconfig most certainly gives you *both*, 127.0.0.1
> and 192.168.1.4.

Yes , I have some similar to Davide Arrigo mail.

> Ian Piumarta extended the plugin to actually support getting more
> addresses, it is in his latest sources. I think work is underway to
> port this to other platforms. To use the extended primitives you need
> new support code, which is ... somewhere, Michael Rüger did that.
> It's in the OLPC image, for example (which needed to support IPv6 and
> that was the reason for the new plugin).
>
> - Bert -

I try this.
As I said, I need eth0 answer.
If I start some game in this machine, I need 192.168.x.y for using in
Firefox or Safari form other computer.
I just discover if I use Nebraska, the Listener in Mac Squeak image works
and gives 192.168.1.4.
So I need dig on how works for send intended IP .

Very thanks !

Edgar



Reply | Threaded
Open this post in threaded view
|

Re: [Q] Linux and localAddress

Giuseppe
All the OS's, answers 127.0.0.1 if you ask for localhost.

localhost = 127.0.0.1 = this machine

If you don't want to check the ethernet interfaces, one of the best ways
is  *ping* to the machine name. On Windows systems, the command hostname,
answers the machine's name.

I don't know how Squeak works for this.

> El 10/29/07 7:39 AM, "Bert Freudenberg" <[hidden email]> escribió:
>
>> I doubt that - ifconfig most certainly gives you *both*, 127.0.0.1
>> and 192.168.1.4.
>
> Yes , I have some similar to Davide Arrigo mail.
>
>> Ian Piumarta extended the plugin to actually support getting more
>> addresses, it is in his latest sources. I think work is underway to
>> port this to other platforms. To use the extended primitives you need
>> new support code, which is ... somewhere, Michael Rüger did that.
>> It's in the OLPC image, for example (which needed to support IPv6 and
>> that was the reason for the new plugin).
>>
>> - Bert -
>
> I try this.
> As I said, I need eth0 answer.
> If I start some game in this machine, I need 192.168.x.y for using in
> Firefox or Safari form other computer.
> I just discover if I use Nebraska, the Listener in Mac Squeak image works
> and gives 192.168.1.4.
> So I need dig on how works for send intended IP .
>
> Very thanks !
>
> Edgar
>
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: [Q] Linux and localAddress

K. K. Subramaniam
In reply to this post by Edgar J. De Cleene
On Monday 29 October 2007 5:00 pm, Edgar J. De Cleene wrote:
> Seems I need eth0 answer and not lo answer.
>
> Edgar
On Linux, you can get the first global ip address with the command (all in one
line):
ip -o addr show scope global | awk '{print substr($4,1,index($4,"/")-1);
exit}'

Hope this helps .. Subbu

Reply | Threaded
Open this post in threaded view
|

Re: [Q] Linux and localAddress

Hans-Martin Mosner
In reply to this post by Edgar J. De Cleene
Edgar J. De Cleene schrieb:

> Folks:
>
> I playing with Linux and wish know why World reportLocalAddress report
> 127.0.01 and ifconfig on Linux console gives me 192.168.1.4.
>
> The Linux is SimplyMepis 6.5, installing from his repositories ( via console
> synaptic package manager) brings me Squeak 3.8, and I figure out how
> transfer and run the 3.10 needed files
>
> The computer is on small Lan connected to router with Mac and Windows, so I
> could test Squeak 3.10 on the three systems.
>
> Any lead ?
>
>  
Others have already told you different tricks, here's one more:
When you execute
"(Socket newTCP connectToHostNamed: 'squeak.org' port: 80) localAddress"
you get the address of the interface which can be used to connect to
squeak.org.
So if your machine is connected to two local networks 192.168.1.x and
192.168.2.x you get back the address of the interface that is connected
to the internet (via some router/NAT gateway or whatever).
Of course, you should substitute some other address for squeak.org if
your network is not connected to the internet.
And if you're not a messie, you should clean up after yourself by
closing the open socket :-)

Cheers,
Hans-Martin

Reply | Threaded
Open this post in threaded view
|

Re: [Q] Linux and localAddress

Edgar J. De Cleene
In reply to this post by K. K. Subramaniam



El 10/29/07 4:24 PM, "subbukk" <[hidden email]> escribió:

> On Linux, you can get the first global ip address with the command (all in one
> line):
> ip -o addr show scope global | awk '{print substr($4,1,index($4,"/")-1);
> exit}'
>
> Hope this helps .. Subbu

Thanks, I learning a lot of all you.

I need from inside Squeak

I confirm I could send socket data and Nebraska from Linux to Mac but not
inverse.
And can't connect to swiki running on the Linux box with 192.168.1.4:port
but same image and setup works on Mac and Windows XP.
Once the connection is established I could have the ip via the live socket
instance.
| s |
s := Socket new.
s connecTo: "here mac or Windows ip " port: 8000

s inspect.

And here self localAddress gives the intended ip

Seems I don't setup well some in the Linux box.

Edgar



Reply | Threaded
Open this post in threaded view
|

Re: [Q] Linux and localAddress

Edgar J. De Cleene
In reply to this post by Hans-Martin Mosner



El 10/29/07 4:38 PM, "Hans-Martin Mosner" <[hidden email]> escribió:

> When you execute
> "(Socket newTCP connectToHostNamed: 'squeak.org' port: 80) localAddress"
> you get the address of the interface which can be used to connect to
> squeak.org.
> So if your machine is connected to two local networks 192.168.1.x and
> 192.168.2.x you get back the address of the interface that is connected
> to the internet (via some router/NAT gateway or whatever).
> Of course, you should substitute some other address for squeak.org if
> your network is not connected to the internet.
> And if you're not a messie, you should clean up after yourself by
> closing the open socket :-)
>
> Cheers,
> Hans-Martin

Thanks, is just what I discover , but better, as I don't need others
machines on my lan, only trusted web connected machine.

Edgar



Reply | Threaded
Open this post in threaded view
|

Re: [Q] Linux and localAddress

NorbertHartl

On Mon, 2007-10-29 at 17:21 -0300, Edgar J. De Cleene wrote:

>
>
> El 10/29/07 4:38 PM, "Hans-Martin Mosner" <[hidden email]> escribió:
>
> > When you execute
> > "(Socket newTCP connectToHostNamed: 'squeak.org' port: 80) localAddress"
> > you get the address of the interface which can be used to connect to
> > squeak.org.
> > So if your machine is connected to two local networks 192.168.1.x and
> > 192.168.2.x you get back the address of the interface that is connected
> > to the internet (via some router/NAT gateway or whatever).
> > Of course, you should substitute some other address for squeak.org if
> > your network is not connected to the internet.
> > And if you're not a messie, you should clean up after yourself by
> > closing the open socket :-)
> >
> > Cheers,
> > Hans-Martin
>
> Thanks, is just what I discover , but better, as I don't need others
> machines on my lan, only trusted web connected machine.

You don't need a web connected machine. The trick Hans-Martin told you
depends on the choice of the outgoing interface which you can request.
The interface is chosen based on the configuration of your linux box.
If you open a connection to any host your linux box tries to figure out
if it knows anything about the host. If it is an unknown machine it
sends all the requests to this host simply to the default gateway. You
can see this by issuing /sbin/route -n on your linux box. The entry
which has 0.0.0.0 is the one I'm speaking of.
So all you need is to open a connection to this IP (not the 0.0.0.0
the other one :) ) and you can then request the interface address. This
may be a less error prone than chosing an arbitrary internet host. It
assumes that usually there is a connection to any other net (which
involves a gateway).

my 2 zent

Norbert



Reply | Threaded
Open this post in threaded view
|

RE: [Q] Linux and localAddress

Gary Chambers-4
In reply to this post by Edgar J. De Cleene
Wouldn't it be nice to be able to enumerate the actual interfaces though...
and route things to a particular one. We generally have to disable net.eth0
to allow gprs connections... and then manage multiple modems manually.

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]On Behalf Of Edgar
> J. De Cleene
> Sent: 29 October 2007 8:21 PM
> To: The general-purpose Squeak developers list
> Subject: Re: [Q] Linux and localAddress
>
>
>
>
>
> El 10/29/07 4:38 PM, "Hans-Martin Mosner" <[hidden email]> escribió:
>
> > When you execute
> > "(Socket newTCP connectToHostNamed: 'squeak.org' port: 80) localAddress"
> > you get the address of the interface which can be used to connect to
> > squeak.org.
> > So if your machine is connected to two local networks 192.168.1.x and
> > 192.168.2.x you get back the address of the interface that is connected
> > to the internet (via some router/NAT gateway or whatever).
> > Of course, you should substitute some other address for squeak.org if
> > your network is not connected to the internet.
> > And if you're not a messie, you should clean up after yourself by
> > closing the open socket :-)
> >
> > Cheers,
> > Hans-Martin
>
> Thanks, is just what I discover , but better, as I don't need others
> machines on my lan, only trusted web connected machine.
>
> Edgar
>
>
>


Reply | Threaded
Open this post in threaded view
|

RE: [Q] Linux and localAddress

NorbertHartl

On Wed, 2007-10-31 at 22:44 +0000, Gary Chambers wrote:
> Wouldn't it be nice to be able to enumerate the actual interfaces though...
> and route things to a particular one. We generally have to disable net.eth0
> to allow gprs connections... and then manage multiple modems manually.
>
What do you want to do? Switch network connections or use several
network connections simulatenous? To select your gprs link you
could us OSProcess/CommandShell to invoke a command which switches
the default route. You can do this anytime. Using multiple connections
simultaneously is not easy but doable. Have a look at:

http://www.clintoneast.com/articles/multihomed.php

Hope this helps?

Norbert