change hostname and IP via SSH on centos Print

  • 1

 

Change hostname and IP via SSH on centos

 

 

  • To change Hostname via SSH on centos:

 nano /etc/sysconfig/network

 

  • then change to:

NETWORKING=yes

HOSTNAME="ex.hostname.com"

GATEWAY="192.168.0.1"

GATEWAYDEV="eth0"

FORWARD_IPV4="yes"

 

  • then run the following command:(change hostname.domain.com)

hostname hostname.domain.com

  • then go to the file:

/etc/hosts

  • add the following line: (change ip to your and also hostname.domain.com)

123.45.67.89 hostname.domain.com hostname

 

  • To change the hostname IP address of the server:

nano /etc/hosts

  • Reapply the network to apply the changes:

service network restart

/etc/init.d/network restart

 

 

 

 


Was this answer helpful?

« Back