您好,登錄后才能下訂單哦!
ifconfig 命令
顯示網絡所有接口 ifconfig -a
-bash-3.2$ ifconfig -a
en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
inet 99.99.99.35 netmask 0xffffff00 broadcast 99.99.99.255
tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
en1: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
inet 99.99.99.89 netmask 0xffffff00 broadcast 99.99.99.255
tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
lo0: flags=e08084b<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT>
inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
inet6 ::1/0
tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1
只顯示網絡接口,不帶其它信息。ifconfig -l
-bash-3.2# ifconfig -l
en0 en1 lo0
關閉與啟動網絡接口 ifconfig en1 up/down
-bash-3.2# ifconfig en1 down
-bash-3.2# ifconfig en1 up
查看已啟動的網絡接口
-bash-3.2# ifconfig -au
en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
inet 99.99.99.35 netmask 0xffffff00 broadcast 99.99.99.255
tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
lo0: flags=e08084b<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT>
inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
inet6 ::1/0
tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1
-bash-3.2# ifconfig -lu
en0 lo0
查看已關閉的網絡接口
-bash-3.2# ifconfig -ad
en1: flags=1e080862,480<BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
inet 99.99.99.89 netmask 0xffffff00 broadcast 99.99.99.255
tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
-bash-3.2# ifconfig -ld
en1
-bash-3.2# netstat -in #帶*號的顯示為關閉的網絡接口,此命令可以查看本機的IP地址
Name Mtu Network Address ZoneID Ipkts Ierrs Opkts Oerrs Coll
en0 1500 link#2 ee.cb.f0.2.30.2 - 477369 0 24513 0 0
en0 1500 99.99.99 99.99.99.35 - 477369 0 24513 0 0
en1* 1500 link#3 ee.cb.f0.2.30.3 - 2539 0 84 0 0
en1* 1500 99.99.99 99.99.99.89 - 2539 0 84 0 0
lo0 16896 link#1 - 93601 0 93608 0 0
lo0 16896 127 127.0.0.1 - 93601 0 93608 0 0
lo0 16896 ::1 0 93601 0 93608 0 0
可以使用ping命令測試網絡的連通性
ping -c 5 99.99.99.35
netstat 命令
顯示網絡接口的格式,是否有多錯誤的數據包。
-bash-3.2$ netstat -i
Name Mtu Network Address ZoneID Ipkts Ierrs Opkts Oerrs Coll
en0 1500 link#2 ee.cb.f0.2.30.2 - 478409 0 24611 0 0
en0 1500 99.99.99 peng2012 - 478409 0 24611 0 0
en1* 1500 link#3 ee.cb.f0.2.30.3 - 2539 0 84 0 0
en1* 1500 99.99.99 99.99.99.89 - 2539 0 84 0 0
lo0 16896 link#1 - 93767 0 93774 0 0
lo0 16896 127 loopback - 93767 0 93774 0 0
lo0 16896 ::1 0 93767 0 93774 0 0
顯示本機的路由表
-bash-3.2$ netstat -rn
Routing tables
Destination Gateway Flags Refs Use If Exp Groups
Route Tree for Protocol Family 2 (Internet):
99.99.99.0 99.99.99.35 UHSb 0 0 en0 - - =>
99.99.99.0 99.99.99.89 UHSb 0 0 en1 - - =>
99.99.99/24 99.99.99.35 U 1 20417 en0 - - =>
99.99.99/24 99.99.99.89 U 0 53 en1 - -
99.99.99.35 127.0.0.1 UGHS 1 509 lo0 - -
99.99.99.89 127.0.0.1 UGHS 0 17 lo0 - -
99.99.99.255 99.99.99.35 UHSb 0 4 en0 - - =>
99.99.99.255 99.99.99.89 UHSb 0 0 en1 - -
127/8 127.0.0.1 U 13 93148 lo0 - -
顯示本機所開啟服務netstat -a (顯示套接字,不顯示端口號)
netstat -a
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp 0 0 *.* *.* CLOSED
tcp 0 0 *.* *.* CLOSED
tcp4 0 0 *.* *.* CLOSED
tcp4 0 0 *.daytime *.* LISTEN
tcp 0 0 *.ftp *.* LISTEN
tcp4 0 0 *.ssh *.* LISTEN
tcp 0 0 *.telnet *.* LISTEN
tcp4 0 0 *.smtp *.* LISTEN
tcp4 0 0 *.time *.* LISTEN
tcp4 0 0 *.sunrpc *.* LISTEN
tcp 0 0 *.smux *.* LISTEN
tcp 0 0 *.exec *.* LISTEN
tcp 0 0 *.login *.* LISTEN
tcp 0 0 *.shell *.* LISTEN
tcp 0 0 *.rmc *.* LISTEN
tcp4 0 0 *.writesrv *.* LISTEN
tcp 0 0 *.5335 *.* LISTEN
tcp 0 0 *.5336 *.* LISTEN
tcp 0 0 *.wbem-htt *.* LISTEN
tcp 0 0 *.wbem-htt *.* LISTEN
tcp 0 0 *.6988 *.* LISTEN
......
顯示本機所開啟服務(顯示端口號) netstat -an
netstat -an
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp 0 0 *.* *.* CLOSED
tcp 0 0 *.* *.* CLOSED
tcp4 0 0 *.* *.* CLOSED
tcp4 0 0 *.13 *.* LISTEN
tcp 0 0 *.21 *.* LISTEN
tcp4 0 0 *.22 *.* LISTEN
tcp 0 0 *.23 *.* LISTEN
tcp4 0 0 *.25 *.* LISTEN
tcp4 0 0 *.37 *.* LISTEN
tcp4 0 0 *.111 *.* LISTEN
tcp 0 0 *.199 *.* LISTEN
tcp 0 0 *.512 *.* LISTEN
tcp 0 0 *.513 *.* LISTEN
tcp 0 0 *.514 *.* LISTEN
tcp 0 0 *.657 *.* LISTEN
tcp4 0 0 *.1334 *.* LISTEN
tcp 0 0 *.5335 *.* LISTEN
tcp 0 0 *.5336 *.* LISTEN
tcp 0 0 *.5988 *.* LISTEN
tcp 0 0 *.5989 *.* LISTEN
tcp 0 0 *.6988 *.* LISTEN
.....
顯示本機的端口號21是否開啟
netstat -an|grep 21.
設置主機IP地址 smit mktcpip (smit tcpip再進一步選擇)
Minimum Configuration & Startup
To Delete existing configuration data, please use Further Configuration menus
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[TOP] [Entry Fields]
* HOSTNAME [peng2012]
* Internet ADDRESS (dotted decimal) [99.99.99.35]
Network MASK (dotted decimal) [255.255.255.0]
* Network INTERFACE en0
NAMESERVER
Internet ADDRESS (dotted decimal) []
DOMAIN Name []
Default Gateway
Address (dotted decimal or symbolic name) []
Cost [] #
Do Active Dead Gateway Detection? no +
[MORE...2]
F1=Help F2=Refresh F3=Cancel F4=List
F5=Reset F6=Command F7=Edit F8=Image
F9=Shell F10=Exit Enter=Do
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。