-Linux—常见的抛错和校验方法

1 timeout 超时

ping ip      windows电脑cmd中ping
ping hostname     Linux中ping

正确IP显示
在这里插入图片描述
错误IP显示
在这里插入图片描述

2.connection refused 拒绝

win
先在 Windows 控制面板 删除程序 打开或关闭windows功能 选择 telnet 打√

telnet ip port               windows电脑cmd中ping

下图所示正常
在这里插入图片描述
在这里插入图片描述

Linux

[root@hadoop001 ~]# yum install telnet 先安装
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
–> Running transaction check
—> Package telnet.x86_64 1:0.17-48.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

===================================================================================
Package Arch Version Repository Size

Installing:
telnet x86_64 1:0.17-48.el6 base 58 k

Transaction Summary

Install 1 Package(s)

Total download size: 58 k
Installed size: 109 k
Is this ok [y/N]: y
Downloading Packages:
telnet-0.17-48.el6.x86_64.rpm | 58 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:telnet-0.17-48.el6.x86_64 1/1
Verifying : 1:telnet-0.17-48.el6.x86_64 1/1

Installed:
telnet.x86_64 1:0.17-48.el6

Complete!
[root@hadoop001 ~]#which telnet
/usr/bin/telnet
[root@hadoop001 ~]# telnet 106.75.103.178 80
Trying 106.75.103.178…
Connected to 106.75.103.178.
Escape character is ‘^]’. 这个代表正常的

[root@hadoop001 ~]# telnet 106.75.103.178 81
Trying 106.75.103.178...
telnet: connect to address 106.75.103.178: Connection timed out    报错  拒绝

3 报错unknown host 找不到机器名称,映射关系没有配置

[root@hadoop001 ~]# ping hadoop001
ping: unknown host hadoop001    报错

linux 配置

root@hadoop001 ~]# vi /etc/hosts    
106.75.103.178 hadoop001    编辑内容
[root@hadoop001 ~]# ping hadoop001
PING hadoop001 (106.75.103.178) 56(84) bytes of data.
64 bytes from hadoop001 (106.75.103.178): icmp_seq=1 ttl=58 time=2.01 ms
64 bytes from hadoop001 (106.75.103.178): icmp_seq=2 ttl=58 time=1.50 ms
64 bytes from hadoop001 (106.75.103.178): icmp_seq=3 ttl=58 time=1.47 ms
64 bytes from hadoop001 (106.75.103.178): icmp_seq=4 ttl=58 time=1.49 ms
64 bytes from hadoop001 (106.75.103.178): icmp_seq=5 ttl=58 time=1.46 ms
64 bytes from hadoop001 (106.75.103.178): icmp_seq=6 ttl=58 time=1.40 ms
^C
--- hadoop001 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5244ms
rtt min/avg/max/mdev = 1.400/1.558/2.018/0.214 ms
[root@hadoop001 ~]# 
[root@hadoop001 ~]# service httpd status
httpd (pid  14179) is running...

Windows 配置
C:\Windows\System32\drivers\etc
注意 没有权限修改,直接复制一份桌面上,修改:106.75.103.178 hadoop001 后 拖拽 覆盖即可
在这里插入图片描述

4报错 not found

which XXX  一下

5 ls: cannot open directory /root: Permission denied 报错:权限不够

解决方案:有sudo权限的普通用户,执行root权限

[root@hadoop001 ~]# vi /etc/sudoers 进入编辑
Allow root to run any commands anywhere
root ALL=(ALL) ALL
ruoze2 ALL=(root) NOPASSWD:ALL 照上进行编辑内容
ruoze1 ALL=(root) NOPASSWD:ALL
ruoze3 ALL=(root) NOPASSWD:ALL
chenqian ALL=(root) NOPASSWD:ALL

[root@hadoop001 ~]# su - chenqian

[chenqian@hadoop001 ~]$ sudo ls -l /root sudo执行root权限
total 84
-rw-r–r-- 1 root root 2 Jun 20 06:49 1
drwxr-xr-x 3 root root 4096 Mar 15 00:31 1.
-rw-r–r-- 1 root root 259 Jun 21 12:24 123.log
drwxr-xr-x 2 root root 4096 Jun 20 18:32 20180620
drwxr-xr-x 3 root root 4096 Jun 18 12:38 20190618
drwxr-xr-x 3 root root 4096 Jun 20 22:42 chenqian
drwxr-xr-x 7 root root 4096 Mar 17 22:39 chenxiaoer
drwxr-xr-x 2 root root 4096 Mar 16 23:31 chenyi
drwxr-xr-x 2 root root 4096 Mar 14 23:19 d
drwxr-xr-x 2 root root 4096 Jun 21 12:20 d66
drwxr-xr-x 2 root root 4096 Mar 17 22:56 root
drwxr-xr-x 3 root root 4096 Mar 19 02:44 ruoze
drwxr-xr-x 2 root root 4096 Jun 19 06:37 ruozedata
-rw-r–r-- 1 root root 0 Jun 18 22:38 tail1.log
-rw-r–r-- 1 root root 8 Jun 18 22:39 tail1.log1
-rw-r–r-- 1 root root 17 Jun 18 22:55 tail22.log
-rw-r–r-- 1 root root 3 Jun 18 22:52 tail22.log1
-rw-r–r-- 1 root root 4 Jun 18 22:41 tail2.log
-rw-r–r-- 1 root root 8 Jun 18 22:41 tail2.log1
-rw-r–r-- 1 root root 8 Jun 18 22:40 tail2.log2
drwxr-xr-x 7 root root 4096 Mar 16 23:11 test
drwxr-xr-x 2 root root 4096 Mar 21 02:07 win

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值