Académique Documents
Professionnel Documents
Culture Documents
2)
ANALYZE
AUDIT
CALL
Cluster - CREATE CLUSTER
- ALTER CLUSTER
- DROP CLUSTER
COMMENT
COMMIT
CONNECT
CONSTRAINT - Add / Enable
Context - CREATE CONTEXT
- DROP CONTEXT
Controlfile - CREATE CONTROLFILE
EXEC
EXECUTE IMMEDIATE
EXPLAIN PLAN
GRANT
NOAUDIT
RECOVER
RENAME
Resource - ALTER RESOURCE COST
REVOKE
RMAN - Recovery Manager
Role - CREATE ROLE
- SET ROLE
- ALTER ROLE
- DROP ROLE
ROLLBACK
Rollback - CREATE ROLLBACK SEGMENT
- ALTER ROLLBACK SEGMENT
- DROP ROLLBACK SEGMENT
SAVEPOINT
Schema - CREATE SCHEMA
SELECT
Sequence - CREATE SEQUENCE
- ALTER SEQUENCE
- DROP SEQUENCE
Session - ALTER SESSION
SHUTDOWN
SNAPSHOT
SPfile - CREATE SPFILE
STARTUP
Statistics - ASSOCIATE STATISTICS
- DISASSOCIATE STATISTICS
Synonym - CREATE SYNONYM
- DROP SYNONYM
System - ALTER SYSTEM
UPDATE
UNION
User - CREATE USER
- ALTER USER
- DROP USER
Syntax:
Example
CALL place_order(453);
"Ever notice that 'What the hell' is always the right decision?" - Marilyn Monroe
key:
select_list
A comma-separated list of table columns (or expressions) eg:
DISTINCT
Supress duplicate rows - display only the unique values.
Duplicate rows have matching values across every column (or expression) in the
select_list.
FROM table_list
Contains a list of the tables from which the result set data is retrieved.
When selecting from a table you can also specify Partition and/or Sample
clauses e.g.
If the SELECT statement involves more than one table, the FROM clause can
also contain join specifications (SQL1992 standard). Read more about joins.
WHERE search_conditions
A filter that defines the conditions each row in the source table(s) must meet to
qualify for the SELECT. Only rows that meet the conditions will be included in the
result set. The WHERE clause can also contain inner and outer join
specifications (SQL1989 standard). e.g.
GROUP BY group_by_list
The GROUP BY clause partitions the result set into groups.
The group_by_list may be one or more columns or expressions and may
optionally include the CUBE / ROLLUP keywords for creating crosstab results.
Heirarchical Queries
Any query that does *not* include a GROUP BY clause may include a
CONNECT BY heirarchy clause:
You can sort by any column even if that column is not actually in the main
SELECT clause. If you do not include an ORDER BY clause then the order of the
result set rows will be unpredictable (random or quasi random).
Undocumented syntax:
Skip Locked will return all the 'non-locked' rows and lock them. While this syntax
can be used effectively, it is generally not a good idea to use it within an
application as undocumented syntax may be removed or changed in future
releases.
The clauses (SELECT ... FROM ... WHERE ... HAVING ... ORDER BY ... ) must
be in this order.
Each expression must be unambiguous. In other words if two columns have the
same name, then either prefix the columns with the tablename (or use an alias).
SELECT DISTINCT
customer_id,
oi_ship_date
FROM
customers,
order_items
WHERE
customers.customer_id = order_items.customer_id
AND order_items.oi_ship_date > '01-may-2001';
Table names may also be qualified with the schema name (if you are working
with multiple schema's)
e.g. scott.t_customers.customer_id
SQL statements can be simplified, and made more readable by assigning a table
alias (also known as a range variable or correlation name).
With a table alias the fully qualified name has to be specified only in the FROM
clause. All other table/view references then use the alias name. e.g.
SELECT DISTINCT
cst.customer_id,
ord.oi_ship_date
FROM
customers cst,
order_items ord
WHERE
cst.customer_id = ord.customer_id
AND ord.oi_ship_date > '01-may-2001';
OWNER
Owner of the view
VIEW_NAME
Name of the view
TEXT_LENGTH
Length of the view text
TEXT
View text
TYPE_TEXT_LENGTH
Length of the type clause of the object view
TYPE_TEXT
Type clause of the object view
OID_TEXT_LENGTH
Length of the WITH OBJECT OID clause of the object
view
OID_TEXT
WITH OBJECT OID clause of the object view
VIEW_TYPE_OWNER
Owner of the type of the view if the view is an
object view
VIEW_TYPE
Type of the view if the view is an object view
SUPERVIEW_NAME
Name of the superif view is a subview
OWNER
Owner of the table
TABLE_NAME
Name of the table
TABLESPACE_NAME
Name of the tablespace containing the table
CLUSTER_NAME
Name of the cluster,if any,to which the table belongs
IOT_NAME
Name of the index-only table,if any,to which the
overflow or mapping table entry belongs
PCT_FREE
Minimum percentage of free space in a block
PCT_USED
Minimum percentage of used space in a block
INI_TRANS
Initial number of transactions
MAX_TRANS
Maximum number of transactions
INITIAL_EXTENT
Size of the initial extent in bytes
NEXT_EXTENT
Size of secondary extents in bytes
MIN_EXTENTS
Minimum number of extents allowed in the segment
MAX_EXTENTS
Maximum number of extents allowed in the segment
PCT_INCREASE
Percentage increase in extent size
FREELISTS
Number of process freelists allocated in this segment
FREELIST_GROUPS
Number of freelist groups allocated in this segment
LOGGING
Logging attribute
BACKED_UP
Has table been backed up since last modification?
NUM_ROWS
The number of rows in the table
BLOCKS
The number of used blocks in the table
EMPTY_BLOCKS
The number of empty (never used) blocks in the table
AVG_SPACE
The average available free space in the table
CHAIN_CNT
The number of chained rows in the table
AVG_ROW_LEN
The average row length,including row overhead
AVG_SPACE_FREELIST_BLOCKS
The average freespace of all blocks on a freelist
NUM_FREELIST_BLOCKS
The number of blocks on the freelist
DEGREE
The number of threads per instance for scanning the
table
INSTANCES
The number of instances across which the table is to
be scanned
CACHE
Whether the table is to be cached in the buffer cache
TABLE_LOCK
Whether table locking is enabled or disabled
SAMPLE_SIZE
The sample size used in analyzing this table
LAST_ANALYZED
The date of the most recent time this table was
analyzed
PARTITIONED
Is this table partitioned? YES or NO
IOT_TYPE
If index-only table,then IOT_TYPE is IOT or
IOT_OVERFLOW or IOT_MAPPING else NULL
TEMPORARY
Can the current session only see data that it place
in this object itself?
SECONDARY
Is this table object created as part of icreate for
domain indexes?
NESTED
Is the table a nested table?
BUFFER_POOL
The default buffer pool to be used for table blocks
ROW_MOVEMENT
Whether partitioned row movement is enabled or
disabled
GLOBAL_STATS
Are the statistics calculated without merging
underlying partitions?
USER_STATS
Were the statistics entered directly by the user?
DURATION
If temporary table,then duration is sys$session or
sys$transaction else NULL
SKIP_CORRUPT
Whether skip corrupt blocks is enabled or disabled
MONITORING
Should we keep track of the amount of modification?
CLUSTER_OWNER
Owner of the cluster,if any,to which the table
belongs
DEPENDENCIES
Should we keep track of row level dependencies?
__ __ ____ ___ _
| \/ |_ _/ ___| / _ \| |
| |\/| | | | \___ \| | | | |
| | | | |_| |___) | |_| | |___
|_| |_|\__, |____/ \__\_\_____|
|___/
Show certain
selected rows
SELECT * FROM [table name] WHERE [field name] = "whatever";
with the value
"whatever".
Use a regular
expression to find
records. Use
"REGEXP
BINARY" to SELECT * FROM [table name] WHERE rec RLIKE "^a$";
force case-
sensitivity. This
finds any record
beginning with a.
Show unique
SELECT DISTINCT [column name] FROM [table name];
records.
Show selected SELECT [col1],[col2] FROM [table name] ORDER BY [col2]
records sorted in DESC;
an ascending
(asc) or
descending
(desc).
Count rows. SELECT COUNT(*) FROM [table name];
Network
IOS Commands
Privileged Mode
enable - get to privileged mode
disable - get to user mode
enable password <password_here> - sets privileged mode password
enable secret <password_here> - sets encrypted privileged mode password
Setting Passwords
enable secret <password_here> - set encrypted password for privileged access
enable password <password_here> - set password for privileged access (used when there is
no enable secret and when using older software)
Set password for console access:
(config)#line console 0
(config-line)#login
(config-line)#password <password_here>
Set password for virtual terminal (telnet) access (password must be set to access router
through telnet):
(config)#line vty 0 4
(config-line)#login
(config-line)#password <password_here>
Set password for auxiliary (modem) access:
(config)#line aux 0
(config-line)#login
(config-line)#password <password_here>
General Commands
no shutdown - (enables the interface)
reload - restarts the router
sh ver - Cisco IOS version, uptime of router, how the router started, where
system was loaded from, the interfaces the POST found, and the configuration
register
sh clock - shows date and time on router
sh history - shows the history of your commands
sh debug - shows all debugging that is currently enabled
no debug all - turns off all debugging
sh users - shows users connected to router
sh protocols - shows which protocols are configured
banner motd # Your_message # - Set/change banner
hostname <router_name_here> - use to configure the hostname of the router
clear counters - clear interface counters
CDP Commands (Cisco Discovery Protocol uses layer 2 multicast over a SNAP-
capable link to send data):
sh cdp neighbor - shows directly connected neighbors
sh cdp int - shows which interfaces are running CDP
sh cdp int eth 0/0 - show CDP info for specific interface
sh cdp entry <cdp_neighbor_here> - shows CDP neighbor detail
cdp timer 120 - change how often CDP info is sent (default cdp timer is 60)
cp holdtime 240 - how long to wait before removing a CDP neighbor (default
CDP holdtime is 180)
sh cdp run - shows if CDP turned on
no cdp run - turns off CDP for entire router (global config)
no cdp enable - turns off CDP on specific interface
Miscellaneous Commands
sh controller t1 - shows status of T1 lines
sh controller serial 1 - use to determine if DCE or DTE device
(config-if)#clock rate 6400 - set clock on DCE (bits per second)
(config-if)#bandwidth 64 - set bandwidth (kilobits)
IP Commands
Configure IP on an interface:
int serial 0
ip address 157.89.1.3 255.255.0.0
int eth 0
ip address 2008.1.1.4 255.255.255.0
Other IP Commands:
sh ip route - view ip routing table
ip route <remote_network> <mask> <default_gateway>
[administrative_distance] - configure a static IP route
ip route 0.0.0.0 0.0.0.0 <gateway_of_last_resort> - sets default gateway
ip classless - use with static routing to allow packets destined for
unrecognized subnets to use the best possible route
sh arp - view arp cache; shows MAC address of connected routers
ip address 2.2.2.2 255.255.255.0 secondary - configure a 2nd ip address on
an interface
sh ip protocol
IPX Commands
Enable IPX on router:
ipx routing
Configure IPX + IPX-RIP on an int:
int ser 0
ipx network 4A
Other Commands:
sh ipx route - shows IPX routing table
sh ipx int e0 - shows ipx address on int
sh ipx servers - shows SAP table
sh ipx traffic - view traffic statistics
debug ipx routing activity - debugs IPS RIP packets
debug ipx sap - debugs SAP packets
Routing Protocols
Configure RIP:
router rip
network 157.89.0.0
network 208.1.1.0
Other RIP Commands:
debug ip rip - view RIP debugging info
Configure IGRP:
router IGRP 200
network 157.89.0.0
network 208.1.1.0
Other IGRP Commands:
debug ip igrp events - view IGRP debugging info
debug ip igrp transactions - view IGRP debugging info
PPP Configuration
encapsulation ppp
ppp authentication <chap_or_pap_here>
ppp chap hostname <routername_here>
ppp pap sent-username <username_here>
sh int ser 0 - use to view encapsulation on the interface
Frame-Relay Configuration
encapsulation frame-relay ietf - use IETF when setting up a frame-relay
network between a Cisco router and a non-Cisco router
frame-relay lmi-type ansi - LMI types are Cisco, ANSI, Q933A; Cisco is the
default; LMI type is auto-sensed in IOS v11.2 and up
frame-relay map ip 3.3.3.3 100 broadcast - if inverse ARP won't work, map
Other IP to Your DLCI # (local)
keepalive 10 - use to set keepalive
sh int ser 0 - use to show DLCI, LMI, and encapsulation info
sh frame-relay pvc - shows the configured DLCI's; shows PVC traffic stats
sh frame-relay map - shows route maps
sh frame-relay lmi - shows LMI info
Keyboard Shortcuts
CTRL-P - show previous command
CTRL-N - show next command
SHIFT-CTRL-6 - Break
Notes
Static Routing - manually assigned by the Admin user entering the routes
(Routed Protocols - IP, IPX and AppleTalk)
Dynamic Routing - generated/determined by a Routing Protocol (Routing
Protocols - RIP I, RIP II, IGRP, EIGRP, OSPF, NLSP, RTMP)
Dynamic
1) With Dynamic Routing, routers pass information between each other so that
routing tables are regularly maintained.
2) The routers then determine the correct paths packets should take to reach
their destinations.
3) Information is passed only between routers.
4) A routing domain is called an Autonomous System, as it is a portion of the
Internetwork under common admin authority.
5) Consists of routers that share information over the same protocol. Can be split
into routing areas.
Routing Protocols
I) Interior (within an autonomous system - AS - group of routers under the same
administrative authority)
a) Distance Vector - understands the direction and distance to any network
connection on the internetwork. Knows how
many hops (the metric) to get there. All routers w/in the internetwork listen for
messages from other routers, which are sent
every 30 to 90 seconds. They pass their entire routing tables. Uses hop count
for measurement. 1) Used in smaller networks
that are have fewer than 100 routers. 2) Easy to configure and use. 3) As
routers increase in number, you need to consider
CPU utilization, convergence time, and bandwidth utilization. 4) Convergence
is due to routing updates at set intervals. 5) When
a router recognizes a change it updates the routing table and sends the whole
table to all of its neighbors.
1) RIP - 15 hop count max
2) IGRP - 255 hop count max, uses reliability factor (255 optimal), and
bandwidth
3) RTMP
b) Link State - understands the entire network, and does not use secondhand
information. Routers exchange LSP?s (hello
packets). Each router builds a topographical view of the network, then uses
SPF (shortest path first) algorithm to determine the
best route. Changes in topology can be sent out immediately, so convergence
can be quicker. Uses Bandwidth, congestion for measurement; Dijkstra's
algorithm;
1) Maintains Topology Database. 2) Routers have formal neighbor
relationship. 3) Exchanges LSA (Link State Advertisement) or
hello packets with directly connected interfaces. 4) These are exchanged at
short intervals (typically 10 sec). 5) Only new info is
exchanged. 6) Scales well, however link?state protocols are more complex. 7)
Requires more processing power, memory, and bandwidth.
1) OSPF - decisions based on cost of route (metric limit of 65,535)
2) EIGRP - hybrid protocol (both Distance-Vector and Link State), Cisco
proprietary
3) NLSP
4) IS-IS
II) Exterior
1) EGP (Exterior Gateway Protocol)
2) BGP (Border Gateway Protocol)
Encapsulation Types
Encapsulation
802.2 sap
802.3 novell-ether
Ethernet arpa (Internet
II Standard)
Snap snap
WAN Devices
Routers - Offer both internetwork and WAN interface controls
ATM Switches - High-speed cell switching between both LANs and WANs
X.25 and Frame-Relay Switches - Connect private data over public circuits
using digital signals
Modems - Connect private data over public telephone circuits using analog
signals
CSU/DSU (Channel Service Units/Data Service Units) - Customer Premises
Equipment (CPE) which is used to terminate a digital circuit at the customer site
Communication Servers - Dial in/out servers that allow dialing in from remote
locations and attach to the LAN
Multiplexors - Device that allows more than one signal to be sent out
simultaneously over one physical circuit
ISDN
ISDN BRI (Basic Rate Interface) - 2 64K B channels, plus 1 16K D channel
ISDN PRI (Primary Rate Interface) - 23 64K B channels, plus 1 64K D channel
(North America & Japan), 30 64K B channels, plus 1 64K D channel (Europe &
Australia)
Switching Terminology
Store-and-Forward ? copies entire frame into buffer, checks for CRC errors
before forwarding. Higher latency.
Cut-Through ? reads only the destination address into buffer, and forwards
immediately; Low latency; "wire-speed"
Fragment free ? modified form of cut-through; switch will read into the first 64
bytes before forwarding the frame. Collisions will usually occur within the first 64
bytes. (default for 1900 series).
Access Lists
Access Wildcard
Filters Additional Notes
List Masks
To put
Wildcard mask
simply,
examples:
when the IP
0.0.0.0=entire address
Source IP is broken
must match.
address down to
Standard 0.255.255.255=only
field in the binary, the
IP the first octet must
packet's IP 1's allow
match, the rest will
header everything
allow everything.
and the 0's
255.255.255.255=allow
must match
everything
exactly.
Source IP
or The key word ANY
Destination implies any IP value is
Extended Same as
IP, or TCP allowed, the keyword
IP standard
or UDP HOST implies the IP
Source or exactly has to match
Destination
Ports, or
Protocol
Packets
sent by
clients and Configured
servers, as a
-1 means any and all
Standard and SAP hexadecimal
network numbers (
IPX updates number
works like ANY)
sent by instead of
servers binary
and
routers
Source
Network or
Node, or Match
Destination multiple
Network or networks The most practical use
Extended
Node, or with one of the protocol type is
IPX
IPX statement, for NetBIOS
Protocol, again in
or IPX hexadecimal
Socket, or
SAP
Troubleshooting Tools:
Ping Results
! success
, timeout
destination
U
unreachable
unknown
?
packet type
& TTL
exceeded
Traceroute Results
router rec'd,
but didn't
!H forward
because of
access-list
protocol
P
unreachable
network
N
unreachable
port
U
unreachable
, timeout
HDLC (High-Level Data Link Control) - Link layer protocol for Serial links.
Cisco Default. Supports the following modes: Normal Response Mode ? as per
Secondary under SDLC; Asynchronous Response Mode allows secondary to
communicate without permission; Asynchronous Balanced mode combines the
two stations. Has lower overhead than LAPB but less error checking.
Common Ports
This file was taken from the IANA website. It is a list of the well known port numbers.
# /etc/services:
# $Id: services,v 1.4 1997/05/20 19:41:21 tobias Exp $
#
# Network services, Internet style
#
# Note that it is presently the policy of IANA to assign a single well-
known
# port number for both TCP and UDP; hence, most entries here have two
entries
# even if the protocol doesn't support UDP operations.
# Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all
ports
# are included, only the more common ones.
#======================================================================
===
# The remaining port numbers are not as allocated by IANA.
#
# Kerberos (Project Athena/MIT) services
# Note that these are for Kerberos v4, and are unofficial. Sites
running
# v4 should uncomment these and comment out the v5 entries above.
#
kerberos4 750/udp kerberos-iv kdc # Kerberos (server) udp
kerberos4 750/tcp kerberos-iv kdc # Kerberos (server) tcp
kerberos_master 751/udp # Kerberos authentication
kerberos_master 751/tcp # Kerberos authentication
passwd_server 752/udp # Kerberos passwd server
krb_prop 754/tcp # Kerberos slave
propagation
krbupdate 760/tcp kreg # Kerberos registration
kpasswd 761/tcp kpwd # Kerberos "passwd"
swat 901/tcp # swat
kpop 1109/tcp # Pop with Kerberos
knetd 2053/tcp # Kerberos de-multiplexor
zephyr-srv 2102/udp # Zephyr server
zephyr-clt 2103/udp # Zephyr serv-hm
connection
zephyr-hm 2104/udp # Zephyr hostmanager
eklogin 2105/tcp # Kerberos encrypted
rlogin
# Hmmm. Are we using Kv4 or Kv5 now? Worrying.
# The following is probably Kerberos v5 --- ajt@debian.org
(11/02/2000)
kx 2111/tcp # X over Kerberos
#
# Unofficial but necessary (for NetBSD) services
#
supfilesrv 871/tcp # SUP server
supfiledbg 1127/tcp # SUP debugging
#
# Datagram Delivery Protocol services
#
rtmp 1/ddp # Routing Table
Maintenance Protocol
nbp 2/ddp # Name Binding Protocol
echo 4/ddp # AppleTalk Echo Protocol
zip 6/ddp # Zone Information
Protocol
#
# Services added for the Debian GNU/Linux distribution
#
linuxconf 98/tcp # LinuxConf
poppassd 106/tcp # Eudora
poppassd 106/udp # Eudora
imsp 406/tcp # Interactive Mail Support
Protocol
imsp 406/udp # Interactive Mail Support
Protocol
ssmtp 465/tcp smtps # SMTP over SSL
nqs 607/tcp # Network Queuing system
moira_db 775/tcp # Moira database
moira_update 777/tcp # Moira update protocol.
moira_ureg 779/udp # Moira user registration.
omirr 808/tcp omirrd # online mirror
omirr 808/udp omirrd # online mirror
customs 1001/tcp # pmake customs server
customs 1001/udp # pmake customs server
rmiregistry 1099/tcp # Java RMI Registry
skkserv 1178/tcp # skk jisho server port
predict 1210/udp # predict -- satellite
tracking
rmtcfg 1236/tcp # Gracilis Packeten remote
config server
xtel 1313/tcp # french minitel
xtelw 1314/tcp # french minitel
support 1529/tcp # GNATS
sieve 2000/tcp # Sieve mail filter daemon
cfinger 2003/tcp lmtp # GNU Finger / Local Mail
Transfer Protocol
ndtp 2010/tcp # Network dictionary
transfer protocol
ninstall 2150/tcp # ninstall service
ninstall 2150/udp # ninstall service
zebrasrv 2600/tcp # zebra service
zebra 2601/tcp # zebra vty
ripd 2602/tcp # RIPd vty
ripngd 2603/tcp # RIPngd vty
ospfd 2604/tcp # OSPFd vty
bgpd 2605/tcp # BGPd vty
ospf6d 2606/tcp # OSPF6d vty
afbackup 2988/tcp # Afbackup system
afbackup 2988/udp # Afbackup system
afmbackup 2989/tcp # Afmbackup system
afmbackup 2989/udp # Afmbackup system
xtell 4224/tcp # xtell server
fax 4557/tcp # FAX transmission service
(old)
hylafax 4559/tcp # HylaFAX client-server
protocol (new)
pcrd 5151/tcp # PCR-1000 Daemon
noclog 5354/tcp # noclogd with TCP (nocol)
noclog 5354/udp # noclogd with UDP (nocol)
hostmon 5355/tcp # hostmon uses TCP (nocol)
hostmon 5355/udp # hostmon uses UDP (nocol)
postgres 5432/tcp # POSTGRES
postgres 5432/udp # POSTGRES
mrtd 5674/tcp # MRT Routing Daemon
bgpsim 5675/tcp # MRT Routing Simulator
canna 5680/tcp # cannaserver
sane 6566/tcp saned # SANE network scanner
daemon
ircd 6667/tcp # Internet Relay Chat
ircd 6667/udp # Internet Relay Chat
ircd-dalnet 7000/tcp # IRC - Dalnet
ircd-dalnet 7000/udp # IRC - Dalnet
webcache 8080/tcp # WWW caching service
webcache 8080/udp # WWW caching service
tproxy 8081/tcp # Transparent Proxy
tproxy 8081/udp # Transparent Proxy
omniorb 8088/tcp # OmniORB
omniorb 8088/udp # OmniORB
mandelspawn 9359/udp mandelbrot # network mandelbrot
amanda 10080/udp # amanda backup services
kamanda 10081/tcp # amanda backup services
(Kerberos)
kamanda 10081/udp # amanda backup services
(Kerberos)
amandaidx 10082/tcp # amanda backup services
amidxtape 10083/tcp # amanda backup services
smsqp 11201/tcp # Alamin SMS gateway
smsqp 11201/udp # Alamin SMS gateway
xpilot 15345/tcp # XPilot Contact Port
xpilot 15345/udp # XPilot Contact Port
isdnlog 20011/tcp # isdn logging system
isdnlog 20011/udp # isdn logging system
vboxd 20012/tcp # voice box system
vboxd 20012/udp # voice box system
binkp 24554/tcp # Binkley
binkp 24554/udp # Binkley
asp 27374/tcp # Address Search Protocol
asp 27374/udp # Address Search Protocol
dircproxy 57000/tcp # Detachable IRC Proxy
tfido 60177/tcp # Ifmail
tfido 60177/udp # Ifmail
fido 60179/tcp # Ifmail
fido 60179/udp # Ifmail
|_ _/ ___| _ \ / /_ _| _ \
| || | | |_) / / | || |_) |
| || |___| __/ / | || __/
|_| \____|_| /_/ |___|_|
For more information on subnetting, see RFC 1817 and RFC 1812.
Reserved address ranges for private (non-routed) use (see RFC 1918):
Chart notes:
• Number of Subnets - "( )" Refers to the number of effective subnets, since the use
of subnet numbers of all 0s or all 1s is highly frowned upon and RFC non-
compliant.
• Number of Hosts - Refers to the number of effective hosts, excluding the network
and broadcast address.
Class A
/8 255.0.0.0 0 16777214
Class B
Class C
Class C
The first thing you must know is that the common number system
used world wide is the decimal system (otherwise known as base
10). What makes the decimal system a base 10 system is that it is
based on grouping numbers by 10's. It is believed that the system
evolved because we have ten fingers and ten toes which over the
years we have used for counting. I use mine all the time (grin). We
name the ten digits: zero, one, two, three, four, five, six, seven,
eight and nine.
The decimal system has a 1's place, a 10's place, a 100's place, a
1000's place and so on. We say the number places are grouped by
10's because multiplying each number place by 10 gives you the
next number place. So: 1x10=10 (the 10's place), 10x10=100 (the
100's place), 100x10=1000 (the 1000's place) etc.
Thus: 100+0+3=103
By now you probably feel like you have attended Kindergarten for
the second time in your life? Sorry about that but it is very
important that you understand the concept of what a number
system is, and what it is based on before we look at binary.
Binary is a base 2 system, and thus groups numbers by 2's and not
by 10's like the decimal system. We name the two digits: zero and
one. The binary system has a 1's place, a 2's place, a 4's place, an
8's place, a 16's place and so on. We say the number places are
grouped by 2's because multiplying each number place by 2 gives
you the next number place. So: 1x2=2 (the 2's place), 2x2=4 (the
4's place), 4x2=8 (the 8's place), 8x2=16 (the 16's place) etc.
Let's look at the decimal number Let's look at the decimal number
103 in binary format:
Thus: 0+64+32+0+0+4+2+1=103
Okay, Let's test your skills. Here is a list of binary numbers, try
converting them to decimal and check your answers at the end of
this post.
10000000
11000000
11100000
01000000
10000011
10010001
11111111
Now that you understand what binary is, let's have a look at our
two subnet masks from the beginning of my post:
192.168.1.0 / 255.255.255.0
192.168.1.0/24
11111111.11111111.11111111.00000000
If you count all the ones, you will find that there are 24 of them.
Now look at the subnet mask examples again.
192.168.1.0/255.255.255.0
192.168.1.0/24
Do you see why both subnet masks are the same? The number 24
is the number of bits used in the network portion of the address,
and is short-hand for writing the address/subnet mask
combination. It becomes important to understand this when you
start dividing your network into multiple sub networks.
[Understanding Subnetting]
There are two methods for dividing your network into multiple sub
networks; One is to simply change your network numbers keeping
the same subnet mask. The other is to subnet your network into
smaller sub networks.
Example:
192.168.1.0/255.255.255.0
192.168.2.0/255.255.255.0
Doing this would give you two separate networks with 254 hosts
per network. This is a very common method of dealing with
multiple networks. However, back in the good old days you had to
pay for every IP address you used, and if you had 25 computers on
your network you probably would not want to pay for 254
addresses! The answer to the problem is...subnetting.
Subnetting a network:
Subnetting is when you use bits from the host portion of your
address as part of your network number. This let's you subdivide
your network at the cost of host addresses, which is great if you're
paying for every host IP address. It will save you money because
you pay for fewer TCP/IP addresses. Confused? Here is where
understanding binary is important.
As you can see in the fourth octet, some of the host portion of this
subnet mask is now being used for part of the network address.
Which means we are now using some of the binary bits in the
fourth octet for our network numbers, and that gives us fewer
hosts than our old mask (which gave us 254), but gives us more
networks (which is why we call it subnetting).
How can we tell how many networks and hosts per network this
new subnet mask will give us? Well... we shall have to use some
of our newly acquired binary skills.
The first task is to find out how many bits in the fourth octet are
being used? The decimal number is 224, what is the decimal
number 224 as represented in binary?
Thus: 128+64+32+0+0+0+0+0=224
We now know that three bits from the fourth octet are used. How
can we tell how many sub networks we're going to have? This
requires some math- sorry. The formula is: 2n-2, where n is the
number of bits being used from the host portion of our subnet
mask.
Note: We subtract 2 from the total because you do not count all
0's or all 1's.
In simpler terms:
(2x2x2)-2=6
What is the first subnet? Let's have a look at the bits in our fourth
octet again. The bit that gives us the answer is the (1) closest to
the first zero, and in this case it is the 3rd bit from the left.
11100000
The 3rd bit will start our first network, and the 3rd bit is in the
32's place (remember binary). Start adding the value 32 to itself
six times to get the six network numbers.
32
64
96
128
160
192
192.168.1.32
192.168.1.64
192.168.1.96
192.168.1.128
192.168.1.160
192.168.1.192
Example:
Subnet:192.168.1.32 / 255.255.255.224
Address Range: 192.168.1.33 through 192.168.1.62 (30 hosts)
Subnet Broadcast Address:192.168.1.63
Quiz:
Let's test your skills- write the address range and broadcast
address for the following subnet. You will find the answer at the
end of this post.
How many bits are used from the host portion? To find this out,
we need to know how the decimal number 240 is represented in
binary.
So four bits are taken from the host portion of our mask. We do
the same math as before:
24-2=14
In simpler terms:
(2x2x2x2)-2=14
16
32
48
64
80
96
112
128
144
160
176
192
208
224
192.168.1.16
192.168.1.32
192.168.1.48
192.168.1.64
192.168.1.80
192.168.1.96
192.168.1.112
192.168.1.128
192.168.1.144
192.168.1.160
192.168.1.176
192.168.1.192
192.168.1.208
192.168.1.224
Network: 205.112.10.16/.255.255.255.240
Address Range: 205.112.10.17 through 205.112.10.30
Subnet Broadcast Address: 205.112.10.31
10000000 = 128
11000000 = 192
11100000 = 224
01000000 = 64
10000011 = 131
10010001 = 145
11111111 = 255
Subnet:192.168.1.128 / 255.255.255.224
Address Range: 192.168.1.129 through 192.168.1.158
Subnet Broadcast Address: 192.168.1.159