Temporarily change host name:
hostname ABC #临时改名;
Vim/etc/hostname #进入etc下的hostname, directly write the name, permanent renaming;
To manually configure the IP address:
1. View the name of the network card identified by the command
[Email protected] ~]# NMCLI connection Show
Name
System eth0
2. Configure the IP address, subnet mask, gateway address (below is an entire command)
# NMCLI Connection Modify ' System eth0 ' ipv4.method manual #手动配置参数 ipv4.addresses ' 172.25.0.11/24 172 .25.0.254 '
Connection.autoconnect Yes #每次开机自动启用
3. Activating the network configuration
[[email protected] ~]# nmcli connection up ' System eth0 '
[Email protected] ~]# ifconfig
[Email protected] ~]# Cat/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0 #设备名
Bootproto=none #手动配置
Onboot=yes #每次开机自动启用
ipaddr0=172.25.0.11 #IP地址
Prefix0=24 #子网掩码
gateway0=172.25.0.254 #网关
4. Configure a permanent DNS server,/etc/resolv.conf
[[email protected] ~]# vim/etc/res (tab)
NameServer 8.8.8.8
or enter a command
# NMCLI Connection Modify ' System eth0 ' ipv4.method manual ipv4.dns ' 8.8.8.8 '
# NMCLI connection up ' System eth0 ' activation configuration
Linux commands (renaming, NIC configuration)