千家信息网

RHEL7中常用的网络命令有哪些

发表于:2025-11-07 作者:千家信息网编辑
千家信息网最后更新 2025年11月07日,这篇文章主要介绍了RHEL7中常用的网络命令有哪些,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。ping检查网络连通性ping 常常用
千家信息网最后更新 2025年11月07日RHEL7中常用的网络命令有哪些

这篇文章主要介绍了RHEL7中常用的网络命令有哪些,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。


ping检查网络连通性

ping 常常用来测试与目的主机的连通性。

可以ping通
[root@chao ~]# ping 172.16.1.254PING 172.16.1.254 (172.16.1.254) 56(84) bytes of data.64 bytes from 172.16.1.254: icmp_seq=1 ttl=128 time=0.529 ms64 bytes from 172.16.1.254: icmp_seq=2 ttl=128 time=0.297 ms64 bytes from 172.16.1.254: icmp_seq=3 ttl=128 time=0.135 ms64 bytes from 172.16.1.254: icmp_seq=4 ttl=128 time=0.245 ms64 bytes from 172.16.1.254: icmp_seq=5 ttl=128 time=0.214 ms^C--- 172.16.1.254 ping statistics ---5 packets transmitted, 5 received, 0% packet loss, time 4001msrtt min/avg/max/mdev = 0.135/0.284/0.529/0.133 ms[root@chao ~]#
不可以ping通
[root@chao ~]# ping 172.16.1.250PING 172.16.1.250 (172.16.1.250) 56(84) bytes of data.From 172.16.1.16 icmp_seq=1 Destination Host UnreachableFrom 172.16.1.16 icmp_seq=2 Destination Host UnreachableFrom 172.16.1.16 icmp_seq=3 Destination Host UnreachableFrom 172.16.1.16 icmp_seq=4 Destination Host UnreachableFrom 172.16.1.16 icmp_seq=5 Destination Host UnreachableFrom 172.16.1.16 icmp_seq=6 Destination Host UnreachableFrom 172.16.1.16 icmp_seq=7 Destination Host UnreachableFrom 172.16.1.16 icmp_seq=8 Destination Host Unreachable^C--- 172.16.1.250 ping statistics ---9 packets transmitted, 0 received, +8 errors, 100% packet loss, time 8003mspipe 4

配置网络

设置ip

[root@chao ~]# ifconfig ens33:1 172.16.1.114 netmask 255.255.255.0 up

更改MAC地址

[root@chao ~]# ifconfig ens33:1 hw ether 00:0c:29:0b:07:77

修改路由表

显示路由表

[root@chao ~]# route -nKernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface0.0.0.0         172.16.1.254    0.0.0.0         UG    100    0        0 ens33172.16.1.0      0.0.0.0         255.255.255.0   U     100    0        0 ens33192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

添加路由

[root@chao ~]# route add -net 172.16.2.0 netmask 255.255.255.0 gw 172.16.1.254

删除路由

[root@chao ~]# route del -net 172.16.2.0 netmask 255.255.255.0

查看网络状态

查看所有端口

[root@chao ~]# netstat -a|head -4Active Internet connections (servers and established)Proto Recv-Q Send-Q Local Address           Foreign Address         State      tcp        0      0 0.0.0.0:sunrpc          0.0.0.0:*               LISTEN    tcp        0      0 chao:domain             0.0.0.0:*               LISTEN

查看tcp端口

[root@chao ~]# netstat -atActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address           Foreign Address         State      tcp        0      0 0.0.0.0:sunrpc          0.0.0.0:*               LISTEN    tcp        0      0 chao:domain             0.0.0.0:*               LISTEN    tcp        0      0 0.0.0.0:ssh             0.0.0.0:*               LISTEN    tcp        0      0 localhos:x11-ssh-offset 0.0.0.0:*               LISTEN    tcp        0     36 chao:ssh                172.16.1.100:57418      ESTABLISHEDtcp6       0      0 [::]:sunrpc             [::]:*                  LISTEN    tcp6       0      0 [::]:ssh                [::]:*                  LISTEN    tcp6       0      0 localhos:x11-ssh-offset [::]:*                  LISTEN

查看udp端口

[root@chao ~]# netstat -auActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address           Foreign Address         State      udp        0      0 chao:domain             0.0.0.0:*                          udp        0      0 0.0.0.0:bootps          0.0.0.0:*                          udp        0      0 localhost:323           0.0.0.0:*                          udp6       0      0 localhost:323           [::]:*

traceroute查看路由信息

[root@chao ~]# traceroute to www.baidu.com (103.235.46.39), 30 hops max, 60 byte packets1  gateway (172.16.1.254)  0.132 ms  0.062 ms  0.086 ms2  * * *3  * * *4  * * *5  * * *6  * * *7  * * *8  * * *9  * * *10  * * *11  * * *12  * * *13  * * *14  * * *15  * * *16  * * *17  * * *18  * * *19  * * *20  * * *21  * * *22  * * *23  * * *24  * * *25  * * *26  * * *

telnet测试远程端口

[root@chao ~]# telnet 172.16.1.16 80

wget下载网络文件

[root@chao ~]# wget https://mirror.bit.edu.cn/apache/httpd/httpd-2.4.43.tar.gz


感谢你能够认真阅读完这篇文章,希望小编分享的"RHEL7中常用的网络命令有哪些"这篇文章对大家有帮助,同时也希望大家多多支持,关注行业资讯频道,更多相关知识等着你来学习!

网络 路由 端口 篇文章 命令 常用 测试 主机 价值 信息 兴趣 同时 地址 文件 更多 朋友 状态 目的 知识 编带 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 武汉宏川网络技术有限公司 查询数据库中所有空数据的表 都用什么开发数据库软件 达梦数据库修改表列名 只读模式数据库怎么查用户名 软件开发经理 招聘要求 特色数据库的意义 黄平软件开发技术 中国开发游戏的软件开发 万方数据库的密码怎么设置 lce服务器有什么用 我的世界国际2b2t服务器免费 考三级网络技术能用计算器吗 服务器流量防护超值 服务器选品牌还是组装 形容互联网科技 考试网络安全吗 丹阳素桶网络技术有限公司 我的世界微软登录无法连接服务器 江苏常规软件开发费用是多少 鑫宇科技互联网项目 永健互联网科技 广播电视网络安全保障工作总结 安卓数据库怎么开发 获取查询数据库的值 服务器流量防护超值 团支部网络安全宣传周活动 福建管理系统软件开发哪家好 常州技师分院计算机与网络技术 软件开发的成果是什么意思
0