> In Linux, you can only have one IPv4 address per interface (and you
> have to use alias interfaces, such as eth0:0, to assign multiple
> addresses to a physical link).
that's actually not correct, use the "ip" tool (iproute2 package) to see
how easily you can have several addresses to a single
> which works great. But i am not enough into python to port that to
> ipv6. It has to work under linux only. Any help is appreciated.
Not sure how universal this is, but I would read /proc/net/if_inet6.
At least, that's what ifconfig does, and it seems to work fine.
mar...@mira:~$ cat /proc/net/
> I'm not 100% sure what you're trying to do, but the above is horribly
> non-portable. You probably want to be looking at socket.getpeername() and
> socket.getsockname().
This only works if you are actually connected. I think he wants to find
out the local address without actually connecting.
In article
<86176ef7-c2e0-4c5d-b883-d91672e3e...@w40g2000yqd.googlegroups.com>,
Kai Timmer wrote:
> Hello,
> i need a function that returns the ipv6 address from a given interface
> name. For ipv4 i use this one:
> def get_ip_address(ifname):
> s = socket.socket(socket.AF_INET, socket.SOCK_DG