Network
Configuration.
IP
Addressing
An IP address is a numeric identifier
assigned to each machine on an IP network. It designates the specific location
of a device on the network.
We can assign IP Address to computer by using
two methods
1.
Static [ Manually ]
2.
Dynamic [ Using DHCP Server ]
There are three methods for depicting IP
Addresses
1. Dotted Decimal :- 10.2.11.10
2. Binary :- 00001010.00000010.00001011.00001010
3. Hexa-Decimal :- A.2.B.A
IP
Address Classes :-
Classes IP Range Octet Network ID / Host ID
Class A
0-127 8.8.8.8
N.H.H.H
Class B
128-191 8.8.8.8
N.N.H.H
Class C192-223 8.8.8.8 N.N.N.H
Class D
224-239 8.8.8.8
N.N.N.N
Class E240-255 8.8.8.8 N.N.N.N
1.
To view IP Address.
[root@server1 ~]#ifconfig
2.
To set IP Address.
[root@server1 ~]#setup
1. Under Choose
a Tool Dialog Box select Network
configuration and press ENTER
2. Under Select
Action Dialog Box select Device
configuration and press ENTER
3. Under Select
A Device Dialog Box select eth0
(eth0) – Ethernet and press ENTER
4. Under Network Configuration Dialog Box add
following entries
Name
eth0
Device eth0
Use
DHCP [*]
Static
IP This setting is applicable if DHCP server is
Netmask configured and machine will get IP from it
Default
gateway IP or else you need to set static IP for a machine
Primary
DNS Server
Secondary
DNS Server
Name
eth0
Device eth0
Use
DHCP [] to uncheck * press spacebar and set static IP.
Static
IP 10.0.0.1 for a machine use this settings.
Netmask 255.0.0.0
Default
gateway IP
Primary
DNS Server
Secondary
DNS Server
Select on
Ok and press ENTER.
5. Select
Save and press ENTER.
6. Select
Save&Quit and press ENTER
7.
SelectQuit
and press ENTER
[root@server1 ~]#ifconfig
[root@server1 ~]#service network restart
[root@server1 ~]#ping 10.0.0.1
3.
To add another Ethernet id and set IP for it.
[root@server1 ~]#setup
1. Under Choose
a Tool Dialog Box select Network
configuration and press ENTER
2. Under Select
Action Dialog Box select Device
configuration and press ENTER
3. Under Select
A Device Dialog Box select and press ENTER
4. Under
Network Configuration select
Ethernet and press ENTER or
select ADD
Now set Ethernet device name and IP address
Name
eth1
Device eth1
Use
DHCP [] to uncheck * press spacebar and set static IP.
Static
IP 10.0.0.10 for a machine use this settings.
Netmask 255.0.0.0
Default
gateway IP
Primary
DNS Server
Select on
Ok and press ENTER.
5. Select
Save and press ENTER.
6. Select
Save&Quit and press ENTER
7.
SelectQuit
and press ENTER
[root@server1 ~]#ifconfig
[root@server1 ~]#service network restart
[root@server1 ~]#ping 10.0.0.1
3.
To view network configuration file.
[root@server1 ~]#cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
NM_CONTROLLED=yes
ONBOOT=yes
IPADDR=10.0.0.1
BOOTPROTO=none
NETMASK=255.0.0.0
TYPE=Ethernet
IPV6INIT=no
USERCTL=no
HWADDR=00:0C:29:E4:E8:D4
PREFIX=8
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
NAME=”System eth0”
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
4.
To change hostname of a computer using file.
[root@server1 ~]#cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=server1
5.
To change IP address temporary.
[root@server1 ~]#ifconfig
eth2 inet
addr : 100.0.0.1 Bcast: 100.255.255.255
Mask: 255.0.0.0
[root@server1 ~]#ifconfig eth2
20.0.0.1
[root@server1 ~]#ifconfig
eth2 inet
addr : 20.0.0.1 Bcast: 20.255.255.255
Mask: 255.0.0.0
[root@server1 ~]#service network restart
[root@server1 ~]#ifconfig
eth2 inet
addr : 100.0.0.1 Bcast: 100.255.255.255
Mask: 255.0.0.0
5.
To create temporary alternate IP address .
[root@server1 ~]#ifconfig
eth2 inet
addr : 100.0.0.1 Bcast: 100.255.255.255
Mask: 255.0.0.0
[root@server1 ~]#ifconfig eth2:0
20.0.0.1
[root@server1 ~]#ifconfig
eth2:0
inet addr : 20.0.0.1 Bcast: 20.255.255.255 Mask: 255.0.0.0
[root@server1 ~]#service network restart
[root@server1 ~]#ifconfig
6.
To create permanent alternate IP address temporary.
[root@server1 ~]#cd /etc/sysconfig/network-scripts
[root@server1 network-scripts]#vi ifcfg-eth2:0
DEVICE=eth0:0
ONBOOT=yes
IPADDR=200.0.0.1
BOOTPROTO=static
NETMASK=255.0.0.0
TYPE=Ethernet
NM_CONTROLLED=no
:wq!
[root@server1 network-scripts]#service
network restart
[root@server1 network-scripts]#ifconfig
Note:- Whenever you assign temporary ip address or temporary lan card after you restart the network services the temporary settings will disappear.