[Linux] récupération adresse IP Privée ou publique

Victor Stinner victor.stinner-linux@::1
Mar 24 Avr 14:27:48 CEST 2007


On Tuesday 24 April 2007 00:12:06 bernard.schoenacker@::1 wrote:
> bonjour,
>
> je recherche à récupérer une adresse IP Privée ou publique

La tienne ? Utilise :

$ ip -oneline addr list
1: lo: <LOOPBACK,UP,10000> mtu 16436 qdisc noqueue \    link/loopback 
00:00:00:00:00:00 brd 00:00:00:00:00:00
1: lo    inet 127.0.0.1/8 scope host lo
1: lo    inet6 ::1/128 scope host \       valid_lft forever preferred_lft 
forever
2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000\    
link/ether 00:15:c5:aa:35:38 brd ff:ff:ff:ff:ff:ff
2: eth0    inet 192.168.33.172/25 brd 192.168.33.255 scope global eth0
2: eth0    inet6 fe80::215:c5ff:feaa:3538/64 scope link \       valid_lft 
forever preferred_lft forever
4: tap0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 500\    
link/ether 62:0b:31:20:6d:aa brd ff:ff:ff:ff:ff:ff
4: tap0    inet 10.0.2.2/8 brd 10.255.255.255 scope global tap0
4: tap0    inet 10.0.2.3/8 brd 10.255.255.255 scope global secondary tap0:0
4: tap0    inet6 fe80::600b:31ff:fe20:6daa/64 scope link \       valid_lft 
forever preferred_lft forever

Victor
-- 
Victor Stinner
http://hachoir.org/


Plus d'informations sur la liste de diffusion linux