linux change the IP address (set static ip) and host name

Host Name: server0.example.com

ip address: 172.25.0.11

Network Mask: 255.255.255.0

Default Gateway: 172.25.0.254

Domain Name Server: 172.25.254.254

 

First, change the host name: temporary changes

        hostname server0.example.com   

        Permanent changes

        vim /etc/hostname(7.0 version)

            server0.example.com

        vim /etc/sysconfig/network  (6.0)

            server0.example.com

Second, change the static IP address: (ifcfg-eth0 is the name of the NIC)

  vim /etc/sysconfig/network-scripts/ifcfg-eth0

    

    BOOTPROTO static/none
    IPADDR 192.168.1.1
    PREFIX / NETMASK 24/255.255.255.0
    GATEWAY 192.168.1.254
    DNS1 202.106.0.20

  

  nmcli connection reload
 nmcli connection down "System eth0"
 nmcli connection up "System eth0"

 

Guess you like

Origin www.cnblogs.com/tslite/p/11882735.html