Linux命令-修改IP和hostname

系统centos7

一、修改centos系统IP

cd /etc/sysconfig/network-scripts下。ifcfg-ens33为使用的网卡名,具体以实际使用的网卡名为准

cd /etc/sysconfig/network-scripts
[root@docker137 network-scripts]# cat ifcfg-ens33
TYPE="Ethernet"
#BOOTPROTO="dhcp"
#BOOTPROTO="static"
IPADDR="192.168.72.137"
GATEWAY="192.168.72.2"
NAME="ens33"
DEVICE="ens33"
ONBOOT="yes"

IPADDR修改为指定的IP

重启网卡,IP修改成功

service network restart

二、修改主机hostname

[root@docker137 ~]#

root@之后的为hostname

查看

[root@docker137 ~]# cat /etc/hostname
docker137

修改hostname,指定名称即可

vi /etc/hostname

修改完毕后,重启服务器

猜你喜欢

转载自blog.csdn.net/lanwp5302/article/details/86603361