Vous êtes sur la page 1sur 8

Basic about Network

Internet Protocol hierarchy contains several classes of IP Addresses to be used efficiently in


various situation as per the requirement of hosts per network. Broadly, IPv4 Addressing system
is divided into 5 classes of IP Addresses. All the 5 classes are identified by the first octet of IP
Address.

Internet Corporation for Assigned Names and Numbers - responsible for assigning IP addresses.

The first octet referred here is the left most of all. The octets numbered as follows depicting
dotted decimal notation of IP Address:

Number of networks and number of hosts per class can be derived by this formula:

When calculating hosts IP addresses, 2 IP addresses are decreased because they cannot be
assigned to hosts i.e. the first IP of a network is network number and the last IP is reserved for
Broadcast IP.

IP Address Classes:
First IP in block Last IP in block

10.0.0.0 10.255.255.255

172.16.0.0 172.31.255.255

192.168.0.0 192.168.255.255

Class A Address

The first bit of the first octet is always set to 0 (zero). Thus the first octet ranges from 1 127, i.e.

Class A addresses only include IP starting from 1.x.x.x to 126.x.x.x only. The IP range 127.x.x.x is
reserved for loopback IP addresses.

The default subnet mask for Class A IP address is 255.0.0.0 which implies that Class A addressing can
have 126 networks (27-2) and 16777214 hosts (224-2).

Class A IP address format thus, is 0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH

Class B Address

An IP address which belongs to class B has the first two bits in the first octet set to 10, i.e.

Class B IP Addresses range from 128.0.x.x to 191.255.x.x. The default subnet mask for Class B is
255.255.x.x.

Class B has 16384 (214) Network addresses and 65534 (216-2) Host addresses.

Class B IP address format is, 10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH

Class C Address

The first octet of Class C IP address has its first 3 bits set to 110, that is
Class C IP addresses range from 192.0.0.x to 192.255.255.x. The default subnet mask for Class B is
255.255.255.x.

Class C gives 2097152 (221) Network addresses and 254 (28-2) Host addresses.

Class C IP address format is 110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH

Class D Address

Very first four bits of the first octet in Class D IP addresses are set to 1110, giving a range of

Class D has IP address rage from 224.0.0.0 to 239.255.255.255. Class D is reserved for
Multicasting. In multicasting data is not destined for a particular host, that's why there is no
need to extract host address from the IP address, and Class D does not have any subnet mask.

Class E Address

This IP Class is reserved for experimental purposes only like for R&D or Study. IP addresses in
this class ranges from 240.0.0.0 to 255.255.255.254. Like Class D, this class too is not equipped
with any subnet mask.

What are Public IP Addresses?

A public IP address is assigned to every computer that connects to the Internet where each IP is
unique. In this case, there cannot exist two computers with the same public IP address all over
the Internet. This addressing scheme makes it possible for the computers to find each other
online and exchange information. User has no control over the IP address (public) that is
assigned to the computer. The public IP address is assigned to the computer by the Internet
Service Provider as soon as the computer is connected to the Internet gateway.

A public IP address can be either static or dynamic. A static public IP address does not change
and is used primarily for hosting web pages or services on the Internet. On the other hand, a
dynamic public IP address is chosen from a pool of available addresses and changes each time
one connects to the Internet.

Most Internet users will only have a dynamic IP assigned to their computer which goes off when
the computer is disconnected from the Internet. Thus when it is re-connected it gets a new IP.
What are Private IP Addresses?

An IP address is considered private if the IP number falls within one of the IP address ranges
reserved for private networks such as a Local Area Network (LAN). The Internet Assigned
Numbers Authority (IANA) has reserved the following three blocks of the IP address space for
private networks (local networks):

Start End No. of addresses


24-bit block (/8 prefix, 1 A) 10.0.0.0 10.255.255.255 16777216
20-bit block (/12 prefix, 16 B) 172.16.0.0 172.31.255.255 1048576
16-bit block (/16 prefix, 256 C) 192.168.0.0 192.168.255.255 65536

Private IP addresses are used for numbering the computers in a private network including
home, school and business LANs in airports and hotels which makes it possible for the
computers in the network to communicate with each other.

How to find Ethernet card info?

Ethtool eth0

How to find Ethernet card driver info?

Ethtool I eth0

How can we get MAC address of a given NIC card?

ethtool -P eth0

Full-duplex means that communication can occur in both directions(send and receive) at the
same time. Half-duplex means communication can only occur in one direction at a time.

# mii-tool eth0Output:

eth0: negotiated 100baseTx-FD flow-control, link ok

Task: Change the speed and duplex settings

Setup eth0 negotiated speed with mii-tool


Disable autonegotiation, and force the MII to either 100baseTx-FD, 100baseTx-HD, 10baseT-FD,
or 10baseT-HD:# mii-tool -F 100baseTx-HD
# mii-tool -F 10baseT-HDSetup eth0 negotiated speed with ethtool# ethtool -s eth0 speed 100
duplex full
# ethtool -s eth0 speed 10 duplex half

Change the Speed and Duplex settings Permanently on CentOS/RHEL


To make settings permanent, you need to edit /etc/sysconfig/network-scripts/ifcfg-eth0 file for
eth0 interface. This file is used by RHEL, CentOS, Fedora etc.
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Append the line as follows to disable Auto-Negotiation, enable Full Duplex and set up Speed to
100 Mb/s :

ETHTOOL_OPTS="speed 100 duplex full autoneg off"

Restart the interface to apply changes :


# ifdown eth0 && ifup eth0

MAC:

media access control address (MAC address) is a unique identifier assigned to network
interfaces for communications on the physical network segment. MAC addresses are used as a
network address for most IEEE 802 network technologies, including Ethernet. Logically, MAC
addresses are used in the media access control protocol sublayer of the OSI reference model.

MAC addresses are most often assigned by the manufacturer of a network interface controller
(NIC) and are stored in its hardware, such as the card's read-only memory or some other
firmware mechanism. If assigned by the manufacturer, a MAC address usually encodes the
manufacturer's registered identification number and may be referred to as the burned-in
address (BIA). It may also be known as an Ethernet hardware address (EHA), hardware address
or physical address.

The standard (IEEE 802) format for printing MAC-48 addresses in human-friendly form is six
groups of two hexadecimal digits, separated by hyphens (-) or colons (:), in transmission order
(e.g. 01-23-45-67-89-ab or 01:23:45:67:89:ab ). This form is also commonly used for EUI-64.
Another convention used by networking equipment uses three groups of four hexadecimal digits
separated by dots (.) (e.g. 0123.4567.89ab ), again in transmission order.
How to assign Static IP :(TMP)

Step 1 : Ifconfig eth0 192.168.69.123 netmask 255.255.255.0

Step 2 : Ifdown eth0

Step 3: Ifup eth0

How to assign Static IP: (Permanently)

Step 1:

Vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"

HWADDR="08:00:27:F5:D0:21"

#NM_CONTROLLED="yes"

ONBOOT="yes"

BOOTPROTO=static

IPADDR=192.168.69.115

NETMASK=255.255.255.192

:wq
Step 2:

Service network restart

How to assign virtual IP temp?

Step 1:

Ifconfig eth0:1 192.168.69.11

Step 2:

Ifup eth0:1

How to assign virtual IP permanently?

Step 1:

cp i /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1

Step 2:

Vi /etc/sysconfig/network-scripts/ifcfg-eth0:1

And edit Only

DEVICE="eth0:1"

IPADDR=192.168.69.116

Vous aimerez peut-être aussi