linux设置ip别名

修改文件

# vi  /etc/hosts

添加地址和别名

192.168.222.126  s1   ##前面是机器ip,后面是别名

测试

[root@bogon /]# ping s1
PING s1 (192.168.222.126) 56(84) bytes of data.
64 bytes from s1 (192.168.222.126): icmp_seq=1 ttl=64 time=0.204 ms
64 bytes from s1 (192.168.222.126): icmp_seq=2 ttl=64 time=0.955 ms
64 bytes from s1 (192.168.222.126): icmp_seq=3 ttl=64 time=0.882 ms
64 bytes from s1 (192.168.222.126): icmp_seq=4 ttl=64 time=0.583 ms

 

posted @ 2018-08-02 14:43  天涯已可  阅读(1798)  评论(0编辑  收藏  举报