Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Ricavare l'indirizzo di rete di una interfaccia
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano
View previous topic :: View next topic  
Author Message
armaoin
Tux's lil' helper
Tux's lil' helper


Joined: 02 Apr 2006
Posts: 110

PostPosted: Sat Jul 30, 2011 6:51 pm    Post subject: Ricavare l'indirizzo di rete di una interfaccia Reply with quote

Ho cercato senza successo un file che contenesse l'indirizzo della mia scheda wiereless (wlan0) in /sys (ma ho trovato solo il MAC); in pratica vorrei poter ricavare l'indirizzo di quest'ultima senza ricorrere a ifconfig ma non so come fare. Suggerimenti?
Back to top
View user's profile Send private message
k01
Arch/Herd Tester
Arch/Herd Tester


Joined: 13 Feb 2008
Posts: 617
Location: Milano

PostPosted: Sun Jul 31, 2011 10:34 am    Post subject: Reply with quote

qual'è il problema nell'utilizzare

Code:
/sbin/ifconfig wlan0 | grep 'inet ' | cut -d : -f2 | cut -d ' ' -f1


??
Back to top
View user's profile Send private message
cloc3
Advocate
Advocate


Joined: 13 Jan 2004
Posts: 4788
Location: http://www.gentoo-users.org/user/cloc3/

PostPosted: Sun Jul 31, 2011 10:57 am    Post subject: Re: Ricavare l'indirizzo di rete di una interfaccia Reply with quote

armaoin wrote:
senza ricorrere a ifconfig

cerca in /proc/net/dev

edit :
ops. uno strace -f -eaccess ifconfig $iface mi ha mostrato che l'indirizzo ip viene letto da /proc/dev/if_inet6.
_________________
vu vu vu
gentù
mi piaci tu


Last edited by cloc3 on Sun Jul 31, 2011 12:33 pm; edited 1 time in total
Back to top
View user's profile Send private message
k01
Arch/Herd Tester
Arch/Herd Tester


Joined: 13 Feb 2008
Posts: 617
Location: Milano

PostPosted: Sun Jul 31, 2011 11:12 am    Post subject: Reply with quote

si, l'ho letto, ma sono comunque curioso di sapere il perché non può/vuole utilizzarlo, semplice curiosità...
Back to top
View user's profile Send private message
armaoin
Tux's lil' helper
Tux's lil' helper


Joined: 02 Apr 2006
Posts: 110

PostPosted: Sun Jul 31, 2011 2:45 pm    Post subject: Reply with quote

Il motivo per non utilizzare ifconfig è semplice: bisogna essere root e a me serviva uno script per che non avesse i privilegi di root.
Trattandosi di una scheda wifi avevo risolto con:
Code:

 wpa_cli status| grep ip_address | cut -d = -f2


P.S.
Ops ho detto la cazzata mi sa. Ho appena visto che ifconfig lo posso usare anche da utente normale (mi basta dare il percorso completo) .. in realtà ero convinto che con un utente normale non potessi proprio eseguirlo.


Last edited by armaoin on Sun Jul 31, 2011 3:04 pm; edited 2 times in total
Back to top
View user's profile Send private message
Ic3M4n
Advocate
Advocate


Joined: 02 Nov 2004
Posts: 3489
Location: Bergamo.

PostPosted: Sun Jul 31, 2011 2:51 pm    Post subject: Reply with quote

per usare ifconfig non serve essere root, se vuoi solo sapere qual è l'indirizzo di rete e non hai modificato i permessi della directory /sbin

basta scrivere /sbin/ifconfig al posto di ifconfig nel terminale...
Back to top
View user's profile Send private message
armaoin
Tux's lil' helper
Tux's lil' helper


Joined: 02 Apr 2006
Posts: 110

PostPosted: Sun Jul 31, 2011 2:54 pm    Post subject: Reply with quote

Si si me ne sono accorto solo ora. Ero veramente convinto che bisognasse essere root per usarlo invece mi bastava dare /sbin/ifconfig.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum