[Svc]linux's IP command operation interface and routing table

Source: Internet
Author: User

Reference: https://www.tecmint.com/ip-command-examples/

Learn the configuration IP of Linux, configure the gateway, add routes and other commands

man ipman ip addressman ip routeip address help可简写ip a s
Operations & Viewing interfaces
- 查看所有接口ip+macip a- 查看eth0的ip+macip a s eth0- 给一个接口设置多个ip(ip addr add)ip a a 12.1.1.1/24 dev eth0ip a a 13.1.1.1/24 dev eth0- 删除一个接口的ipip a d 13.1.1.1/24 dev eth0- 持久化配置到文件(wr)ip address save 1> b.txtip address restore < b.txt## 开关接口(shu/no shu) ip link set eth0 up ip link set eth0 down
Operation Routing
- 查看arp表和路由表ip neiip r参考: https://serverfault.com/questions/63014/ip-address-scope-parameter/63018scope SCOPE_VALUE    global - the address is globally valid.(大多数是这样的)    link - the address is link local, i.e. it is valid only on this device.(如一个子网的广播地址)    host - the address is valid only inside this host. (127.0.0.1)- 添加默认路由ip route add default via 192.168.1.1 dev eth0- 指定下一跳ip route add 30.1.1.0/24 via 15.1.1.1- 指定下一跳和出接口ip route add 30.1.1.0/24 via 15.1.1.1 dev eth0 - 检测某个目的ip从哪个口出去$ ip route get 172.17.0.2172.17.0.2 dev docker0  src 172.17.0.1 $ ip route get 8.8.8.88.8.8.8 via 192.168.14.2 dev eth0  src 192.168.14.133
Command comparison

Reference

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

[Svc]linux's IP command operation interface and routing table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.