天天看點

ifconfig-route-netstat

ifconfig指令

ifconfig -a

ifconfig eth0 [up|down]

ifconfig eth0 172.16.6.14/16 [up]

ifconfig eth0 172.16.6.14/16(16為子網路遮罩長度)

ifconfig eth0 172.16.6.14 netmask 255.255.0.0

注意:立即生效。

啟用混雜模式:[-]promisc

route指令

路由管理指令

檢視route -n

添加route add 

route add -host 192.168.1.44 gw 172.16.6.1 dev eth0(目标主機路由)

route add -net  192.168.0.0 netmask 255.255.255.0 gw 172.16.6.1 dev eth0

預設路由,網關:

route add -net 0.0.0.0 netmask 0.0.0.0 gw 172.16.6.1

route add default gw 172.16.6.1

route del -host 192.168.1.44

route del -net 192.168.0.0 netmask 255.255.255.0

DNS伺服器指定

/etc/resolv.cnfg

nameserver DNS_IP1

nameserver DNS_IP2

nameserver DNS_IP3

正解: FQDN-->IP

dig -t A FQDN

host -t A FQDN

反解:IP-->FQDN

dig -x IP

host -x IP

netstat:網絡狀态檢視指令

 netstat  - Print network connections, routing tables, interface statis-

       tics, masquerade connections, and multicast memberships

顯示網絡連接配接:

netstat -t

netstat -tn

netstat -atn

-t:tcp

-u:udp

-r:raw socket

-l:監聽

-a:所有狀态

-n:以數字格式顯示,不反解

-e:擴充格式的資訊

-p:顯示相關程序pid

常用組合:

-tan,-uan,-tnl ,-unl

顯示路由表

netstat -rn

顯示接口統計資料

netstat -i 

netstat -Ieth0

     本文轉自阿倫艾弗森 51CTO部落格,原文連結:http://blog.51cto.com/perper/1952602,如需轉載請自行聯系原作者

繼續閱讀