首页 > 其他 > 详细

iproute2应用

时间:2019-03-29 18:03:52      阅读:140      评论:0      收藏:0      [点我收藏+]

linux目前都支持ip命令,与ifconfig类似,但ifconfig的软件net-tools早不更新了,ip功能更强大,推荐使用iproute2套件。

 技术分享图片

ip可以完美替换常用的网络命令,用法如下:

Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }

       ip [ -force ] -batch filename

where  OBJECT := { link | address | addrlabel | route | rule | neighbor | ntable |

                   tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |

                   netns | l2tp | fou | tcp_metrics | token | netconf }

       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |

                    -h[uman-readable] | -iec |

                    -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |

                    -4 | -6 | -I | -D | -B | -0 |

                    -l[oops] { maximum-addr-flush-attempts } | -br[ief] |

                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |

                    -rc[vbuf] [size] | -n[etns] name | -a[ll] |?-c[olor]}

常用命令如下:

ip link

ip addr show eth0

ip addr add 192.168.0.100/24 dev eth0

ip addr del 192.168.0.100/24 dev eth0

ip route show

ip route get 10.42.0.47 ;获取ip地址的路由包从哪里来

ip route add default via 192.168.0.100

ip neighbour     ;显示ARP MAC地址

ip link set ppp0 down     ;断开连接,相当于ifconfig ppp0 down

ip link set ppp0 up     ;连接,相当于ifconfig ppp0 up

ip route help   

注意IP地址要有一个后缀,比如/24。这种用法用于在无类域内路由选择(CIDR)中来显示所用的子网掩码。

 

参考:

https://linux.cn/article-3144-1.html

iproute2应用

原文:https://www.cnblogs.com/embedded-linux/p/10622726.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!