2024年9月iproute(ip route 0.0.0.0.0.0.0.0 是什么意思)
⑴iproute(iproute.......是什么意思
⑵可以通过给接口添加label标识解决:????????????》》》ipaddradd?.../devenslabel?ens:??##给接口添加IP的同时添加标签????????????》》》ipaddrdel.../devens??##删除接口ens上的IP地址.../????????????????????????》》》ipaddrflushens????????????????????????》》》ipaddrlist?ens????????????????????????????????????:ens:《BROADCAST,MULTICAST,UP,LOWER_UP》mtuqdiscmqstateUPqlen????????????????????????????????????link/ether:::a::brdff:ff:ff:ff:ff:ff????.ip?route????????????ip-route-routingtablemanagement?:管理路由表???????iproute{add|del|change|append|replace}?ROUTE???????????iproute?{show|list}?:查看路由表???????????iprouteflush?:清空路由表???????iprouteadd:添加路由????????????格式:iprouteaddTARGET/MASKvia?NEXTHOP?dev?IFACE?????????????????????eg:??》》》iprouteadd.../via...devens???????????iproutedel?:?删除路由表????????????格式:iproutedel??TARGET/MASK??????????????????????eg:?》》》iproutedel.../??????》》》iprouteflush?./???##清空./网段的路由???????????》》》iprouteflush???##清空路由表??????》》》iprouteshow????##查看路由表,可是ip就直接可能给一个网卡加很多IPipaddraddIP/掩码dev网卡名ipaddraddIP/掩码dev网卡名route命令只能在缺省的路由表中添加路由route对于策略路由无能为力iprouteadd网络via网关dev网卡table然后ipruleaddfromIPtable这样设置后,同时使用ipdefault-work和iproute......双方设定默认路由时,则iproute......指定的表项成为默认路由,一个接口可以添加多个地址??????????ipaddr?{show|list}????##查看接口的IP地址信息???????????????????ipaddrdel?IFADDR?devIFNAME???????????ipaddrflush???##清空接口上的IP地址??????????eg:????????????》》》ipaddradd.../devens???##为接口添加第一个IP地址????????????????????》》》ipaddrlistens????????????????????????????????????????????:ens:《BROADCAST,MULTICAST,UP,LOWER_UP》mtuqdiscmqstateUPqlen??????????????????????????link/ether:::a::brdff:ff:ff:ff:ff:ff??????????????i.../scopeglobalens??????????????valid_lftforeverpreferred_lftforever??????????????????????????ife::d:ac:a:efd/scopelink???????????????????????????valid_lftforeverpreferred_lftforever????????????????????》》》ipaddradd.../devens???##为接口添加第二个IP地址????????????????????》》》ipaddrshowens???????????????:ens:《BROADCAST,MULTICAST,UP,LOWER_UP》mtuqdiscmqstateUPqlen??????????????????????????link/ether:::a::brdff:ff:ff:ff:ff:ff??????????????????????????i.../scopeglobalens??????????????valid_lftforeverpreferred_lftforever??????????????????????????i.../scopeglobalens???????????????????????valid_lftforeverpreferred_lftforever??????????????????????????ife::d:ac:a:efd/scopelink??????????????valid_lftforeverpreferred_lftforever????????注意:ifconfg命令无法查到第二个及以上的IP地址信息,第组...是这一网络上使用的地址掩码其实这个命令并专不完全,route可以添加默认网关到ethrouteadddefaultgw...deveth,安装包名为:iproute-..-.el.x_????、ip命令ip-show/manipulaterouting,devices,policyroutingandtunnels.查询/管理路由表、设备、策略路由等;ipOBJECT{MAND|help}OBJECT:={link|address|route|ns}OBJECT:????.???ip-address-protocoladdressmanagement???????????????????ipaddress{MAND|help}???????????ipaddress{add|change|replace}IFADDRdevIFNAME?:为接口IFNAME添加IP地址。
⑶iproute.......是什么意思
⑷默认路由,仅当只有一条可用路径时才配。iproute是配置静百态路由度?。第一组...是目标地址而他用通配符表示,第组...是这一网络上使用的地址掩码其实这个命令并专不完全,因为还缺少希望到达下一属跳的地址位置。
⑸当路由器上的iprouting无效时,使用它指定默认路由,用于RXBoot模式(noiprouting下安装IOS等。或者关闭iprouting让路由器当主机用,此时需要配置默认网关。另外此命令常用于二层交换机上,因为在二层交换机上没有第三层路由表项。
⑹两者都用于iprouting有效的路由器上,区别主要在于路由协议是否传播这条路由信息。比如:IGRP无法识别...,因此传播默认路由时必须用ipdefault-work。
⑺当用ipdefault-work指令设定多条默认路由时,administrativedistance最短的成为最终的默认路由;如果有复数条路由distance值相等,那么在路由表(showiproute中靠上的成为默认路由。
⑻同时使用ipdefault-work和iproute......双方设定默认路由时,如果ipdefault-work设定的网络是直连(静态、且已知的,那么它就成为默认路由;如果ipdefault-work指定的网络是由交换路由信息得来的,则iproute......指定的表项成为默认路由。
⑼iproute家族命令
⑽iproute家族命令中常用的有:ip和ss命令。????安装包名为:iproute-..-.el.x_????、ip命令ip-show/manipulaterouting,devices,policyroutingandtunnels.查询/管理路由表、设备、策略路由等;ipOBJECT{MAND|help}OBJECT:={link|address|route|ns}OBJECT:????.???ip-address-protocoladdressmanagement???????????????????ipaddress{MAND|help}???????????ipaddress{add|change|replace}IFADDRdevIFNAME?:为接口IFNAME添加IP地址,一个接口可以添加多个地址??????????ipaddr?{show|list}????##查看接口的IP地址信息???????????????????ipaddrdel?IFADDR?devIFNAME???????????ipaddrflush???##清空接口上的IP地址??????????eg:????????????》》》ipaddradd.../devens???##为接口添加第一个IP地址????????????????????》》》ipaddrlistens????????????????????????????????????????????:ens:《BROADCAST,MULTICAST,UP,LOWER_UP》mtuqdiscmqstateUPqlen??????????????????????????link/ether:::a::brdff:ff:ff:ff:ff:ff??????????????i.../scopeglobalens??????????????valid_lftforeverpreferred_lftforever??????????????????????????ife::d:ac:a:efd/scopelink???????????????????????????valid_lftforeverpreferred_lftforever????????????????????》》》ipaddradd.../devens???##为接口添加第二个IP地址????????????????????》》》ipaddrshowens???????????????:ens:《BROADCAST,MULTICAST,UP,LOWER_UP》mtuqdiscmqstateUPqlen??????????????????????????link/ether:::a::brdff:ff:ff:ff:ff:ff??????????????????????????i.../scopeglobalens??????????????valid_lftforeverpreferred_lftforever??????????????????????????i.../scopeglobalens???????????????????????valid_lftforeverpreferred_lftforever??????????????????????????ife::d:ac:a:efd/scopelink??????????????valid_lftforeverpreferred_lftforever????????注意:ifconfg命令无法查到第二个及以上的IP地址信息,可以通过给接口添加label标识解决:????????????》》》ipaddradd?.../devenslabel?ens:??##给接口添加IP的同时添加标签????????????》》》ipaddrdel.../devens??##删除接口ens上的IP地址.../????????????????????????》》》ipaddrflushens????????????????????????》》》ipaddrlist?ens????????????????????????????????????:ens:《BROADCAST,MULTICAST,UP,LOWER_UP》mtuqdiscmqstateUPqlen????????????????????????????????????link/ether:::a::brdff:ff:ff:ff:ff:ff????.ip?route????????????ip-route-routingtablemanagement?:管理路由表???????iproute{add|del|change|append|replace}?ROUTE???????????iproute?{show|list}?:查看路由表???????????iprouteflush?:清空路由表???????iprouteadd:添加路由????????????格式:iprouteaddTARGET/MASKvia?NEXTHOP?dev?IFACE?????????????????????eg:??》》》iprouteadd.../via...devens???????????iproutedel?:?删除路由表????????????格式:iproutedel??TARGET/MASK??????????????????????eg:?》》》iproutedel.../??????》》》iprouteflush?./???##清空./网段的路由???????????》》》iprouteflush???##清空路由表??????》》》iprouteshow????##查看路由表?,route-n?/stat-rn?????????????????????defaultvia...devens????????????????????.../devensprotokernelscopelinksrc...metric??????????.../devensprotokernelscopelinksrc...metric???.ip?link:?Manageanddisplaythestateofallwork?interfaces???????iplink:??displaythestateofallwork?interfaces;????????????????????????iplinkshowdevIFACE:DisplayinformationonlyfordeviceIFACE????????????ip-slink:Displayinterfacestatistics/显示接口数据统计??????ip?linkset:Alterthestatusoftheinterface/改变接口状态????????????????????????iplinksetIFACEup:BringIFACEonline/启用接口????????????????????????iplinksetIFACEdown:BringIFACEoffline/禁用接口????????????iplinksetIFACEmtu:SettheMTUonIFACEto/设置mtu值????????????iplinksetIFACEpromiscon:EnablepromiscuousmodeforIFACE/启用接口IFACE的混杂模式、ss命令:anotherutilitytoinvestigatesockets.????ss???????????????-t,--tcp:DisplayTCPsockets.????????????????-u,--udp:DisplayUDPsockets.????????????????-w,--raw:DisplayRAWsockets.????????????????-n,--numeric:数字显示结果????????????????-a,--all:Displaybothlisteningandnon-listening(forTCPthismeansestablished????????????????????????????connections)sockets.????????????????-l,--listening:Displayonlylisteningsockets(theseareomittedbydefault).????????????????-o,--options:Showtimerinformation.????????????????-e,--extended:Showdetailedsocketinformation????????????????-m,--memory:Showsocketmemoryusage.????????????????-p,--processes:Showprocessusingsocket????????????????????????????????????????STATE-FILTER:????????????????????????????????LISTEN:监听????????????????????????????????ESTABLISHED:建立的连接????????????????????????????????FIN_WAIT_????????????????????????????????FIN_WAIT_????????????????????????????????SYN_SENT????????????????????????????????SYN_RECV????????????????????????????????CLOSED????????????????????????????????closing?????????????????all?????????????????......????????????常用查询组合:????????????????ss-nultp?????????????????ss-tan????????????????ss-uaneg:》》》ss-nutp?##选出已建立的连接????????id?State???Recv-QSend-Q??????????????????LocalAddress:Port?????????????????????????PeerAddress:Port????????tcp??ESTAB??????????????????????????...:???????????????????????????...:???????users:((“sshd“,pid=,fd=))????????tcp??ESTAB??????????????????????????...:???????????????????????????...:???????users:((“sshd“,pid=,fd=))》》》ss-tstate?established??##选出处于已建立的TCP连接》》》ss-ostateestablished’(dport=:sshorsport=:ssh)’?##选出已建立的ssh连接
⑾iproute和route命令的区别
⑿简单一点说,ip功能更强举例:ifconfig只能给网卡加一个IP,如果要加多个IP,需要用alias,可是ip就直接可能给一个网卡加很多IPipaddraddIP/掩码dev网卡名ipaddraddIP/掩码dev网卡名route命令只能在缺省的路由表中添加路由route对于策略路由无能为力iprouteadd网络via网关dev网卡table然后ipruleaddfromIPtable这样设置后,从IP来的数据包都通过路由表查找路由。另外,route可以添加默认网关到ethrouteadddefaultgw...deveth