[Gambas-user] Obtain my IP with Gambas

Ron_1st ronstk at ...239...
Wed Sep 9 20:27:39 CEST 2009


On Wednesday 09 September 2009, Benoît Minisini wrote:
> IP address are attached to network interfaces, and I'm not sure that a network 
> interface could not have several IP, and different types of IPs.
> 

Yes it can be done. More IP at one interface.
I have a remote sites IP addres as second IP on my card.
This way I can develop local a page with embeded IP's in code and
test on my ownbox before upload to the real site.
Very handy to test flash objects that are only allowed to get data
from fixed IP.

In ifconfig:
eth0      Link encap:Ethernet  HWaddr 00:e0:18:f8:37:7e
          inet addr:192.168.1.33  Bcast:192.168.1.255  Mask:255.255.255.0
...
eth0:0    Link encap:Ethernet  HWaddr 00:e0:18:f8:37:7e
          inet addr:10.0.0.128  Bcast:10.0.0.255  Mask:255.255.255.0
...
eth0:1    Link encap:Ethernet  HWaddr 00:e0:18:f8:37:7e
          inet addr:212.16.xxx.xxx  Bcast:212.16.xxx.255  Mask:255.255.255.0
...

This an be done by:
  ifconfig eth0:0 xx.xx.xx.xx netmask yy.yy.yy.yy up

where eth0 is your primary interface and eth0:0 is a virtual one


> Instead of adding thousands lines of code to the interpreter, I think the 
> better is parsing the output of the ifconfig command.
>
> -- 
>Benoît Minisini

ps
Also on windows :)
http://www.metacafe.com/watch/331275/multiple_ip_address_on_same_network_card_windows/
http://www.pc1news.com/how-to-bind-multiple-ip-address-to-a-single-network-card-796.html

Best regards,

Ron_1st

-- 




More information about the User mailing list