ip is the new networking program starting from Debian Stretch replacing the old ifconfig and iptables. It is relatively new but it is worth learning since it is quite robust and rich in features too.
To get the menu or help, simply just call the program:
$ ipUsage: ip [ OPTIONS ] OBJECT { COMMAND | help } ip [ -force ] -batch filenamewhere OBJECT := { link | address | addrlabel | route | rule | neigh | ntable | tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm | netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila } OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] | -h[uman-readable] | -iec | -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } | -4 | -6 | -I | -D | -B | -0 | -l[oops] { maximum-addr-flush-attempts } | -br[ief] | -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] | -rc[vbuf] [size] | -n[etns] name | -a[ll] | -c[olor]}It is quite easy to read:
-V for version).Since ifconfig was replaced, you can use ip to list all address. To do that, simply use:
$ ip address...You will get all the necessary network data from interface to specifically connected IP address.
To get IP Address ranges from an network interface, you simply use the following command:
$ ip -o addr show <interface> | awk '{print $4}'Example, for eth0 network interface, it is:
$ ip -o addr show eth0 | awk '{print $4}'192.168.155.1/24XXXX::XXXX:XXXX:XXXX:XXXX/64The first one would be IPv4 format while the second one would be IPv6 format.
To get your public address, simply use curl or wget against ifconfig.me:
$ curl ifconfig.me<IP ADDRESS>If you have only wget, then:
$ wget -qO- ifconfig.me<IP ADDRESS>That's all about ip program.