百科解釋
linux中對網卡進行編輯的命令. 無論是Linux 自動安裝還是我們手工安裝,Linux 都會向你詢問有關網絡的問題并配置相關的軟件。這個用于配置網卡的基本命令就是ifconfig。 在執(zhí)行ifconfig 命令后,系統(tǒng)將在內核表中設置必要的參數,這樣Linux 就知道如何與網絡上的網卡通信。ifconfig 命令有以下兩種格式: ※ifconfig [interface] ※ifconfig interface [aftype] option | address … ifconfig 的第一種格式(或使用不帶任何參數的ifconfig 命令)可以用來查看當前系統(tǒng)的網絡配置情況。 在剛剛安裝完系統(tǒng)之后,實際上是在沒有網卡或者網絡連接的情況下使用Linux,但通過ifconfig 可以使用回繞方式工作,使計算機認為自己工作在網絡上。 現在我們運行一下ifconfig 命令,不帶參數的ifconfig 命令可以顯示當前啟動的網絡接口,其輸出結果為: [root@machine1 /sbin]#ifconfig eth0 Link encap:Ethernet Hwaddr 52:54:AB:DD:6F:61 inet addr:210.34.6.89 Bcast:210.34.6.127 Mask:255.255.255.128 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:46299 errors:0 dropped:0 overruns:0 frame:189 TX packets:3057 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 Interrupt:5 Base address:0xece0 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:3924 Metric:1 RX packets:44 errors:0 dropped:0 overruns:0 frame:0 TX packets:44 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 其中以eth0 為首的部分是本機的以太網卡配置參數,這里顯示了網卡在下的設備名/dev/eth0 和硬件的MAC 地址52:54:AB:DD:6F:61,MAC 地址是生產廠家定的,每個網卡擁有的唯一地址。 不過我們可以手工改動網卡的MAC 地址,只要我們在/etc/rc.d/init.d/中的network 中加入: ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx Jiania 解說注: eth0,eth1,eth2,代表網卡一,網卡二,網卡三 hw 代表hardware 硬件意思 ether 代表ethernet 以太網的意思 然后重啟,此時再用ifconfig 命令查看一下,我們就會發(fā)現網卡的MAC 地址已經變成xx:xx:xx:xx:xx:xx了。 后繼 常用網卡ip設置方法: 直接通過setup 進行設置。 配置多個網卡 ifconfig -a 查看網絡設備 eth0 / eth1 / lo (回路)。 ifconfig eth1 //設備1 ifconfig eth1 192.168.1.10 netmask 255.255.255.0 //設置網卡子網及ip man ifconfig ifconfig --help(T002) 命令
移動通信網 | 通信人才網 | 更新日志 | 團隊博客 | 免責聲明 | 關于詞典 | 幫助