Ch 25 Networking
Linux Networking : Scope of this document will be How to assign IP , Networking Tool , Ports and Misc Network settings
Assigning IP : There are two methods for Manual assigning IP to your Linux Box if it is not assign during the installation, if you have DHCP server in your Network Linux machine can get the IP from DHCP server.
IP Assigning using GUI/TUI Mode :
1. system-config-network : and follow the screen and update IP, DNS and Hostname related stuff
2. system-config-network-tui : this will open Terminal Graphical windows which can be operated using
Space Arrow and Enter key same as above method IP,DNS and Hostname.
IP Assigning using File Editing :
Fedora / Redhat / Centos and all other Linux distribution following Redhat release has following Network Directory Structure.
# /etc/sysconfig/network-scrips/ifcfg-eth[N] e.g ifcfg-eth0
#vi /etc/sysconfig/network-scrips/ifcfg-eth0
DEVICE=eth0
NM_CONTROLLED=no
ONBOOT=yes
IPADDR=10.21.22.162
BOOTPROTO=on
NETMASK=255.255.0.0
DNS2=10.21.2.14
TYPE=Ethernet
GATEWAY=10.21.1.1
DNS1=10.21.2.220
IPV6INIT=no
USERCTL=no
HWADDR=00:50:56:9C:BE:9B
PREFIX=16
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
If you want to add Permanent Virtual IP to your system Here are the steps:
# cp /etc/sysconfig/network-scrips/ifcfg-eth0 /etc/sysconfig/network-scrips/ifcfg-eth0:0
# vi /etc/sysconfig/network-scrips/ifcfg-eth0:0
DEVICE=eth0:0
NM_CONTROLLED=no
ONBOOT=yes
IPADDR=10.21.22.163
BOOTPROTO=on
NETMASK=255.255.0.0
DNS2=10.21.2.14
TYPE=Ethernet
GATEWAY=10.21.1.1
DNS1=10.21.2.220
IPV6INIT=no
USERCTL=no
HWADDR=00:50:56:9C:BE:9B
PREFIX=16
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
Two Fields are Updated DEVICE and IPADDR Restart Network Service you will get 2 IP from same machine and this will be persistence after reboot.