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
- ifconfig
- iproute2
- ip link help
- ip addr help
- ip route help
- ss
- ip neigh
- 顯示網(wǎng)卡接口信息
- ifconfig -a
"- ifconfig 顯示已啟用的網(wǎng)卡信息- ifconfig -a:顯示所有接口,包括inactive狀態(tài)的接口"
- ifconfig eth0
"顯示eth0接口" - ip link [show]
"顯示所有連接的網(wǎng)絡(luò)接口" - ip link show dev eht0
"顯示eth0接口"
- ifconfig -a
- 顯示網(wǎng)絡(luò)接口IP地址
"要是有多個(gè)IP地址分配給了某個(gè)接口蔗衡,iproute2就會(huì)顯示所有IP地址兢孝,而net-tools只能顯示一個(gè)IP地址"- ifconfig
- ifconfig eht0
- ip addr [show]
- ip addr show dev eth0
"顯示網(wǎng)絡(luò)接口IPv4地址" - ip -6 addr show dev eth0
"顯示網(wǎng)絡(luò)接口IPv6地址"
- 激活或禁止網(wǎng)絡(luò)接口
- ifconfig eth0 up/down
- ip link set up/down eth0
- 網(wǎng)絡(luò)接口分配IPv4地址
"注意:如果使用iproute2,你可以將多個(gè)IP地址分配給某個(gè)接口愧膀;如果換成ifconfig,就無法做到這點(diǎn)。就ifconfig而言壹店,一個(gè)變通辦法就是使用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
- 網(wǎng)絡(luò)接口刪除IPv4地址
- ifconfig eth0 0
- ip addr del 192.168.10.10/24 dev eth0
- 更改網(wǎng)絡(luò)接口的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]
- 添加或修改默認(rèn)路由
"下面這些命令可以添加或改動(dòng)內(nèi)核IP路由表中的默認(rèn)路由求泰。要注意:如果使用net-tools,只要添加一個(gè)新的默認(rèn)路由计盒,就可以實(shí)現(xiàn)改動(dòng)默認(rèn)路由這個(gè)操作渴频。如果使用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
- 添加或刪除靜態(tài)路由
- 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