티스토리 뷰

본 게시물에서는 서브넷 마스크를 나눈 비트에 따른 가용 IP를 확인 하는 Tip 을 알아보고자 한다.

 

아래와 같이 일반적으로 C Class IP 에 대한 Default Subnet Mask는 255.255.255.0 이며, 가용 IP수량은 다음과 같다.

 

주소 Class 

서브넷 마스크 비트 표기 

 서브넷 마스크

 네트워크 접두어

 가용 IP 수량

 C class

11111111 11111111 11111111 0000000

255.255.255.0

/24

256

 

만약 B Class 서브넷을 255.248.0.0 으로 구성한다면 가용 IP는 몇개 일까?

 

한눈에 계산하기가 쉽지 않다. =ㅅ  =a

 

다행히도 Perl 개발자들을 위한 모듈제공 저장소 및 문서화 그룹 CPAN에서는 본인과 같은 수학계산장애(dyscaculia)자들을 위해 다음과 같은 명령어를 개발 / 제공 하였다.

 

짜잔~

 

1. iptab 명령을 통한 서브넷별 가용 IP 수량 확인하기 

 

[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# iptab
+----------------------------------------------+
| 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         |
+----------------------------------------------+
[root@centos7 ~]#
[root@centos7 ~]#

 

 

2. iptab 명령 사용을 위한 RPMforge Repository 설치 및 Package 설치하기

(※ OS Version 별 Package는 다음 URL에서 확인 및 Download -  http://pkgs.repoforge.org/rpmforge-release/ )

 

[root@centos7 ~]#
[root@centos7 ~]# rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
준비 중...                         ################################# [100%]
Updating / installing...
   1:rpmforge-release-0.5.3-1.el7.rf  ################################# [100%]
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.daumkakao.com
 * epel: mirror.premi.st
 * extras: ftp.daumkakao.com
 * rpmforge: ftp.riken.jp
 * updates: ftp.daumkakao.com
repo id                                  repo name                                                       status
base/7/x86_64                            CentOS-7 - Base                                                 9,007
epel/x86_64                              Extra Packages for Enterprise Linux 7 - x86_64                  9,409
extras/7/x86_64                          CentOS-7 - Extras                                                 191
rpmforge                                 RHEL 7 - RPMforge.net - dag                                       245
updates/7/x86_64                         CentOS-7 - Updates                                                552
repolist: 19,404
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# yum provides */iptab
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.daumkakao.com
 * epel: mirror.premi.st
 * extras: ftp.daumkakao.com
 * rpmforge: ftp.riken.jp
 * updates: ftp.daumkakao.com
rpmforge/filelists_db                                                                      |  96 kB  00:00:01    
perl-Net-IP-1.26-4.el7.noarch : Perl module for manipulation of IPv4 and IPv6 addresses
Repo        : epel
Matched from:
Filename    : /usr/bin/iptab


[root@centos7 ~]#
[root@centos7 ~]# yum -y install perl-Net-IP-1.26-4.el7.noarch
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.daumkakao.com
 * epel: mirror.premi.st
 * extras: ftp.daumkakao.com
 * rpmforge: ftp.riken.jp
 * updates: ftp.daumkakao.com
Resolving Dependencies
--> Running transaction check

 

... 중략

 

 

※ 참고 : CPAN Site - http://www.cpan.org/

 

 

 

 

 

 

반응형
반응형
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday