您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關(guān)Linux常用命令ifconfig怎么用的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
ifconfig [網(wǎng)絡(luò)設(shè)備][down up -allmulti -arp -promisc][add][del][][io_addr][irq][media][mem_start][metric][mtu][netmask][tunnel][-broadcast][-pointopoint][IP地址]
參數(shù)說明:
add 設(shè)置網(wǎng)絡(luò)設(shè)備IPv6的IP地址。
del 刪除網(wǎng)絡(luò)設(shè)備IPv6的IP地址。
down 關(guān)閉指定的網(wǎng)絡(luò)設(shè)備。
io_addr 設(shè)置網(wǎng)絡(luò)設(shè)備的I/O地址。
irq
media 設(shè)置網(wǎng)絡(luò)設(shè)備的媒介類型。
mem_start 設(shè)置網(wǎng)絡(luò)設(shè)備在主內(nèi)存所占用的起始地址。
metric 指定在計算數(shù)據(jù)包的轉(zhuǎn)送次數(shù)時,所要加上的數(shù)目。
mtu 設(shè)置網(wǎng)絡(luò)設(shè)備的MTU。
netmask 設(shè)置網(wǎng)絡(luò)設(shè)備的子網(wǎng)掩碼。
tunnel 建立IPv4與IPv6之間的隧道通信地址。
up 啟動指定的網(wǎng)絡(luò)設(shè)備。
-broadcast 將要送往指定地址的數(shù)據(jù)包當(dāng)成廣播數(shù)據(jù)包來處理。
-pointopoint 與指定地址的網(wǎng)絡(luò)設(shè)備建立直接連線,此模式具有保密功能。
-promisc 關(guān)閉或啟動指定網(wǎng)絡(luò)設(shè)備的promiscuous模式。
[IP地址] 指定網(wǎng)絡(luò)設(shè)備的IP地址。
[網(wǎng)絡(luò)設(shè)備] 指定網(wǎng)絡(luò)設(shè)備的名稱。
顯示網(wǎng)絡(luò)設(shè)備信息
# ifconfig eth0 Link encap:Ethernet HWaddr 00:50:56:0A:0B:0C inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::250:56ff:fe0a:b0c/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:172220 errors:0 dropped:0 overruns:0 frame:0 TX packets:132379 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:87101880 (83.0 MiB) TX bytes:41576123 (39.6 MiB) Interrupt:185 Base address:0x2024 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:16436 Metric:1 RX packets:2022 errors:0 dropped:0 overruns:0 frame:0 TX packets:2022 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2459063 (2.3 MiB) TX bytes:2459063 (2.3 MiB)
啟動關(guān)閉指定網(wǎng)卡
# ifconfig eth0 down # ifconfig eth0 up
為網(wǎng)卡配置和刪除IPv6地址
# ifconfig eth0 add 33ffe:3240:800:1005::2/ 64 //為網(wǎng)卡設(shè)置IPv6地址 # ifconfig eth0 del 33ffe:3240:800:1005::2/ 64 //為網(wǎng)卡刪除IPv6地址
用ifconfig修改MAC地址
# ifconfig eth0 down //關(guān)閉網(wǎng)卡 # ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE //修改MAC地址 # ifconfig eth0 up //啟動網(wǎng)卡 # ifconfig eth2 hw ether 00:1D:1C:1D:1E //關(guān)閉網(wǎng)卡并修改MAC地址 # ifconfig eth2 up //啟動網(wǎng)卡
配置IP地址
# ifconfig eth0 192.168.1.56 //給eth0網(wǎng)卡配置IP地址 # ifconfig eth0 192.168.1.56 netmask 255.255.255.0 // 給eth0網(wǎng)卡配置IP地址,并加上子掩碼 # ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255 // 給eth0網(wǎng)卡配置IP地址,加上子掩碼,加上個廣播地址
啟用和關(guān)閉ARP協(xié)議
# ifconfig eth0 arp //開啟 # ifconfig eth0 -arp //關(guān)閉
設(shè)置最大傳輸單元
# ifconfig eth0 mtu 1500 //設(shè)置能通過的最大數(shù)據(jù)包大小為 1500 bytes
感謝各位的閱讀!關(guān)于“Linux常用命令ifconfig怎么用”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。