Experts,
Please help me to write a script to find the network interface name from the given IPv6 address.
For example:
if "ifconfig" gives the output like:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:90440 errors:0 dropped:0 overruns:0 frame:0
TX packets:90440 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:10181289 (10.1 MB) TX bytes:10181289 (10.1 MB)
eth0 Link encap:Ethernet HWaddr 00:50:56:bb:9f:9d
inet6 addr: fe80::250:56ff:febb:9f9d/64 Scope:Link
inet6 addr: 2001:111:1111:1111:1000::41/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:138859 errors:0 dropped:10 overruns:0 frame:0
TX packets:69332 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:46310896 (46.3 MB) TX bytes:18119186 (18.1 MB)
eth1 Link encap:Ethernet HWaddr 00:50:56:bb:9f:9d
inet6 addr: fe80::250:56ff:febb:9f9d/64 Scope:Link
inet6 addr: 2001:222:2222:2222:1000::41/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:138859 errors:0 dropped:10 overruns:0 frame:0
TX packets:69332 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:46310896 (46.3 MB) TX bytes:18119186 (18.1 MB)
and the given IPv6 address is: 2001:111:1111:1111:1000::41 then the output should be "eth0"
Appreciate your help in advance.
Thanks.