ip - show / manipulate routing, devices, policy routing and tunnels ? ip [ OPTIONS ] OBJECT { COMMAND | help } OBJECT := { link | addr | route } ? ip link - network device configuration ? set dev IFACE 可设置属性: ? up and down:激活或禁用指定接口 ? ifup/ifdown ? show [dev IFACE]:指定接口 ? [up]:仅显示处于激活状态的接口
ip addr { add | del } IFADDR dev STRING ? [label LABEL]:添加地址时指明网卡别名 ? [scope {global|link|host}]:指明作用域 ? global: 全局可用 ? link: 仅链接可用 ? host: 本机可用 ? [broadcast ADDRESS]:指明广播地址
ip address show - look at protocol addresses ? [dev DEVICE] ? [label PATTERN] ? [primary and secondary]
ip address flush - 使用格式同show ? ip addr add 172.16.100.100/16 dev eth0 label eth0:0 ? ip addr del 172.16.100.100/16 dev eth0 label eth0:0 ? ip addr flush dev eth0 label eth0:0
ip route - routing table management 添加路由:ip route add ip route add TARGET via GW dev IFACE src SOURCE_IP TARGET: ? 主机路由:IP ? 网络路由:NETWORK/MASK ? ip route add 192.168.0.0/24 via 172.16.0.1 ? ip route add 192.168.1.13 via 172.16.0.1 ? 添加网关:ip route add default via GW dev IFACE ip route add default via 172.16.0.1 ? 删除路由:ip route del TARGET ? 显示路由:ip route show|list ? 清空路由表:ip route flush [dev IFACE] [via PREFIX] ? ip route flush dev eth0
ifconfig命令: ifconfig eth0:0 192.168.1.100/24 up ifconfig eth0:0 down
ip命令: ? ip addr add 172.16.1.2/16 dev eth0 ? ip addr add 172.16.1.1/16 dev eth0 label eth0:0 ? ip addr add 172.16.1.2/16 dev eth0 label eth0:0 ? ip addr del 172.16.1.1/16 dev eth0 label eth0:0 ? ip addr flush dev eth0 label eth0:0