Thursday, May 12, 2016

Set Hostname IP and Gateway on CentOS 7

Set Hostname IP and Gateway on CentOS 7
1. Set Hostname
vi /etc/hostname
With content
srvname

2.Set IP Address and Netmask
vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
With content
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPADDR=124.124.124.201
NETMASK=255.255.255.0
DEVICE=eno16777736
NAME=eno16777736
ONBOOT=yes

3. Set Gateway
vi /etc/sysconfig/network
With Content
NETWORKING=yes
HOSTNAME=srvname
GATEWAY=124.124.124.2

No comments:

Post a Comment