Basic Network Configuration in CentOS

The file you have to keep an eye on CentOS for your box basic networking configuration is /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth0 or /etc/sysconfig/network-scripts/ifcfg-eth0:x for the alias network Interface. Below are the example of output in My CentOS box, /24 IP Block assumed.

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

DEVICE=eth0
BOOTPROTO=static
BROADCAST=xxx.xxx.xxx.255
IPADDR=xxx.xxx.xxx.12
NETMASK=255.255.255.0
NETWORK=xxx.xxx.xxx.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes

cat /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=xxx.magnet-id.com
GATEWAY=xxx.xxx.xxx.1

Put the resolver DNS IP Address on your /etc/resolv.conf (get them from your ISP or Data Center)

cat /etc/resolv.conf

nameserver 117.103.57.4
nameserver 117.103.56.5

If you want to make an alias IP Address, do this step;

Copy the ifcfg startup script

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0

Edit the newly created ifcfg script, customize to your other IP Address (aliased to the same network interface). Change the Device and IP Address Informations.
Restart Network Service

service network restart

This entry was posted in Networking, Nix Basics and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Magnet Hosting, Hosting, VPS dan Server Indonesia
  • Categories

  • Archives