lunedì 11 novembre 2013

RedHat Centos Network configuration (CLI)

Set Default gateway:
insert in /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=
GATEWAY=

##############################################################################
Backup existing static configuration

First backup existing network configuration file using cp command:
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /root/ifcfg-eth0.bak

Configuring a DHCP Client

Setting up a Linux for dhcp can be done by editing file using a text editor such as vi:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Following is sample static configuration:
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:19:D1:2A:BA:A8
IPADDR=10.10.10.10
NETMASK=255.255.255.0
ONBOOT=yes

Replace static configuration with DHCP:
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:19:D1:2A:BA:A8
ONBOOT=yes

Save and close the file. Just restart network service:
# /etc/init.d/network restart

Please note that you need a configuration file for each device that you want to configure to use DHCP.Backup existing static configuration

First backup existing network configuration file using cp command:
# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /root/ifcfg-eth0.bak


Save and close the file. Just restart network service:
# /etc/init.d/network restart

Please note that you need a configuration file for each device that you want to configure to use DHCP.

Nessun commento: