Linux ifconfig命令 配置網路介面

2021-10-02 13:20:36 字數 1639 閱讀 8839

ifconfig 命令最主要的作用就是檢視 ip 位址的資訊,直接輸入ifconfig命令即可。

[root@localhost ~]# ifconfig

eth0 link encap:ethernet hwaddr 00:oc:29:c5:fb:aa #eth0網絡卡資訊 網路型別為乙太網 mac位址

inet addr:192.168.44.3 beast:192.168.44.255 mask:255.255.255.0

#ip位址 廣播位址 子網掩碼

inet6 addr: fe80::20c:29ff:fec5:fbaa/64 scope:link #ipv6的位址(目前不生效)

up broadcast running multicast mtu:1500 metric:1 #網路引數  最大傳輸單元資料報轉送次數

rx packets:881 errors:0 dropped:0 overruns:0 frame:0

#接收到的資料報惰況

tx packets:8s3 errors:0 dropped:0 overruns:0 carrier:0

#傳送的資料報情況

collisions:0 txqueuelen:1000

#資料報碰撞 資料緩衝區長度

rx bytes:82229 (80.3 kib) tx bytes:273463 (267.0 kib)

#接收包的大小 傳送包的大小

interrupt:19 base address:0x2000

#irq中街 記憶體位址

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:12 errors:0 dropped:0 overruns:0 frame:0

tx packets:12 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0

rx bytes:840 (840.0 b) tx bytes:840 (840.0 b)

ifconfig 命令主要用於檢視 ip 位址、子網掩碼和 mac 位址這三類資訊,其他資訊我們有所了解即可。

lo 網絡卡是 loopback 的縮寫,也就是本地回環網絡卡,這個網絡卡的 ip 位址是 127.0.0.1。它只代表我們的網路協議正常,就算不插入網線也可以 ping 通,所以基本沒有實際使用價值,大家了解一下即可。

ifconfig 命令除可以檢視 ip 位址之外,還可以臨時配置 ip 位址,但是一旦重啟,ip 位址就會失效,所以我們還是應該使用 setup 命令進行 ip 位址配置。使用 ifconfig 命令臨時配置 ip 位址的示例如下:

[root@localhost ~]#ifconfig eth0 192.168.44.3

#配置ip位址,不指定子網掩碼就會使用標準子網掩碼

[root@localhost ~]#ifconfig eth0 192.168.44.3 netmask 255.255.255.0

#配置ip位址,同時配置子網掩碼

初學linux ifconfig 命令

linux下網絡卡命名規律 eth0,eth1。第一塊乙太網卡,第二塊。lo為環迴介面,它的ip位址固定為127.0.0.1,掩碼8位。它代表你的機器本身。1 ifconfig是檢視網絡卡的資訊。ifconfig inte ce inte ce是可選項,如果不加此項,則顯示系統中所有網絡卡的資訊。如...

linux ifconfig命令使用詳解

linux下網絡卡命名規律 eth0,eth1。第一塊乙太網卡,第二塊。lo為環迴介面,它的ip位址固定為127.0.0.1,掩碼8位。它代表你的機器本身。1 ifconfig是檢視網絡卡的資訊。ifconfig inte ce inte ce是可選項,如果不加此項,則顯示系統中所有網絡卡的資訊。如...

linuxifconfig命令配置ip位址

linux下網絡卡命名規律 eth0,eth1。第一塊乙太網卡,第二塊。lo為環迴介面,它的ip位址固定為127.0.0.1,掩碼8位。它代表你的機器本身。ifconfig inte ce 是檢視網絡卡的資訊 如果不加引數檢視的是所有的網絡卡資訊 加上引數eth0的話是檢視eth0網絡卡的資訊 網絡...