ipaddress

All posts tagged ipaddress

So I never realized this before but certain IP addresses will get truncated in Redhat/CentOS distro’s.  Not sure if others distro’s will share this feature but something to pay attention to.  They say that the netstat output field is limited to 80 chars.   Seems like it would be wiser for them to remove some of the whitespace between the columns than to truncate the IP and I’m sure others have made the mistake as I did by grabbing

Example:

tcp        0     91 ::ffff:10.100.0.100   ::ffff:204.204.204.14:51067 ESTABLISHED

204.204.204.14 really should be 204.204.204.140.  Never noticed this until I was looking at tcpdump.

A better command to run than netstat is ss, that will also display the correct IP.  man ss for more detailed help.

Today, was working on iptables, and accidently mistyped and typed in iptab..well found a pretty nifty tool.  Nothing fancy but should save me from using google to look up CIDR info

+———————————————-+
| addrs   bits   pref   class  mask            |
+———————————————-+
|     1      0    /32          255.255.255.255 |
|     2      1    /31          255.255.255.254 |
|     4      2    /30          255.255.255.252 |
|     8      3    /29          255.255.255.248 |
|    16      4    /28          255.255.255.240 |
|    32      5    /27          255.255.255.224 |
|    64      6    /26          255.255.255.192 |
|   128      7    /25          255.255.255.128 |
|   256      8    /24      1C  255.255.255.0   |
|   512      9    /23      2C  255.255.254.0   |
|    1K     10    /22      4C  255.255.252.0   |
|    2K     11    /21      8C  255.255.248.0   |
|    4K     12    /20     16C  255.255.240.0   |
|    8K     13    /19     32C  255.255.224.0   |
|   16K     14    /18     64C  255.255.192.0   |
|   32K     15    /17    128C  255.255.128.0   |
|   64K     16    /16      1B  255.255.0.0     |
|  128K     17    /15      2B  255.254.0.0     |
|  256K     18    /14      4B  255.252.0.0     |
|  512K     19    /13      8B  255.248.0.0     |
|    1M     20    /12     16B  255.240.0.0     |
|    2M     21    /11     32B  255.224.0.0     |
|    4M     22    /10     64B  255.192.0.0     |
|    8M     23     /9    128B  255.128.0.0     |
|   16M     24     /8      1A  255.0.0.0       |
|   32M     25     /7      2A  254.0.0.0       |
|   64M     26     /6      4A  252.0.0.0       |
|  128M     27     /5      8A  248.0.0.0       |
|  256M     28     /4     16A  240.0.0.0       |
|  512M     29     /3     32A  224.0.0.0       |
| 1024M     30     /2     64A  192.0.0.0       |
| 2048M     31     /1    128A  128.0.0.0       |
| 4096M     32     /0    256A  0.0.0.0         |
+———————————————-+