您好,登錄后才能下訂單哦!
這篇文章主要介紹“Linux中如何使用fconfig命令”的相關(guān)知識,小編通過實際案例向大家展示操作過程,操作方法簡單快捷,實用性強,希望這篇“Linux中如何使用fconfig命令”文章能幫助大家解決問題。
Linux ifconfig命令用于顯示或設(shè)置網(wǎng)絡(luò)設(shè)備。ifconfig可設(shè)置網(wǎng)絡(luò)設(shè)備的狀態(tài),或是顯示目前的設(shè)置。
ifconfig
如果網(wǎng)卡被關(guān)閉了則不會被顯示出來。
ifconfig -a
ifconfig -s
ifconfig [網(wǎng)卡名稱] //例:ifconfig enp0s3
hrx@@@:~$ ifconfig enp0s3 Link encap:Ethernet HWaddr 08:00:27:bd:61:3c inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::7035:2dfa:8d80:ea7e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:4 errors:0 dropped:0 overruns:0 frame:0 TX packets:115 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:930 (930.0 B) TX bytes:14560 (14.5 KB) Interrupt:19 Base address:0xd020 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:32 errors:0 dropped:0 overruns:0 frame:0 TX packets:32 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2386 (2.3 KB) TX bytes:2386 (2.3 KB)
這里以 enp0s3 網(wǎng)卡為例。當網(wǎng)卡被關(guān)閉后使用 ifconfig 是不會顯示出來的。
//啟動enp0s3網(wǎng)卡 sudo ifconfig enp0s3 up //關(guān)閉enp0s3網(wǎng)卡 sudo ifconfig enp0s3 down
這里以 enp0s3 網(wǎng)卡為例。 ARP協(xié)議是地址解析協(xié)議(Address Resolution Protocol),每臺主機或路由器都維護著一份ARP緩存表(ARP table),這個表包含IP地址到MAC地址的映射關(guān)系,表中記錄了
//啟動enp0s3網(wǎng)卡的ARP協(xié)議 sudo ifconfig enp0s3 arp //關(guān)閉enp0s3網(wǎng)卡的ARP協(xié)議 sudo ifconfig enp0s3 -arp
這里以 enp0s3 網(wǎng)卡為例。 子網(wǎng)掩碼換算: 24 與 255.255.255.0 是相等的,24意思是按二進制算,從左開始的24位全部取1,其余為0。 即 11111111 11111111 11111111 00000000,也就是255.255.255.0
//修改網(wǎng)卡 enp0s3 的 IPv4地址 sudo ifconfig enp0s3 10.0.2.16 //修改網(wǎng)卡 enp0s3 的 IPv4地址及子網(wǎng)掩碼,方法一 sudo ifconfig enp0s3 10.0.2.16/24 //修改網(wǎng)卡 enp0s3 的 IPv4地址及子網(wǎng)掩碼,方法二 sudo ifconfig enp0s3 10.0.2.16 netmask 255.255.255.0
這里以 enp0s3 網(wǎng)卡為例。 相當于給網(wǎng)卡再配置一個IP地址。
sudo ifconfig enp0s3:0 10.0.2.16/24 sudo ifconfig enp0s3:1 10.0.2.17/24 sudo ifconfig enp0s3:2 10.0.2.18/24
這里以 enp0s3 網(wǎng)卡為例。 注意:需要將網(wǎng)卡down掉后才能設(shè)置,否則會提示 “SIOCSIFHWADDR: 設(shè)備或資源忙 – you may need to down the interface”
//修改網(wǎng)卡的MAC地址 sudo ifconfig enp0s3 hw ether 08:00:27:bd:61:3d
這里以 enp0s3 網(wǎng)卡為例。 單位是字節(jié)。
//設(shè)置網(wǎng)卡的最大傳輸單元 sudo ifconfig enp0s3 mtu 1480
這里以 enp0s3 網(wǎng)卡為例。
//增加網(wǎng)卡的IPv6地址 sudo ifconfig enp0s3 add fe80::7035:2dfa:8d80:ea7d/64 //刪除網(wǎng)卡的IPv6地址 sudo ifconfig enp0s3 del fe80::7035:2dfa:8d80:ea7d/64
關(guān)于“Linux中如何使用fconfig命令”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識,可以關(guān)注億速云行業(yè)資訊頻道,小編每天都會為大家更新不同的知識點。
免責聲明:本站發(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)容。