配置Linux網絡屬性:ip命令
阿新 • • 發佈:2019-03-28
via lis strong fff size route add default mman routing 1. ip命令
show / manipulate routing, devices, policy routing and tunnels
show / manipulate routing, devices, policy routing and tunnels
ip [ OPTIONS ] OBJECT { COMMAND | help }
OBJECT := { link | address | route}
1)link: network device.
list 用ip命令顯示網絡設備的運行狀態
show [dev IFace]指定接口顯示
[up]僅顯示處於激活狀態的接口
set dev IFACE 可設置屬性的UP/DOWN
2) addr: (address)
- protocol (IP or IPv6) address on a device.
ip addr {add|del} IFADDR dev IFNAME
添加|刪除 地址 設備名
ip address {save|flush} [ dev IFNAME ] [ scope SCOPE-ID ][ label LABEL ] [up] flush:清空 [label LABEL] 添加地址時指明網卡別名 [ scope {global|link|host}] 指明作用域 global:全局有效(默認) link:僅鏈接有效 host:本機有效 IFADDR := [ broadcast ADDR ] 指明廣播地址 ip address [ show [ dev IFNAME ] [ label LABEL ] [up] ]
3)route: routing table entry.
ip route { add | del } ROUTE
(1) ip route add
添加路由:ip route add TARGET via GW dev IFace src source_ip
TARGET: 主機路由 ip
網絡路由 network/mask
添加網關:ip route add default via GW dev IFACE
(2) ip route delete
刪除路由: ip route del TARGET
(3) ip route flush 清空
[dev IFACE]
配置Linux網絡屬性:ip命令