配置IP和主机名映射

1. 修改主机名字hostname
[note1@localhost]$ sudo vi /etc/sysconfig/network

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for note1:#在这里输入密码
#Created by anaconda
HOSTNAME=note(添加这一行)
#添加上面的这行文字然后按ctrl+c,输入":wq"按enter建退出
~
~
~
"/etc/hosts" 5L, 221C written
[note1@localhost]$su - root (获取root权限)
Password: (输入root的密码)
Last login: Wed Sep 26 07:14:35 ADT 2018 on pts/0
[root@localhost~]# hostname note(执行)
[root@localhost~]# su - note1
Last login: Wed Sep 26 07:15:37 ADT 2018 on pts/0
[note1@note~]$
2. 修改ip地址与主机名映射
[note1@note ~]$ sudo vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.16.100 note1(添加这一行,当然你也可以添加多台主机名的映射)
~
~

"/etc/hosts" 3L, 179C written
[note1@note ~]$ ping note1(最后ping就能ping到了)
PING note1 (192.168.16.100) 56(84) bytes of data.
64 bytes from note1 (192.168.16.100): icmp_seq=1 ttl=64 time=0.090 ms
64 bytes from note1 (192.168.16.100): icmp_seq=2 ttl=64 time=0.035 ms
64 bytes from note1 (192.168.16.100): icmp_seq=3 ttl=64 time=0.035 ms
64 bytes from note1 (192.168.16.100): icmp_seq=4 ttl=64 time=0.035 ms
64 bytes from note1 (192.168.16.100): icmp_seq=5 ttl=64 time=0.069 ms
64 bytes from note1 (192.168.16.100): icmp_seq=6 ttl=64 time=0.036 ms
64 bytes from note1 (192.168.16.100): icmp_seq=7 ttl=64 time=0.058 ms
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值