首頁 > 軟體

Linux教學:ifconfig 使用

2020-06-16 17:33:36

ifconfig

修改網絡卡的組態檔,預設選項和引數是檢視啟用狀態的網絡卡資訊

$ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:88:e3:e9:1f:2d  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:20102 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20102 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1897763 (1.8 MB)  TX bytes:1897763 (1.8 MB)

wlan0     Link encap:Ethernet  HWaddr e0:06:e6:cd:f8:cf  
          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::e206:e6ff:fecd:f8cf/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11539 errors:0 dropped:3 overruns:0 frame:0
          TX packets:7005 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3352856 (3.3 MB)  TX bytes:891096 (891.0 KB)

說明:
eth0, wlan0 #網絡卡名
lo 主機環迴地址
Link encap#連線型別
HWaddr #HardWareaddress,即MAC地址
inet addr #ip地址
Bcast #廣播地址
Mask #子網掩碼
$ifconfig [網絡卡名] [選項] [引數]
add [地址] #設定ip地址
del [地址] #刪除ip地址
up #啟動網路裝置
down #關閉網路裝置
hw [裝置型別] [硬體地址] # 設定網路裝置的型別與硬體地址
irq[IRQ地址] # 設定網路裝置的IRQ
netmask [子網掩碼] # 設定子網掩碼
broadcast [廣播地址] # 設定廣播地址

本文永久更新連結地址http://www.linuxidc.com/Linux/2016-09/135151.htm


IT145.com E-mail:sddin#qq.com