ifconfigeth1
A. linux只有一個網卡 用ifconfig顯示網卡eth1 在network-sricpt中只有ifcfg-eth0
一般來說,如果只有一個網卡的話是不會出現兩個eth的,默認情況下只有eth0,而你這個eth1跟eth0不是一個硬體,沒有eth1這個硬體的話,ifup eth1肯定是沒反應的。
B. linux怎麼查eth1網卡是否啟動,求口令
1、ifconfig看下,能看到eth1代表啟動著,順便看下ip地址是否配置正確。
2、ifconfig功能說明:顯示或設置網路設備
語法:ifconfig [網路設備][down up -allmulti -arp -promisc][add<地址>][del<地址>][<硬體地址>] [media<網路媒介類型>][mem_start<內存地址>][metric<數目>][mtu<位元組>][netmask<子網掩碼>][tunnel<地址>][-broadcast<地址>] [-pointopoint<地址>]
補充說明:ifconfig可設置網路設備的狀態,或是顯示目前的設置。
參數:
[網路設備] 網路設備的名稱。
down 關閉指定的網路設備。
up 啟動指定的網路設備。
-arp 打開或關閉指定介面上使用的ARP協議。前面加上一個負號用於關閉該選項。
-allmuti 關閉或啟動指定介面的無區別模式。前面加上一個負號用於關閉該選項。
-promisc 關閉或啟動指定網路設備的promiscuous模式。前面加上一個負號用於關閉該選項。
add<地址> 設置網路設備IPv6的IP地址。
del<地址> 刪除網路設備IPv6的IP地址。
media<網路媒介類型> 設置網路設備的媒介類型。
mem_start<內存地址> 設置網路設備在主內存所佔用的起始地址。
metric<數目> 指定在計算數據包的轉送次數時,所要加上的數目。
mtu<位元組> 設置網路設備的MTU。
netmask<子網掩碼> 設置網路設備的子網掩碼。
tunnel<地址> 建立IPv4與IPv6之間的隧道通信地址。
-broadcast<地址> 將要送往指定地址的數據包當成廣播數據包來處理。
-pointopoint<地址> 與指定地址的網路設備建立直接連線,此模式具有保密功能。
C. 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
D. linux怎麼查eth1網卡是否啟動,求口令
1、ethtool命令
ethtool eth1
2、mii-tool命令
mii-tool em1
em1: negotiated 1000baseT-FD flow-control, link ok
mii-tool em3
em3: no link
3、ip addr
4、ifconfig eth1也可以看出來,啟動後有RUNNING字樣
E. linux下,用ifconfig後,看到有eth0,還有eth0:1,請問eth0:1是什麼意思
eth0:1是eth0的分ip存儲文件
分ip存儲文件格式為ifcfg-eth0:X
X為任意正整數(包括0)
具體作用是實現單網卡多ip
類似與windows的多ip
F. linux系統中ifconfig命令 幫忙分析哈 看不懂
Linux操作系統Ifconfig命令詳細解析無論是Linux 自動安裝還是我們手工安裝,Linux 都會向你詢問有關網路的問題並配置相關的軟體。這個用於配置網卡的基本命令就是ifconfig。 在執行ifconfig 命令後,系統將在內核表中設置必要的參數,這樣Linux 就知道如何與網路上的網卡通信。ifconfig 命令有以下兩種格式: ※ifconfig [interface] ※ifconfig interface [aftype] option | address … ifconfig 的第一種格式(或使用不帶任何參數的ifconfig 命令)可以用來查看當前系統的網路配置情況。 在剛剛安裝完系統之後,實際上是在沒有網卡或者網路連接的情況下使用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 然後重啟,此時再用ifconfig 命令查看一下,我們就會發現網卡的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)
G. watch ifconfig中的 eth1 lo是什麼意思呢
eth1,網卡名
lo 網路回環設備,一個虛擬的網路介面,127.0.0.1
H. 電腦輸入ifconfig -a後出現mmy0、eth0、eth1、lo這幾項是什麼都
eth0 eth1
eth表示本機乙太網卡,0表示網卡1--一般是有線網卡,1表示網卡2---一般是無線網卡
lo表示localhost
mmy是一個虛擬網路設備,來幫助本地網路配置IP的。0就表示1號虛擬網路設備
mmy的概念比較生僻。涉及到一些現在不太常用的概念PPP,SLIP Address等
I. 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命令來完成的。
J. 今天在ubuntu種打命令:ifconfig,只有一個lo。以前都還有一個eth1的,不知道電腦怎麼了,怎樣在出現eth1
跟你你描述的情況看的話,應該你的物理網卡沒有啟用,如果你想看到你的網卡的話可以使用:ifconfig -all 查看
你可以用ifconfig eth1 <ipaddress> netmask <netmask> up 命令來啟用你的網卡
謝謝。