當前位置:首頁 » 幣種行情 » ifconfigeth0del

ifconfigeth0del

發布時間: 2022-06-08 11:15:04

㈠ ifconfig配置ip

一、ifconfig與IP
1、ifconfig添加或修改原IP
ifconfig eth0 192.168.10.199 或
ifconfig eth0 192.168.10.199 netmask 255.255.255.0 up
ifconfig eth0:1 192.168.10.198 netmask 255.255.255.0 up

註:以上兩台效果是一樣的,上面一種寫法是下面一種寫法的減縮版。如果eth0上之前已經配置這IP,該配置會將原來的IP清掉,換成上面配置的IP,但在遠程ssh時最好不要使用該方法,因為網路環境不同。一旦更改不生效,就要跑到機房再進行配置。
2、禁用啟用網卡
ifconfig eth0 down
ifconfig eth0 up

該用法,是不是和ifup eth0、ifdown eth0:1很像?
註:當一塊網卡上配置多個IP時,如eth0、eth0:1時,如果禁掉eth0:1時,eth0上的網卡配置依然生效。但禁掉直接物理網卡口時(即eth0)時,其後面配置的IP (eth0:1等)都將被刪除掉。另外,ifconfig 還可以用於設置mtu和設置網卡的混雜模式:
ifconfig eth0 mtu 1472
利用netstat -i查看
將eth0設置成混雜模式
ifconfig eth0 promisc
取消混雜
ifconfig eth0 -promisc

3、修改網卡mac地址:
ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx

ifconfig查看的信息里,經常被我們忽視的第三行非常有用,如在沒有mii-tool工具時,可以通過其查看網卡連接狀態。
UP(代表網卡開啟狀態)RUNNING(代表網卡的網線被接上)MULTICAST(支持組播)MTU:1500(最大傳輸單元):1500位元組
二、ip命令與IP
ip是iproute2軟體包裡面的一個強大的網路配置工具,它能夠替代一些傳統的網路管理工具,例如ifconfig、route等,使用許可權為超級用戶。
1、ip命令添加一個IP地址:
[root@localhost ~]# ip addr add 192.168.10.198/24 dev eth0:1
[root@localhost ~]# ip addr add 192.168.10.199/24 dev eth0
[root@localhost ~]# ip -f inet addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
inet 192.168.10.26/24 brd 192.168.10.255 scope global eth0
inet 192.168.10.198/24 scope global secondary eth0
inet 192.168.10.199/24 scope global secondary eth0
[root@localhost ~]# ip addr add 192.168.10.200/24 dev eth0:3
[root@localhost ~]# ip -f inet addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
inet 192.168.10.26/24 brd 192.168.10.255 scope global eth0
inet 192.168.10.198/24 scope global secondary eth0
inet 192.168.10.199/24 scope global secondary eth0
inet 192.168.10.200/24 scope global secondary eth0

當然,上面的增加地址的寫法,我們也可以使用以下兩種方式增加,不過由於沒有上面的寫法容易記,我平時很少會用下面的方式增加:
ip addr add local 192.168.4.1/28 brd + label eth0:1 dev eth0
ip addr add 192.168.4.2/24 brd + dev eth1 label eth1:1

由上面的操作命令不難看出,隨便我們怎麼去添加IP,後面的設備名無論是eth0、eth0:1、eth0:100也好,其都不會將原網卡上綁定的地址給清掉。其通過ip addr show 顯示的出的結果都是secondary eth0 。
註:ip addr命令增加的IP ,不能通過ifconfig查看到,也不能通過ifconfig eth0:1 down 或ifdown eth0:1 這樣的方式停掉。
2、ip命令刪除一個IP
[root@localhost ~]# ip addr del 192.168.10.200
Not enough information: "dev" argument is required.
[root@localhost ~]# ip addr del 192.168.10.200 dev eth0
Warning: Executing wildcard deletion to stay compatible with old scripts.
Explicitly specify the prefix length (192.168.10.200/32) to avoid this warning.
This special behaviour is likely to disappear in further releases,
fix your scripts!
[root@localhost ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 40:61:86:98:95:05 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.26/24 brd 192.168.10.255 scope global eth0
inet 192.168.10.198/24 scope global secondary eth0
inet 192.168.10.199/24 scope global secondary eth0
inet6 fe80::4261:86ff:fe98:9505/64 scope link
valid_lft forever preferred_lft forever
3: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
[root@localhost ~]# ip addr del 192.168.10.199/24 dev eth0

在不加掩碼刪除時,其會提示警告,但還是可以將其地址刪掉。ip命令的用法比較多,就不一一列舉了。
三、路由配置
增加路由

route add -net 192.168.6.0/24 gw 192.168.101.254
route add default gw 192.168.101.254

查看路由
ip route list
route –n
netstat –r

四、總結
以上的ifconfig和ip命令配置的信息,重啟都會清除,想要永久生效,還是配置相關的配置文件。不過掌握命令配置方法很重要,在LVS+keepalive等架構上,浮動IP的變動,很多都是通過ip命令來完成的。

㈡ 解釋幾個嵌入式命令的含義:1、ifconfig eth0 192.168.5.153,精確點哈

1,配置eth0網路設備的ip為192.168.5.153
2,掛載nfs文件系統,192.168.5.151:/arm2401c1掛到/host
3,進入/host/temp這個目錄
4,裝載內核模塊。後面寫錯了吧?temp.ko
5,在/dev/temp下創建一個字元型設備文件,主設備號253,此設備號0

㈢ Linux怎麼設置IP,子網掩碼和網關

linux一般使用ifconfig命令修改linux主機的ip、網關或子網掩碼。 1.命令格式: ifconfig [網路設備] [參數] 2.命令功能: ifconfig 命令用來查看和配置網路設備。當網路環境發生改變時可通過此命令對網路進行相應的配置。 3.命令參數: up 啟動指定網路設備/網卡。 down 關閉指定網路設備/網卡。該參數可以有效地阻止通過指定介面的IP信息流,如果想永久地關閉一個介面,我們還需要從核心路由表中將該介面的路由信息全部刪除。 arp 設置指定網卡是否支持ARP協議。 -promisc 設置是否支持網卡的promiscuous模式,如果選擇此參數,網卡將接收網路中發給它所有的數據包 -allmulti 設置是否支持多播模式,如果選擇此參數,網卡將接收網路中所有的多播數據包 -a 顯示全部介面信息 -s 顯示摘要信息(類似於 netstat -i) add 給指定網卡配置IPv6地址 del 刪除指定網卡的IPv6地址 <硬體地址> 配置網卡最大的傳輸單元 mtu<位元組數> 設置網卡的最大傳輸單元 (bytes) netmask<子網掩碼> 設置網卡的子網掩碼。掩碼可以是有前綴0x的32位十六進制數,也可以是用點分開的4個十進制數。如果不打算將網路分成子網,可以不管這一選項;如果要使用子網,那麼請記住,網路中每一個系統必須有相同子網掩碼。 tunel 建立隧道 dstaddr 設定一個遠端地址,建立點對點通信 -broadcast<地址> 為指定網卡設置廣播協議 -pointtopoint<地址> 為網卡設置點對點通訊協議 multicast 為網卡設置組播標志 address 為網卡設置IPv4地址 txqueuelen<長度> 為網卡設置傳輸列隊的長度 4.使用實例: 實例1:顯示網路設備信息(激活狀態的) 命令: ifconfig 輸出: [root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:20 inet addr:192.168.120.204 Bcast:192.168.120.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8700857 errors:0 dropped:0 overruns:0 frame:0 TX packets:31533 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:596390239 (568.7 MiB) TX bytes:2886956 (2.7 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:68 errors:0 dropped:0 overruns:0 frame:0 TX packets:68 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2856 (2.7 KiB) TX bytes:2856 (2.7 KiB) 說明: eth0 表示第一塊網卡, 其中 HWaddr 表示網卡的物理地址,可以看到目前這個網卡的物理地址(MAC地址)是 00:50:56:BF:26:20 inet addr 用來表示網卡的IP地址,此網卡的 IP地址是 192.168.120.204,廣播地址, Bcast:192.168.120.255,掩碼地址Mask:255.255.255.0 lo 是表示主機的回壞地址,這個一般是用來測試一個網路程序,但又不想讓區域網或外網的用戶能夠查看,只能在此台主機上運行和查看所用的網路介面。比如把 HTTPD伺服器的指定到回壞地址,在瀏覽器輸入 127.0.0.1 就能看到你所架WEB網站了。但只是您能看得到,區域網的其它主機或用戶無從知道。 第一行:連接類型:Ethernet(乙太網)HWaddr(硬體mac地址) 第二行:網卡的IP地址、子網、掩碼 第三行:UP(代表網卡開啟狀態)RUNNING(代表網卡的網線被接上)MULTICAST(支持組播)MTU:1500(最大傳輸單元):1500位元組 第四、五行:接收、發送數據包情況統計 第七行:接收、發送數據位元組數統計信息。 實例2:啟動關閉指定網卡 命令: ifconfig eth0 up ifconfig eth0 down 輸出: 說明: ifconfig eth0 up 為啟動網卡eth0 ;ifconfig eth0 down 為關閉網卡eth0。ssh登陸linux伺服器操作要小心,關閉了就不能開啟了,除非你有多網卡。 實例3:為網卡配置和刪除IPv6地址 命令: ifconfig eth0 add 33ffe:3240:800:1005::2/64 ifconfig eth0 del 33ffe:3240:800:1005::2/64 輸出: 說明: ifconfig eth0 add 33ffe:3240:800:1005::2/64 為網卡eth0配置IPv6地址; ifconfig eth0 add 33ffe:3240:800:1005::2/64 為網卡eth0刪除IPv6地址; 練習的時候,ssh登陸linux伺服器操作要小心,關閉了就不能開啟了,除非你有多網卡。 實例4:用ifconfig修改MAC地址 命令: ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE 輸出: [root@localhost ~]# ifconfig eth0 down //關閉網卡 [root@localhost ~]# ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE //修改MAC地址 [root@localhost ~]# ifconfig eth0 up //啟動網卡 [root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:AA:BB:CC:DD:EE inet addr:192.168.120.204 Bcast:192.168.120.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8700857 errors:0 dropped:0 overruns:0 frame:0 TX packets:31533 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:596390239 (568.7 MiB) TX bytes:2886956 (2.7 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:68 errors:0 dropped:0 overruns:0 frame:0 TX packets:68 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2856 (2.7 KiB) TX bytes:2856 (2.7 KiB) [root@localhost ~]# ifconfig eth0 hw ether 00:50:56:BF:26:20 //關閉網卡並修改MAC地址 [root@localhost ~]# ifconfig eth0 up //啟動網卡 [root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:20 inet addr:192.168.120.204 Bcast:192.168.120.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8700857 errors:0 dropped:0 overruns:0 frame:0 TX packets:31533 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:596390239 (568.7 MiB) TX bytes:2886956 (2.7 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:68 errors:0 dropped:0 overruns:0 frame:0 TX packets:68 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2856 (2.7 KiB) TX bytes:2856 (2.7 KiB) 說明: 實例5:配置IP地址 命令: 輸出: [root@localhost ~]# ifconfig eth0 192.168.120.56 [root@localhost ~]# ifconfig eth0 192.168.120.56 netmask 255.255.255.0 [root@localhost ~]# ifconfig eth0 192.168.120.56 netmask 255.255.255.0 broadcast 192.168.120.255 說明: ifconfig eth0 192.168.120.56 給eth0網卡配置IP地:192.168.120.56 ifconfig eth0 192.168.120.56 netmask 255.255.255.0 給eth0網卡配置IP地址:192.168.120.56 ,並加上子掩碼:255.255.255.0 ifconfig eth0 192.168.120.56 netmask 255.255.255.0 broadcast 192.168.120.255 /給eth0網卡配置IP地址:192.168.120.56,加上子掩碼:255.255.255.0,加上個廣播地址: 192.168.120.255 實例6:啟用和關閉ARP協議 命令: ifconfig eth0 arp ifconfig eth0 -arp 輸出: [root@localhost ~]# ifconfig eth0 arp [root@localhost ~]# ifconfig eth0 -arp 說明: ifconfig eth0 arp 開啟網卡eth0 的arp協議; ifconfig eth0 -arp 關閉網卡eth0 的arp協議; 實例7:設置最大傳輸單元 命令: ifconfig eth0 mtu 1500 輸出: [root@localhost ~]# ifconfig eth0 mtu 1480 [root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:1F inet addr:192.168.120.203 Bcast:192.168.120.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1480 Metric:1 RX packets:8712395 errors:0 dropped:0 overruns:0 frame:0 TX packets:36631 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:597062089 (569.4 MiB) TX bytes:2643973 (2.5 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:9973 errors:0 dropped:0 overruns:0 frame:0 TX packets:9973 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:518096 (505.9 KiB) TX bytes:518096 (505.9 KiB) [root@localhost ~]# ifconfig eth0 mtu 1500 [root@localhost ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:1F inet addr:192.168.120.203 Bcast:192.168.120.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8712548 errors:0 dropped:0 overruns:0 frame:0 TX packets:36685 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:597072333 (569.4 MiB) TX bytes:2650581 (2.5 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:9973 errors:0 dropped:0 overruns:0 frame:0 TX packets:9973 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:518096 (505.9 KiB) TX bytes:518096 (505.9 KiB) [root@localhost ~]# 說明: 設置能通過的最大數據包大小為 1500 bytes 備註:用ifconfig命令配置的網卡信息,在網卡重啟後機器重啟後,配置就不存在。要想將上述的配置信息永遠的存的電腦里,那就要修改網卡的配置文件了。

㈣ Linux中ifconfig命令作用有哪些

linux中ifconfig命令屬於網路配置命令

ifconfig命令被用於配置和顯示Linux內核中網路介面的網路參數。用ifconfig命令配置的網卡信息,在網卡重啟後機器重啟後,配置就不存在。要想將上述的配置信息永遠的存的電腦里,那就要修改網卡的配置文件了。

語法
ifconfig(參數)

參數
add<地址>:設置網路設備IPv6的ip地址;
del<地址>:刪除網路設備IPv6的IP地址;
down:關閉指定的網路設備;
<hw<網路設備類型><硬體地址>:設置網路設備的類型與硬體地址;
io_addr<I/O地址>:設置網路設備的I/O地址;
irq<IRQ地址>:設置網路設備的IRQ;
media<網路媒介類型>:設置網路設備的媒介類型;
mem_start<內存地址>:設置網路設備在主內存所佔用的起始地址;
metric<數目>:指定在計算數據包的轉送次數時,所要加上的數目;
mtu<位元組>:設置網路設備的MTU;
netmask<子網掩碼>:設置網路設備的子網掩碼;
tunnel<地址>:建立IPv4與IPv6之間的隧道通信地址;
up:啟動指定的網路設備;
-broadcast<地址>:將要送往指定地址的數據包當成廣播數據包來處理;
-pointopoint<地址>:與指定地址的網路設備建立直接連線,此模式具有保密功能;
-promisc:關閉或啟動指定網路設備的promiscuous模式;
IP地址:指定網路設備的IP地址;
網路設備:指定網路設備的名稱。

使用功能示例

啟動關閉指定網卡:
ifconfig eth0 up
ifconfig eth0 down
ifconfig eth0 up為啟動網卡eth0,ifconfig eth0 down為關閉網卡eth0。ssh登陸linux伺服器操作要小心,關閉了就不能開啟了,除非你有多網卡。

為網卡配置和刪除IPv6地址:
ifconfig eth0 add 33ffe:3240:800:1005::2/64 #為網卡eth0配置IPv6地址
ifconfig eth0 del 33ffe:3240:800:1005::2/64 #為網卡eth0刪除IPv6地址

用ifconfig修改MAC地址:
ifconfig eth0 hw ether 00:AA:BB:CC:dd:EE

配置IP地址:
[root@localhost ~]# ifconfig eth0 192.168.2.10
[root@localhost ~]# ifconfig eth0 192.168.2.10 netmask 255.255.255.0
[root@localhost ~]# ifconfig eth0 192.168.2.10 netmask 255.255.255.0 broadcast 192.168.2.255

啟用和關閉arp協議:
ifconfig eth0 arp #開啟網卡eth0 的arp協議
ifconfig eth0 -arp #關閉網卡eth0 的arp協議

設置最大傳輸單元:
ifconfig eth0 mtu 1500 #設置能通過的最大數據包大小為 1500 bytes

㈤ Linux中要禁用網卡是:ifconfig eth0 down,那我使用:ifconfig ip地址 down可以嗎

不可以,ifconfig 後面必須加網卡名。你可以用ifdown etho來禁用網卡eth0,如果你的機器只有一塊網卡的,你還可以使用service network stop來禁掉網卡!如果是redhat linux的話,你還可以通過system-config-network把激活的eht0禁用。

㈥ linux下輸入ifconfig命令,沒有eth0,怎麼解決

重新打開eth0就行了

第一步:打開terminal,輸入cd /etc/sysconfig/network-scripts 進入目錄,輸入ifconfig -a命令,可以看到eth0和lo。

㈦ linux命令求解釋 ifconfig eth0 | awk -F':| +' '/Bcast/{print $4}'

將ifconfig
eth0的結果返回給awk處理
其中-F':|
+'
這個是awk定義分隔符,然後匹配「Bcast",取第四列的內容
由於你這個命令並不通用,所以沒法在我這里輸出結果,但是應該是截取廣播地址

㈧ Linux ip命令,可以不可以像ifconfig eth0 可以更改eth0的地址。

ip addr add 192.168.1.2/24 dev eth0
不過原來的ip地址還在,只是增加了一個新的ip地址。可以先刪除原來的ip再添加:
先 ip addr del 192.168.1.5/24 dev eth0
然後 ip addr add 192.168.1.2/24 dev eth0

㈨ 如何用linux命令修改linux主機ip網關子網掩碼

linux一般使用ifconfig命令修改linux主機的ip、網關或子網掩碼。
1.命令格式:
ifconfig [網路設備] [參數]
2.命令功能:
ifconfig 命令用來查看和配置網路設備。當網路環境發生改變時可通過此命令對網路進行相應的配置。
3.命令參數:
up 啟動指定網路設備/網卡。
down 關閉指定網路設備/網卡。該參數可以有效地阻止通過指定介面的IP信息流,如果想永久地關閉一個介面,我們還需要從核心路由表中將該介面的路由信息全部刪除。
arp 設置指定網卡是否支持ARP協議。
-promisc 設置是否支持網卡的promiscuous模式,如果選擇此參數,網卡將接收網路中發給它所有的數據包
-allmulti 設置是否支持多播模式,如果選擇此參數,網卡將接收網路中所有的多播數據包
-a 顯示全部介面信息
-s 顯示摘要信息(類似於 netstat -i)
add 給指定網卡配置IPv6地址
del 刪除指定網卡的IPv6地址
<硬體地址> 配置網卡最大的傳輸單元
mtu<位元組數> 設置網卡的最大傳輸單元 (bytes)
netmask<子網掩碼> 設置網卡的子網掩碼。掩碼可以是有前綴0x的32位十六進制數,也可以是用點分開的4個十進制數。如果不打算將網路分成子網,可以不管這一選項;如果要使用子網,那麼請記住,網路中每一個系統必須有相同子網掩碼。
tunel 建立隧道
dstaddr 設定一個遠端地址,建立點對點通信
-broadcast<地址> 為指定網卡設置廣播協議
-pointtopoint<地址> 為網卡設置點對點通訊協議
multicast 為網卡設置組播標志
address 為網卡設置IPv4地址
txqueuelen<長度> 為網卡設置傳輸列隊的長度
4.使用實例:
實例1:顯示網路設備信息(激活狀態的)
命令:
ifconfig
輸出:

[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:20
inet addr:192.168.120.204 Bcast:192.168.120.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8700857 errors:0 dropped:0 overruns:0 frame:0
TX packets:31533 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:596390239 (568.7 MiB) TX bytes:2886956 (2.7 MiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:68 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2856 (2.7 KiB) TX bytes:2856 (2.7 KiB)


說明:
eth0 表示第一塊網卡, 其中 HWaddr 表示網卡的物理地址,可以看到目前這個網卡的物理地址(MAC地址)是 00:50:56:BF:26:20
inet addr 用來表示網卡的IP地址,此網卡的 IP地址是 192.168.120.204,廣播地址, Bcast:192.168.120.255,掩碼地址Mask:255.255.255.0
lo 是表示主機的回壞地址,這個一般是用來測試一個網路程序,但又不想讓區域網或外網的用戶能夠查看,只能在此台主機上運行和查看所用的網路介面。比如把 HTTPD伺服器的指定到回壞地址,在瀏覽器輸入 127.0.0.1 就能看到你所架WEB網站了。但只是您能看得到,區域網的其它主機或用戶無從知道。
第一行:連接類型:Ethernet(乙太網)HWaddr(硬體mac地址)
第二行:網卡的IP地址、子網、掩碼
第三行:UP(代表網卡開啟狀態)RUNNING(代表網卡的網線被接上)MULTICAST(支持組播)MTU:1500(最大傳輸單元):1500位元組
第四、五行:接收、發送數據包情況統計
第七行:接收、發送數據位元組數統計信息。
實例2:啟動關閉指定網卡
命令:
ifconfig eth0 up
ifconfig eth0 down
輸出:
說明:
ifconfig eth0 up 為啟動網卡eth0 ;ifconfig eth0 down 為關閉網卡eth0。ssh登陸linux伺服器操作要小心,關閉了就不能開啟了,除非你有多網卡。

實例3:為網卡配置和刪除IPv6地址
命令:
ifconfig eth0 add 33ffe:3240:800:1005::2/64
ifconfig eth0 del 33ffe:3240:800:1005::2/64
輸出:
說明:
ifconfig eth0 add 33ffe:3240:800:1005::2/64 為網卡eth0配置IPv6地址;
ifconfig eth0 add 33ffe:3240:800:1005::2/64 為網卡eth0刪除IPv6地址;
練習的時候,ssh登陸linux伺服器操作要小心,關閉了就不能開啟了,除非你有多網卡。

實例4:用ifconfig修改MAC地址
命令:
ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE
輸出:

[root@localhost ~]# ifconfig eth0 down //關閉網卡
[root@localhost ~]# ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE //修改MAC地址
[root@localhost ~]# ifconfig eth0 up //啟動網卡
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:AA:BB:CC:DD:EE
inet addr:192.168.120.204 Bcast:192.168.120.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8700857 errors:0 dropped:0 overruns:0 frame:0
TX packets:31533 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:596390239 (568.7 MiB) TX bytes:2886956 (2.7 MiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:68 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2856 (2.7 KiB) TX bytes:2856 (2.7 KiB)
[root@localhost ~]# ifconfig eth0 hw ether 00:50:56:BF:26:20 //關閉網卡並修改MAC地址
[root@localhost ~]# ifconfig eth0 up //啟動網卡
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:20
inet addr:192.168.120.204 Bcast:192.168.120.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8700857 errors:0 dropped:0 overruns:0 frame:0
TX packets:31533 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:596390239 (568.7 MiB) TX bytes:2886956 (2.7 MiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:68 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2856 (2.7 KiB) TX bytes:2856 (2.7 KiB)

說明:


實例5:配置IP地址
命令:

輸出:

[root@localhost ~]# ifconfig eth0 192.168.120.56
[root@localhost ~]# ifconfig eth0 192.168.120.56 netmask 255.255.255.0
[root@localhost ~]# ifconfig eth0 192.168.120.56 netmask 255.255.255.0 broadcast 192.168.120.255

說明:
ifconfig eth0 192.168.120.56
給eth0網卡配置IP地:192.168.120.56
ifconfig eth0 192.168.120.56 netmask 255.255.255.0
給eth0網卡配置IP地址:192.168.120.56 ,並加上子掩碼:255.255.255.0
ifconfig eth0 192.168.120.56 netmask 255.255.255.0 broadcast 192.168.120.255
/給eth0網卡配置IP地址:192.168.120.56,加上子掩碼:255.255.255.0,加上個廣播地址: 192.168.120.255


實例6:啟用和關閉ARP協議
命令:
ifconfig eth0 arp
ifconfig eth0 -arp
輸出:

[root@localhost ~]# ifconfig eth0 arp
[root@localhost ~]# ifconfig eth0 -arp

說明:
ifconfig eth0 arp 開啟網卡eth0 的arp協議;
ifconfig eth0 -arp 關閉網卡eth0 的arp協議;


實例7:設置最大傳輸單元
命令:
ifconfig eth0 mtu 1500
輸出:

[root@localhost ~]# ifconfig eth0 mtu 1480
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:1F
inet addr:192.168.120.203 Bcast:192.168.120.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1480 Metric:1
RX packets:8712395 errors:0 dropped:0 overruns:0 frame:0
TX packets:36631 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:597062089 (569.4 MiB) TX bytes:2643973 (2.5 MiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:9973 errors:0 dropped:0 overruns:0 frame:0
TX packets:9973 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:518096 (505.9 KiB) TX bytes:518096 (505.9 KiB)

[root@localhost ~]# ifconfig eth0 mtu 1500
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:1F
inet addr:192.168.120.203 Bcast:192.168.120.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8712548 errors:0 dropped:0 overruns:0 frame:0
TX packets:36685 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:597072333 (569.4 MiB) TX bytes:2650581 (2.5 MiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:9973 errors:0 dropped:0 overruns:0 frame:0
TX packets:9973 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:518096 (505.9 KiB) TX bytes:518096 (505.9 KiB)

[root@localhost ~]#


說明:
設置能通過的最大數據包大小為 1500 bytes


備註:用ifconfig命令配置的網卡信息,在網卡重啟後機器重啟後,配置就不存在。要想將上述的配置信息永遠的存的電腦里,那就要修改網卡的配置文件了。

㈩ linux指令---ifconfig eth0 down,要如何解釋

eth0是指你的一塊網卡或者第一塊網卡,down停止的意思 ifconfig是列出網路信息的意思
這個命令是 禁用etho網卡 的意思

熱點內容
比特幣技術指標kdj 發布:2025-06-07 06:11:55 瀏覽:997
區塊鏈技術的特點是去中心化 發布:2025-06-07 05:53:24 瀏覽:934
以太坊交易所最小交易單位 發布:2025-06-07 05:51:45 瀏覽:216
區塊鏈代碼如何編寫 發布:2025-06-07 05:46:51 瀏覽:852
算力480多久能挖一個比特幣 發布:2025-06-07 05:33:53 瀏覽:817
一天能挖幾個以太坊幣 發布:2025-06-07 05:29:08 瀏覽:705
比特幣私鑰如何保密 發布:2025-06-07 05:14:31 瀏覽:375
比特幣區塊鏈民法中的貨幣 發布:2025-06-07 05:00:36 瀏覽:464
挖出比特幣是偶然還是必然 發布:2025-06-07 05:00:34 瀏覽:574
區塊鏈與大數據無關對m 發布:2025-06-07 04:57:53 瀏覽:939