[펌] Spring 3.0 강좌

ITWeb/개발일반 2010. 10. 22. 10:14
동영상 강좌 링크 : https://www.ibm.com/developerworks/mydeveloperworks/blogs/9e635b49-09e9-4c23-8999-a4d461aeace2/entry/264?lang=ko)

스프링3.0 강좌입니다.
내용은 아주 기초적인 내용이며 쉽게 설명이 되어 있내요.

Dependency Injection : 객체간 의존성을 제거하기 위해 사용
@IoC : singletone pattern 지원

늘 느끼는 거지만.. 용어와 정의에 대해서 잘 모르면 아는것도 모르게 되는 것 같내요..
참.. 배움이라는건.. 언제나 그렇듯이.. 즐거워요 ㅋㅋ
:

iBatis - Binary Conditional Elements

ITWeb/개발일반 2010. 10. 20. 13:48
원본링크 : http://ibatis.apache.org/docs/dotnet/datamapper/ch03s09.html

3.9.1. Binary Conditional Elements

Binary conditional elements compare a property value to a static value or another property value. If the result is true, the body content is included in the SQL query.

3.9.1.1. Binary Conditional Attributes:

prepend – the overridable SQL part that will be prepended to the statement (optional)
property – the property to be compared (required)
compareProperty – the other property to be compared (required or compareValue)
compareValue – the value to be compared (required or compareProperty)

Table 3.7. Binary conditional attributes

Element Description
<isEqual> Checks the equality of a property and a value, or another property. Example Usage:
<isEqual prepend="AND" 
             property="status" 
             compareValue="Y">
MARRIED = ‘TRUE'
</isEqual>               
<isNotEqual> Checks the inequality of a property and a value, or another property. Example Usage:
<isNotEqual prepend="AND" 
             property="status" 
             compareValue="N">
MARRIED = ‘FALSE'
</isNotEqual>   
<isGreaterThan> Checks if a property is greater than a value or another property. Example Usage:
<isGreaterThan prepend="AND" 
             property="age" 
             compareValue="18">
ADOLESCENT = ‘FALSE'
</isGreaterThan>   
<isGreaterEqual> Checks if a property is greater than or equal to a value or another property. Example Usage:
<isGreaterEqual prepend="AND" 
             property="shoeSize" 
             compareValue="12">
BIGFOOT = ‘TRUE'
</isGreaterEqual>
<isLessEqual> Checks if a property is less than or equal to a value or another property. Example Usage:
<isLessEqual prepend="AND" 
             property="age" 
             compareValue="18">
ADOLESCENT = ‘TRUE'
</isLessEqual>

3.9.2. Unary Conditional Elements

Unary conditional elements check the state of a property for a specific condition.

3.9.2.1. Unary Conditional Attributes:

prepend – the overridable SQL part that will be prepended to the statement (optional)
property – the property to be checked (required)

Table 3.8. Unary conditional attributes

Element Description
<isPropertyAvailable> Checks if a property is available (i.e is a property of the parameter object). Example Usage:
<isPropertyAvailable property="id" >
  ACCOUNT_ID=#id# 
</isPropertyAvailable>
<isNotPropertyAvailable> Checks if a property is unavailable (i.e not a property of the parameter object). Example Usage:
<isNotPropertyAvailable property="age" >
  STATUS='New' 
</isNotEmpty>
<isNull> Checks if a property is null. Example Usage:
<isNull prepend="AND" property="order.id" >
  ACCOUNT.ACCOUNT_ID = ORDER.ACCOUNT_ID(+) 
</isNotEmpty>
<isNotNull> Checks if a property is not null. Example Usage:
<isNotNull prepend="AND" property="order.id" >
  ORDER.ORDER_ID = #order.id#
</isNotEmpty>
<isEmpty> Checks to see if the value of a Collection, String property is null or empty ("" or size() < 1). Example Usage:
<isEmpty property="firstName" >
  LIMIT 0, 20
</isNotEmpty>
<isNotEmpty> Checks to see if the value of a Collection, String property is not null and not empty ("" or size() < 1). Example Usage:
<isNotEmpty prepend="AND" property="firstName" >
  FIRST_NAME LIKE '%$FirstName$%'
</isNotEmpty>

3.9.3. Parameter Present Elements

These elements check for parameter object existence.

3.9.3.1. Parameter Present Attributes:

prepend – the overridable SQL part that will be prepended to the statement (optional)

Table 3.9. Testing to see if a parameter is present

Element Description
<isParameterPresent> Checks to see if the parameter object is present (not null).
<isParameterPresent prepend="AND">
  EMPLOYEE_TYPE = #empType#
</isParameterPresent>
<isNotParameterPresent> Checks to see if the parameter object is not present (null). Example Usage:
<isNotParameterPresent prepend="AND">
  EMPLOYEE_TYPE = ‘DEFAULT'
</isNotParameterPresent>


3.9.4. Iterate Element

This tag will iterate over a collection and repeat the body content for each item in a List

3.9.4.1. Iterate Attributes:

prepend – the overridable SQL part that will be prepended to the statement (optional)
property – a property of type IList that is to be iterated over (required)
open – the string with which to open the entire block of iterations, useful for brackets (optional)
close – the string with which to close the entire block of iterations, useful for brackets (optional)
conjunction – the string to be applied in between each iteration, useful for AND and OR (optional)

Table 3.10. Creating a list of conditional clauses

Element Description
<iterate> Iterates over a property that is of type IList Example Usage:
<iterate prepend="AND" property="UserNameList"
  open="(" close=")" conjunction="OR">
  username=#UserNameList[]#
</iterate>
Note: It is very important to include the square brackets[] at the end of the List property name when using the Iterate element. These brackets distinguish this object as an List to keep the parser from simply outputting the List as a string.


:

Shell 에서 CURL 을 이용해 호출하기

ITWeb/개발일반 2010. 10. 8. 18:36

요기 들어 가면.. get, post 방식으로 호출 하는 내용이 자세히 나와 있습니다.
http://curl.haxx.se/docs/httpscripting.html


[Scrap]
Online:  http://curl.haxx.se/docs/httpscripting.html
Date:    May 28, 2008
 
                The Art Of Scripting HTTP Requests Using Curl
                =============================================
 
This document will assume that you're familiar with HTML and general
networking.
 
The possibility to write scripts is essential to make a good computer
system. Unix' capability to be extended by shell scripts and various tools to
run various automated commands and scripts is one reason why it has succeeded
so well.
 
The increasing amount of applications moving to the web has made "HTTP
Scripting" more frequently requested and wanted. To be able to automatically
extract information from the web, to fake users, to post or upload data to
web servers are all important tasks today.
 
Curl is a command line tool for doing all sorts of URL manipulations and
transfers, but this particular document will focus on how to use it when
doing HTTP requests for fun and profit. I'll assume that you know how to
invoke 'curl --help' or 'curl --manual' to get basic information about it.
 
Curl is not written to do everything for you. It makes the requests, it gets
the data, it sends data and it retrieves the information. You probably need
to glue everything together using some kind of script language or repeated
manual invokes.
 
1. The HTTP Protocol
 
HTTP is the protocol used to fetch data from web servers. It is a very simple
protocol that is built upon TCP/IP. The protocol also allows information to
get sent to the server from the client using a few different methods, as will
be shown here.
 
HTTP is plain ASCII text lines being sent by the client to a server to
request a particular action, and then the server replies a few text lines
before the actual requested content is sent to the client.
 
Using curl's option --verbose (-v as a short option) will display what kind of
commands curl sends to the server, as well as a few other informational texts.
--verbose is the single most useful option when it comes to debug or even
understand the curl<->server interaction.
 
2. URL
 
The Uniform Resource Locator format is how you specify the address of a
particular resource on the Internet. You know these, you've seen URLs like
http://curl.haxx.se or https://yourbank.com a million times.
 
3. GET a page
 
The simplest and most common request/operation made using HTTP is to get a
URL. The URL could itself refer to a web page, an image or a file. The client
issues a GET request to the server and receives the document it asked for.
If you issue the command line
 
        curl http://curl.haxx.se
 
you get a web page returned in your terminal window. The entire HTML document
that that URL holds.
 
All HTTP replies contain a set of headers that are normally hidden, use
curl's --include (-i) option to display them as well as the rest of the
document. You can also ask the remote server for ONLY the headers by using the
--head (-I) option (which will make curl issue a HEAD request).
 
4. Forms
 
Forms are the general way a web site can present a HTML page with fields for
the user to enter data in, and then press some kind of 'OK' or 'submit'
button to get that data sent to the server. The server then typically uses
the posted data to decide how to act. Like using the entered words to search
in a database, or to add the info in a bug track system, display the entered
address on a map or using the info as a login-prompt verifying that the user
is allowed to see what it is about to see.
 
Of course there has to be some kind of program in the server end to receive
the data you send. You cannot just invent something out of the air.
 
4.1 GET
 
  A GET-form uses the method GET, as specified in HTML like:
 
        <form method="GET" action="junk.cgi">
          <input type=text name="birthyear">
          <input type=submit name=press value="OK">
        </form>
 
  In your favorite browser, this form will appear with a text box to fill in
  and a press-button labeled "OK". If you fill in '1905' and press the OK
  button, your browser will then create a new URL to get for you. The URL will
  get "junk.cgi?birthyear=1905&press=OK" appended to the path part of the
  previous URL.
 
  If the original form was seen on the page "www.hotmail.com/when/birth.html",
  the second page you'll get will become
  "www.hotmail.com/when/junk.cgi?birthyear=1905&press=OK".
 
  Most search engines work this way.
 
  To make curl do the GET form post for you, just enter the expected created
  URL:
 
        curl "http://www.hotmail.com/when/junk.cgi?birthyear=1905&press=OK"
 
4.2 POST
 
  The GET method makes all input field names get displayed in the URL field of
  your browser. That's generally a good thing when you want to be able to
  bookmark that page with your given data, but it is an obvious disadvantage
  if you entered secret information in one of the fields or if there are a
  large amount of fields creating a very long and unreadable URL.
 
  The HTTP protocol then offers the POST method. This way the client sends the
  data separated from the URL and thus you won't see any of it in the URL
  address field.
 
  The form would look very similar to the previous one:
 
        <form method="POST" action="junk.cgi">
          <input type=text name="birthyear">
          <input type=submit name=press value=" OK ">
        </form>
 
  And to use curl to post this form with the same data filled in as before, we
  could do it like:
 
        curl --data "birthyear=1905&press=%20OK%20" http://www.hotmail.com/when/junk.cgi
 
  This kind of POST will use the Content-Type
  application/x-www-form-urlencoded and is the most widely used POST kind.
 
  The data you send to the server MUST already be properly encoded, curl will
  not do that for you. For example, if you want the data to contain a space,
  you need to replace that space with %20 etc. Failing to comply with this
  will most likely cause your data to be received wrongly and messed up.
 
  Recent curl versions can in fact url-encode POST data for you, like this:
 
        curl --data-urlencode "name=I am Daniel" http://www.example.com
 
4.3 File Upload POST
 
  Back in late 1995 they defined an additional way to post data over HTTP. It
  is documented in the RFC 1867, why this method sometimes is referred to as
  RFC1867-posting.
 
  This method is mainly designed to better support file uploads. A form that
  allows a user to upload a file could be written like this in HTML:
 
    <form method="POST" enctype='multipart/form-data' action="upload.cgi">
      <input type=file name=upload>
      <input type=submit name=press value="OK">
    </form>
 
  This clearly shows that the Content-Type about to be sent is
  multipart/form-data.
 
  To post to a form like this with curl, you enter a command line like:
 
        curl --form upload=@localfilename --form press=OK [URL]
 
4.4 Hidden Fields
 
  A very common way for HTML based application to pass state information
  between pages is to add hidden fields to the forms. Hidden fields are
  already filled in, they aren't displayed to the user and they get passed
  along just as all the other fields.
 
  A similar example form with one visible field, one hidden field and one
  submit button could look like:
 
    <form method="POST" action="foobar.cgi">
      <input type=text name="birthyear">
      <input type=hidden name="person" value="daniel">
      <input type=submit name="press" value="OK">
    </form>
 
  To post this with curl, you won't have to think about if the fields are
  hidden or not. To curl they're all the same:
 
        curl --data "birthyear=1905&press=OK&person=daniel" [URL]
 
4.5 Figure Out What A POST Looks Like
 
  When you're about fill in a form and send to a server by using curl instead
  of a browser, you're of course very interested in sending a POST exactly the
  way your browser does.
 
  An easy way to get to see this, is to save the HTML page with the form on
  your local disk, modify the 'method' to a GET, and press the submit button
  (you could also change the action URL if you want to).
 
  You will then clearly see the data get appended to the URL, separated with a
  '?'-letter as GET forms are supposed to.
 
5. PUT
 
The perhaps best way to upload data to a HTTP server is to use PUT. Then
again, this of course requires that someone put a program or script on the
server end that knows how to receive a HTTP PUT stream.
 
Put a file to a HTTP server with curl:
 
        curl --upload-file uploadfile http://www.uploadhttp.com/receive.cgi
 
6. HTTP Authentication
 
HTTP Authentication is the ability to tell the server your username and
password so that it can verify that you're allowed to do the request you're
doing. The Basic authentication used in HTTP (which is the type curl uses by
default) is *plain* *text* based, which means it sends username and password
only slightly obfuscated, but still fully readable by anyone that sniffs on
the network between you and the remote server.
 
To tell curl to use a user and password for authentication:
 
        curl --user name:password http://www.secrets.com
 
The site might require a different authentication method (check the headers
returned by the server), and then --ntlm, --digest, --negotiate or even
--anyauth might be options that suit you.
 
Sometimes your HTTP access is only available through the use of a HTTP
proxy. This seems to be especially common at various companies. A HTTP proxy
may require its own user and password to allow the client to get through to
the Internet. To specify those with curl, run something like:
 
        curl --proxy-user proxyuser:proxypassword curl.haxx.se
 
If your proxy requires the authentication to be done using the NTLM method,
use --proxy-ntlm, if it requires Digest use --proxy-digest.
 
If you use any one these user+password options but leave out the password
part, curl will prompt for the password interactively.
 
Do note that when a program is run, its parameters might be possible to see
when listing the running processes of the system. Thus, other users may be
able to watch your passwords if you pass them as plain command line
options. There are ways to circumvent this.
 
It is worth noting that while this is how HTTP Authentication works, very
many web sites will not use this concept when they provide logins etc. See
the Web Login chapter further below for more details on that.
 
7. Referer
 
A HTTP request may include a 'referer' field (yes it is misspelled), which
can be used to tell from which URL the client got to this particular
resource. Some programs/scripts check the referer field of requests to verify
that this wasn't arriving from an external site or an unknown page. While
this is a stupid way to check something so easily forged, many scripts still
do it. Using curl, you can put anything you want in the referer-field and
thus more easily be able to fool the server into serving your request.
 
Use curl to set the referer field with:
 
        curl --referer http://curl.haxx.se http://daniel.haxx.se
 
8. User Agent
 
Very similar to the referer field, all HTTP requests may set the User-Agent
field. It names what user agent (client) that is being used. Many
applications use this information to decide how to display pages. Silly web
programmers try to make different pages for users of different browsers to
make them look the best possible for their particular browsers. They usually
also do different kinds of javascript, vbscript etc.
 
At times, you will see that getting a page with curl will not return the same
page that you see when getting the page with your browser. Then you know it
is time to set the User Agent field to fool the server into thinking you're
one of those browsers.
 
To make curl look like Internet Explorer on a Windows 2000 box:
 
        curl --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" [URL]
 
Or why not look like you're using Netscape 4.73 on a Linux (PIII) box:
 
        curl --user-agent "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" [URL]
 
9. Redirects
 
When a resource is requested from a server, the reply from the server may
include a hint about where the browser should go next to find this page, or a
new page keeping newly generated output. The header that tells the browser
to redirect is Location:.
 
Curl does not follow Location: headers by default, but will simply display
such pages in the same manner it display all HTTP replies. It does however
feature an option that will make it attempt to follow the Location: pointers.
 
To tell curl to follow a Location:
 
        curl --location http://www.sitethatredirects.com
 
If you use curl to POST to a site that immediately redirects you to another
page, you can safely use --location (-L) and --data/--form together. Curl will
only use POST in the first request, and then revert to GET in the following
operations.
 
10. Cookies
 
The way the web browsers do "client side state control" is by using
cookies. Cookies are just names with associated contents. The cookies are
sent to the client by the server. The server tells the client for what path
and host name it wants the cookie sent back, and it also sends an expiration
date and a few more properties.
 
When a client communicates with a server with a name and path as previously
specified in a received cookie, the client sends back the cookies and their
contents to the server, unless of course they are expired.
 
Many applications and servers use this method to connect a series of requests
into a single logical session. To be able to use curl in such occasions, we
must be able to record and send back cookies the way the web application
expects them. The same way browsers deal with them.
 
The simplest way to send a few cookies to the server when getting a page with
curl is to add them on the command line like:
 
        curl --cookie "name=Daniel" http://www.cookiesite.com
 
Cookies are sent as common HTTP headers. This is practical as it allows curl
to record cookies simply by recording headers. Record cookies with curl by
using the --dump-header (-D) option like:
 
        curl --dump-header headers_and_cookies http://www.cookiesite.com
 
(Take note that the --cookie-jar option described below is a better way to
store cookies.)
 
Curl has a full blown cookie parsing engine built-in that comes to use if you
want to reconnect to a server and use cookies that were stored from a
previous connection (or handicrafted manually to fool the server into
believing you had a previous connection). To use previously stored cookies,
you run curl like:
 
        curl --cookie stored_cookies_in_file http://www.cookiesite.com
 
Curl's "cookie engine" gets enabled when you use the --cookie option. If you
only want curl to understand received cookies, use --cookie with a file that
doesn't exist. Example, if you want to let curl understand cookies from a page
and follow a location (and thus possibly send back cookies it received), you
can invoke it like:
 
        curl --cookie nada --location http://www.cookiesite.com
 
Curl has the ability to read and write cookie files that use the same file
format that Netscape and Mozilla do. It is a convenient way to share cookies
between browsers and automatic scripts. The --cookie (-b) switch automatically
detects if a given file is such a cookie file and parses it, and by using the
--cookie-jar (-c) option you'll make curl write a new cookie file at the end of
an operation:
 
        curl --cookie cookies.txt --cookie-jar newcookies.txt http://www.cookiesite.com
 
11. HTTPS
 
There are a few ways to do secure HTTP transfers. The by far most common
protocol for doing this is what is generally known as HTTPS, HTTP over
SSL. SSL encrypts all the data that is sent and received over the network and
thus makes it harder for attackers to spy on sensitive information.
 
SSL (or TLS as the latest version of the standard is called) offers a
truckload of advanced features to allow all those encryptions and key
infrastructure mechanisms encrypted HTTP requires.
 
Curl supports encrypted fetches thanks to the freely available OpenSSL
libraries. To get a page from a HTTPS server, simply run curl like:
 
        curl https://that.secure.server.com
 
11.1 Certificates
 
  In the HTTPS world, you use certificates to validate that you are the one
  you claim to be, as an addition to normal passwords. Curl supports client-
  side certificates. All certificates are locked with a pass phrase, which you
  need to enter before the certificate can be used by curl. The pass phrase
  can be specified on the command line or if not, entered interactively when
  curl queries for it. Use a certificate with curl on a HTTPS server like:
 
        curl --cert mycert.pem https://that.secure.server.com
 
  curl also tries to verify that the server is who it claims to be, by
  verifying the server's certificate against a locally stored CA cert
  bundle. Failing the verification will cause curl to deny the connection. You
  must then use --insecure (-k) in case you want to tell curl to ignore that
  the server can't be verified.
 
  More about server certificate verification and ca cert bundles can be read
  in the SSLCERTS document, available online here:
 
        http://curl.haxx.se/docs/sslcerts.html
 
12. Custom Request Elements
 
Doing fancy stuff, you may need to add or change elements of a single curl
request.
 
For example, you can change the POST request to a PROPFIND and send the data
as "Content-Type: text/xml" (instead of the default Content-Type) like this:
 
        curl --data "<xml>" --header "Content-Type: text/xml" --request PROPFIND url.com
 
You can delete a default header by providing one without content. Like you
can ruin the request by chopping off the Host: header:
 
        curl --header "Host:" http://mysite.com
 
You can add headers the same way. Your server may want a "Destination:"
header, and you can add it:
 
        curl --header "Destination: http://moo.com/nowhere" http://url.com
 
13. Web Login
 
While not strictly just HTTP related, it still cause a lot of people problems
so here's the executive run-down of how the vast majority of all login forms
work and how to login to them using curl.
 
It can also be noted that to do this properly in an automated fashion, you
will most certainly need to script things and do multiple curl invokes etc.
 
First, servers mostly use cookies to track the logged-in status of the
client, so you will need to capture the cookies you receive in the
responses. Then, many sites also set a special cookie on the login page (to
make sure you got there through their login page) so you should make a habit
of first getting the login-form page to capture the cookies set there.
 
Some web-based login systems features various amounts of javascript, and
sometimes they use such code to set or modify cookie contents. Possibly they
do that to prevent programmed logins, like this manual describes how to...
Anyway, if reading the code isn't enough to let you repeat the behavior
manually, capturing the HTTP requests done by your browers and analyzing the
sent cookies is usually a working method to work out how to shortcut the
javascript need.
 
In the actual <form> tag for the login, lots of sites fill-in random/session
or otherwise secretly generated hidden tags and you may need to first capture
the HTML code for the login form and extract all the hidden fields to be able
to do a proper login POST. Remember that the contents need to be URL encoded
when sent in a normal POST.
 
 
14. Debug
 
Many times when you run curl on a site, you'll notice that the site doesn't
seem to respond the same way to your curl requests as it does to your
browser's.
 
Then you need to start making your curl requests more similar to your
browser's requests:
 
* Use the --trace-ascii option to store fully detailed logs of the requests
   for easier analyzing and better understanding
 
* Make sure you check for and use cookies when needed (both reading with
   --cookie and writing with --cookie-jar)
 
* Set user-agent to one like a recent popular browser does
 
* Set referer like it is set by the browser
 
* If you use POST, make sure you send all the fields and in the same order as
   the browser does it. (See chapter 4.5 above)
 
A very good helper to make sure you do this right, is the LiveHTTPHeader tool
that lets you view all headers you send and receive with Mozilla/Firefox
(even when using HTTPS).
 
A more raw approach is to capture the HTTP traffic on the network with tools
such as ethereal or tcpdump and check what headers that were sent and
received by the browser. (HTTPS makes this technique inefficient.)
 
15. References
 
RFC 2616 is a must to read if you want in-depth understanding of the HTTP
protocol.
 
RFC 2396 explains the URL syntax.
 
RFC 2109 defines how cookies are supposed to work.
 
RFC 1867 defines the HTTP post upload format.
 
http://www.openssl.org is the home of the OpenSSL project
 
http://curl.haxx.se is the home of the cURL project
:

로또 인생 역전?

Legacy 2010. 9. 17. 18:26
SBS 뉴스 기사에 재미난게 올라왔길래..
스크랩 해봅니다요..


로또 복권의 역대 최다 1등 당첨 번호는 '1'인 것으로 17일 분석됐다.
기획재정부 복권위원회 등에 따르면 로또 1회부터 406회차까지 당첨번호 중 1등에 '1'이 포함된 경우가 82번에 이르렀다.
즉 '1'은 로또 추첨시 평균 5번에 1번 정도가 1등 당첨 번호에 포함된 셈이다.
'1'에 이어서는 '17'과 '37'이 75번이나 1등 당첨 번호에 들어 있었으며 '19'가 73번, '27'이 70번, '2'와 '20'이 69번이었다.
이어 '36'과 '45'가 68번, '4', '26', '5', '34'가 67번, '39', '40', '42', '7', '14'가 66번, '25', '3', '21', '33'이 65번이었다.


이렇게 되면.. 1, 17, 37, 19, 27, 2, 20, 36, 45, 4, 26, 5, 34, 39, 40, 42, 7, 14, 25, 3, 21, 33 번 22개의 숫자를 조합해서.. 인생역전의 꿈을 키우면 될려나요????

좀 허황되려나.. ㅋ

원본뉴스 : http://news.sbs.co.kr/section_news/news_read.jsp?news_id=N1000796251
:

CIDR(Classless Inter-Domain Routing) 표기법

ITWeb/스크랩 2010. 9. 9. 19:15

CIDR표기법
허용 IP
192.0.0.0/8
192.0.0.0 ~ 192.255.255.255
192.168.0.0/16
192.168.0.0 ~192.168.255.255
192.168.67.0/24
192.168.67.0 ~ 192.168.67.255

'0/n'은
IP주소에서 처음부터 n비트수 만큼이 네트워크 주소를 의미하고, 나머지 뒤의 비트들은 호스트 주소임을 의미합니다.

예를 들어
10.25.0.0/16 = 00001010 00011001 00000000 00000000
빨간색은 네트워크 주소, 파란색은 호스트 주소를 의미합니다.

IP/CIDR

Δ to last IP addr

Mask

Hosts (*)

Class

Notes

a.b.c.d/32

+0.0.0.0

255.255.255.255

1

1/256 C

 

a.b.c.d/31

+0.0.0.1

255.255.255.254

2

1/128 C

d = 0 ... (2n) ... 254

a.b.c.d/30

+0.0.0.3

255.255.255.252

4

1/64 C

d = 0 ... (4n) ... 252

a.b.c.d/29

+0.0.0.7

255.255.255.248

8

1/32 C

d = 0 ... (8n) ... 248

a.b.c.d/28

+0.0.0.15

255.255.255.240

16

1/16 C

d = 0 ... (16n) ... 240

a.b.c.d/27

+0.0.0.31

255.255.255.224

32

1/8 C

d = 0 ... (32n) ... 224

a.b.c.d/26

+0.0.0.63

255.255.255.192

64

1/4 C

d = 0, 64, 128, 192

a.b.c.d/25

+0.0.0.127

255.255.255.128

128

1/2 C

d = 0, 128

a.b.c.0/24

+0.0.0.255

255.255.255.000

256

1 C

 

a.b.c.0/23

+0.0.1.255

255.255.254.000

512

2 C

c = 0 ... (2n) ... 254

a.b.c.0/22

+0.0.3.255

255.255.252.000

1,024

4 C

c = 0 ... (4n) ... 252

a.b.c.0/21

+0.0.7.255

255.255.248.000

2,048

8 C

c = 0 ... (8n) ... 248

a.b.c.0/20

+0.0.15.255

255.255.240.000

4,096

16 C

c = 0 ... (16n) ... 240

a.b.c.0/19

+0.0.31.255

255.255.224.000

8,192

32 C

c = 0 ... (32n) ... 224

a.b.c.0/18

+0.0.63.255

255.255.192.000

16,384

64 C

c = 0, 64, 128, 192

a.b.c.0/17

+0.0.127.255

255.255.128.000

32,768

128 C

c = 0, 128

a.b.0.0/16

+0.0.255.255

255.255.000.000

65,536

256 C = 1 B

 

a.b.0.0/15

+0.1.255.255

255.254.000.000

131,072

2 B

b = 0 ... (2n) ... 254

a.b.0.0/14

+0.3.255.255

255.252.000.000

262,144

4 B

b = 0 ... (4n) ... 252

a.b.0.0/13

+0.7.255.255

255.248.000.000

524,288

8 B

b = 0 ... (8n) ... 248

a.b.0.0/12

+0.15.255.255

255.240.000.000

1,048,576

16 B

b = 0 ... (16n) ... 240

a.b.0.0/11

+0.31.255.255

255.224.000.000

2,097,152

32 B

b = 0 ... (32n) ... 224

a.b.0.0/10

+0.63.255.255

255.192.000.000

4,194,304

64 B

b = 0, 64, 128, 192

a.b.0.0/9

+0.127.255.255

255.128.000.000

8,388,608

128 B

b = 0, 128

a.0.0.0/8

+0.255.255.255

255.000.000.000

16,777,216

256 B = 1 A

 

a.0.0.0/7

+1.255.255.255

254.000.000.000

33,554,432

2 A

a = 0 ... (2n) ... 254

a.0.0.0/6

+3.255.255.255

252.000.000.000

67,108,864

4 A

a = 0 ... (4n) ... 252

a.0.0.0/5

+7.255.255.255

248.000.000.000

134,217,728

8 A

a = 0 ... (8n) ... 248

a.0.0.0/4

+15.255.255.255

240.000.000.000

268,435,456

16 A

a = 0 ... (16n) ... 240

a.0.0.0/3

+31.255.255.255

224.000.000.000

536,870,912

32 A

a = 0 ... (32n) ... 224

a.0.0.0/2

+63.255.255.255

192.000.000.000

1,073,741,824

64 A

a = 0, 64, 128, 192

a.0.0.0/1

+127.255.255.255

128.000.000.000

2,147,483,648

128 A

a = 0, 128

0.0.0.0/0

+255.255.255.255

000.000.000.000

4,294,967,296

256 A

 

 

참고.
http://en.wikipedia.org/wiki/CIDR

: