5
4
What command can I use to get IPv6 address of an interface in a script?
Update: Output of sed from one of answers.
$ ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 fe80::224:d7ff:fed0:4f5c/64 scope link
valid_lft forever preferred_lft forever
The other:
$ ip addr show dev eth0 | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d'
$ ip addr show dev eth0
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether f0:de:f1:7b:e9:6c brd ff:ff:ff:ff:ff:ff
Which IPv6 addresses? Your interfaces' IPv6 addresses? – m0skit0 – 2012-02-14T13:27:07.680
Yes, edited, thx. – Ondra Žižka – 2012-02-21T04:33:03.697