RHEL7中常用的网络命令有哪些
这篇文章主要介绍了RHEL7中常用的网络命令有哪些,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
ping 常常用来测试与目的主机的连通性。
可以ping通[root@chao~]#ping172.16.1.254PING172.16.1.254(172.16.1.254)56(84)bytesofdata.64bytesfrom172.16.1.254:icmp_seq=1ttl=128time=0.529ms64bytesfrom172.16.1.254:icmp_seq=2ttl=128time=0.297ms64bytesfrom172.16.1.254:icmp_seq=3ttl=128time=0.135ms64bytesfrom172.16.1.254:icmp_seq=4ttl=128time=0.245ms64bytesfrom172.16.1.254:icmp_seq=5ttl=128time=0.214ms^C---172.16.1.254pingstatistics---5packetstransmitted,5received,0%packetloss,time4001msrttmin/avg/max/mdev=0.135/0.284/0.529/0.133ms[root@chao~]#不可以ping通
[root@chao~]#ping172.16.1.250PING172.16.1.250(172.16.1.250)56(84)bytesofdata.From172.16.1.16icmp_seq=1DestinationHostUnreachableFrom172.16.1.16icmp_seq=2DestinationHostUnreachableFrom172.16.1.16icmp_seq=3DestinationHostUnreachableFrom172.16.1.16icmp_seq=4DestinationHostUnreachableFrom172.16.1.16icmp_seq=5DestinationHostUnreachableFrom172.16.1.16icmp_seq=6DestinationHostUnreachableFrom172.16.1.16icmp_seq=7DestinationHostUnreachableFrom172.16.1.16icmp_seq=8DestinationHostUnreachable^C---172.16.1.250pingstatistics---9packetstransmitted,0received,+8errors,100%packetloss,time8003mspipe4配置网络
设置ip
[root@chao~]#ifconfigens33:1172.16.1.114netmask255.255.255.0up
更改MAC地址
[root@chao~]#ifconfigens33:1hwether00:0c:29:0b:07:77
修改路由表
显示路由表
[root@chao~]#route-nKernelIProutingtableDestinationGatewayGenmaskFlagsMetricRefUseIface0.0.0.0172.16.1.2540.0.0.0UG10000ens33172.16.1.00.0.0.0255.255.255.0U10000ens33192.168.122.00.0.0.0255.255.255.0U000virbr0
添加路由
[root@chao~]#routeadd-net172.16.2.0netmask255.255.255.0gw172.16.1.254
删除路由
[root@chao~]#routedel-net172.16.2.0netmask255.255.255.0查看网络状态
查看所有端口
[root@chao~]#netstat-a|head-4ActiveInternetconnections(serversandestablished)ProtoRecv-QSend-QLocalAddressForeignAddressStatetcp000.0.0.0:sunrpc0.0.0.0:*LISTENtcp00chao:domain0.0.0.0:*LISTEN
查看tcp端口
[root@chao~]#netstat-atActiveInternetconnections(serversandestablished)ProtoRecv-QSend-QLocalAddressForeignAddressStatetcp000.0.0.0:sunrpc0.0.0.0:*LISTENtcp00chao:domain0.0.0.0:*LISTENtcp000.0.0.0:ssh0.0.0.0:*LISTENtcp00localhos:x11-ssh-offset0.0.0.0:*LISTENtcp036chao:ssh172.16.1.100:57418ESTABLISHEDtcp600[::]:sunrpc[::]:*LISTENtcp600[::]:ssh[::]:*LISTENtcp600localhos:x11-ssh-offset[::]:*LISTEN
查看udp端口
[root@chao~]#netstat-auActiveInternetconnections(serversandestablished)ProtoRecv-QSend-QLocalAddressForeignAddressStateudp00chao:domain0.0.0.0:*udp000.0.0.0:bootps0.0.0.0:*udp00localhost:3230.0.0.0:*udp600localhost:323[::]:*traceroute查看路由信息
[root@chao~]#traceroutetowww.baidu.com(103.235.46.39),30hopsmax,60bytepackets1gateway(172.16.1.254)0.132ms0.062ms0.086ms2***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~]#telnet172.16.1.1680wget下载网络文件
[root@chao~]#wgethttps://mirror.bit.edu.cn/apache/httpd/httpd-2.4.43.tar.gz
感谢你能够认真阅读完这篇文章,希望小编分享的“RHEL7中常用的网络命令有哪些”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。