Get the IPv6 address of a website very easily with this simple one-liner.
jason@. PWD: ~. -bash. 3.2.57. 29 $> host ipv6.google.com | awk 'FNR==2 {print $5}' 2404:6800:4006:811::200e |
This works just fine to get the required information.
I am not sure why the address has a double :: near the end. But this is how the address is laid out. But this means you can shorten the loopback address to ::1 and it will still work just fine. As shown below, this is how the loopback address is formatted in IPv6.
jason@. PWD: ~. -bash. 3.2.57. 31 $> ifconfig lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 nd6 options=201<PERFORMNUD,DAD> gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 stf0: flags=0<> mtu 1280 XHC20: flags=0<> mtu 0 en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 ether e0:ac:cb:9c:18:a2 inet6 fe80::1cef:7ac:d620:9ba5%en0 prefixlen 64 secured scopeid 0x5 inet6 2001:8004:1420:2e61:1432:2cda:1822:59d1 prefixlen 64 autoconf secured inet6 2001:8004:1420:2e61:c058:1564:8654:6bc prefixlen 64 autoconf temporary inet 192.168.219.173 netmask 0xffffff00 broadcast 192.168.219.255 nd6 options=201<PERFORMNUD,DAD> media: autoselect status: active |
Another way to get the IPv6 address from a web host.
jason@. PWD: ~. -bash. 3.2.57. 36 $> dig ipv6.google.com | awk '/SERVER/ {print $3}' 2001:8004:1420:2e61::1d#53(2001:8004:1420:2e61::1d) |
Yet another example.
jason@. PWD: ~. -bash. 3.2.57. 92 $> dig ipv6.google.com | awk -F'SERVER:' 'FNR==15 { print $2}' 2001:8004:1420:2e61::1d#53(2001:8004:1420:2e61::1d) |
This one-liner will print your Internet-facing IP address easily with one simple command.
jason@. PWD: ~. -bash. 3.2.57. 129 $> curl -s ipinfo.io &> /dev/stdout | awk -F'[",]' 'FNR==2 { print $4}' 1.129.104.105 |
Another way to print this information.
Wed Mar 30 UNIX deusexmachina.local@jason:ttys000>$ curl -s https://api.my-ip.io/ip.txt ; echo 2001:8004:1420:c40:c8cd:d559:a304:3b51 |
This prints your IPv6 IP address in plain text to the terminal.
This should be very useful to someone out there.
How to list interfaces with Nmap. This is a very useful tip.
https://securitronlinux.com/debian-testing/how-to-list-interfaces-with-nmap-this-is-a-very-useful-tip/.
Print only the IPv6 IP addresses on your machine with Nmap.
deusexmachina:~ jason$ nmap --iflist | awk '/ethernet up/ || /\/64/ {print $1}' 2001:8004:1420:2e61::/64 fe80:1::/64 fe80:5::/64 fe80:7::/64 fe80:a::/64 |
A very simple way to list all network devices. If only you could list the model number of the network interface as well, this would be great. But as it stands, this is indispensable.
A great tool to add to your arsenal for searching your network for computers.
Wed Mar 30 UNIX deusexmachina.local@jason:ttys000>$ nmap 192.168.219.0/24 | awk '/scan report /{print $5}' 192.168.219.63 192.168.219.173 |
The above command will search an IP range on a LAN and then return all IP addresses it finds. That is a very good Nmap trick.
Hello
“I am not sure why the address has a double :: near the end.”
A joke?
Is a notation
You know a IPv6 address is 16 bytes long. Or 128 bits.
With 2404:6800:4006:811::200e is equivalent to 2404:6800:4006:0811::200e (0 before 811)
In hexadecimal notation are 10 Bytes.
:: means that it can be padded with zeros up to 16 bytes at the exact position where :: is.
2404:6800:4006:811::200e is equivalent to 2404:6800:4006:0811:0000:0000:0000:200e
Short explication
https://www.ibm.com/docs/en/i/7.4?topic=concepts-ipv6-address-formats
Thanks