Linux commands (renaming, NIC configuration)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.