随着服务器的增多,网络环境越来越复杂,linux网管变得越来越重要。接下来介绍linux网管命令,提高运维效率。Ping检查网络连通性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.297ms64来自172.16.1.254的字节:icmp_seq=3ttl=128time=0.135ms64来自172.16.1.254的字节:icmp_seq=4ttl=128time=0.245ms64bytes11.254:icmp_seq=5ttl=128time=0.214ms^C---172.16.1.254pingstatistics---5包发送,5包接收,0%丢包,时间4001msrttmin/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=5DestinationHostUnreachable16.16.1.16.172.estinationHostUnreachableFrom172.16.1.16icmp_seq=7DestinationHostUnreachableFrom172.16.1.16icmp_seq=8DestinationHostUnreachable^C---172.16.1.250pingstatistics---9数据包传输,0接收,+1etlross,包错误,时间8003mspipe4配置网络设置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.215.2gw[4deleteroute4root@chao~]#routedel-net172.16.2.0netmask255.255.255.0查看网络状态查看所有端口[root@chao~]#netstat-a|head-4A主动互联网连接(服务器和已建立)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:*监听tcp000.0.0.0:ssh0.0.0.0:*监听tcp00localhos:x11-ssh-offset0.0.0.0:*监听tcp036chao:ssh172.16.1.100:57418ESTABLISHEDtcp600[::]:sunrpc[::]:*监听tcp600[::]: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*远程远程登录port[root@chao~]#telnet172.16.1.1680wget下载网络文件[root@chao~]#wgethttps://mirror.bit.edu.cn/apa...
