美文网首页Linux系统Linux学习|Gentoo/Arch/FreeBSD
Linux网络管理常用命令:net-tools VS iprou

Linux网络管理常用命令:net-tools VS iprou

作者: 孤逐王 | 来源:发表于2017-01-10 09:06 被阅读77次

    Exported from workflowy!

    http://blog.sina.com.cn/s/blog_15cbd38bb0102wprx.html
    http://www.cnblogs.com/wonux/p/6268134.html

    • net-tools
      • ifconfig
        "ifconfig命令:用于接口及地址查看和管理"
      • route
      • netstat
      • arp
    • iproute2
      • ip link help
      • ip addr help
      • ip route help
      • ss
      • ip neigh
    • 显示网卡接口信息
      • ifconfig -a
        "- ifconfig 显示已启用的网卡信息
        • ifconfig -a:显示所有接口,包括inactive状态的接口"
      • ifconfig eth0
        "显示eth0接口"
      • ip link [show]
        "显示所有连接的网络接口"
      • ip link show dev eht0
        "显示eth0接口"
    • 显示网络接口IP地址
      "要是有多个IP地址分配给了某个接口,iproute2就会显示所有IP地址,而net-tools只能显示一个IP地址"
      • ifconfig
      • ifconfig eht0
      • ip addr [show]
      • ip addr show dev eth0
        "显示网络接口IPv4地址"
      • ip -6 addr show dev eth0
        "显示网络接口IPv6地址"
    • 激活或禁止网络接口
      • ifconfig eth0 up/down
      • ip link set up/down eth0
    • 网络接口分配IPv4地址
      "注意:如果使用iproute2,你可以将多个IP地址分配给某个接口;如果换成ifconfig,就无法做到这点。就ifconfig而言,一个变通办法就是使用IP别名。"
      • ifconfig eth0 192.168.10.10/24
      • ifconfig eth0 192.168.10.10 netmask 255.255.255.0
      • ip addr add 192.168.10.10/24 dev eth0
    • 网络接口删除IPv4地址
      • ifconfig eth0 0
      • ip addr del 192.168.10.10/24 dev eth0
    • 更改网络接口的MAC地址
      • ifconfig eth0 hw ether 08:00:27:75:2a:66
      • ip link set dev eth0 address 08:00:27:75:2a:67
    • 查看IP路由表
      • route -n
      • netstat -rn
      • ip route [show]
    • 添加或修改默认路由
      "下面这些命令可以添加或改动内核IP路由表中的默认路由。要注意:如果使用net-tools,只要添加一个新的默认路由,就可以实现改动默认路由这个操作。如果使用iproute2,只需使用ip route replace命令。"
      • route add default gw 192.168.10.1 eth0
      • route del default gw 192.168.10.1 eth0
      • ip route add default via 192.168.10.1 dev eth0
      • ip route replace default via 192.168.10.1 dev eth0
    • 添加或删除静态路由
      • route add -net 172.14.32.0/24 gw 192.168.1.1 dev eth0
      • route del -net 172.14.32.0/24
      • ip route add 172.14.32.0/24 via 192.168.1.1 dev eth0
      • ip route del 172.14.32.0/24

    相关文章

      网友评论

        本文标题:Linux网络管理常用命令:net-tools VS iprou

        本文链接:https://www.haomeiwen.com/subject/culkbttx.html