如何解決Linux作業系統找不到網卡的問題

來源:互聯網
上載者:User

 

1. 安裝網卡

機器太新,以至於現有的Linux版本無法認出,比如機器找不到網卡,這時候怎麼辦呢?

別急,首先你需要知道網卡是什麼型號的,以本實驗室新購入的電腦為例,它的網卡是整合的,型號是Realtek RTL8168/8111 PCI-E Gigabit Ethernet NIC。然後我們到Realtek的官方網站去下載相應的Linux驅動程式r8168-8.005.00.tar.bz2,按照說明安裝。

Unpack the tarball :

# tar vjxf r8168-8.aaa.bb.tar.bz2

Change to the directory:

# cd r8168-8.aaa.bb

If you are running the target kernel, then you should be able to do :

# make clean modules (as root or with sudo)

# make install

# /sbin/depmod -a

# /sbin/insmod ./src/r8168.ko (or r8168.o in linux kernel 2.4.x)

You can check whether the driver is loaded by using following commands.

# /sbin/lsmod | grep r8168(看看有沒有載入網卡驅動)

# /sbin/ifconfig –a(看看有沒有相關網卡被啟動的資訊)

If there is a device name, ethX, shown on the monitor, the linux

driver is loaded. Then, you can use the following command to activate

the ethX.

# ifconfig ethX up

,where X=0,1,2,...

這裡也可以通過系統→管理→網路來設定IP地址等,最後啟用。

1. Set manually

a. Set the IP address of your machine.

# ifconfig ethX "the IP address of your machine"

b. Set the IP address of DNS.

Insert the following configuration in /etc/resolv.conf.

nameserver "the IP address of DNS"

c. Set the IP address of gateway.

# route add default gw "the IP address of gateway"

2. Set by doing configurations in /etc/sysconfig/network-scripts

/ifcfg-ethX for Redhat and Fedora, or /etc/sysconfig/network

/ifcfg-ethX for SuSE. There are two examples to set network

configurations.

a. Fix IP address:

DEVICE=eth0

BOOTPROTO=static

ONBOOT=yes

TYPE=ethernet

NETMASK=255.255.255.0

IPADDR=192.168.1.1

GATEWAY=192.168.1.254

BROADCAST=192.168.1.255

2. 修改:#vi /etc/hosts,在該文本中,增加兩行:

127.0.0.1 localhost.localdomain localhost

192.168.4.101 node3(根據機器本身情況設定)

修改:vi /etc/hosts.equiv,增加一行:(如果沒有該文本,可建立一個)

node3

3. 啟動ssh服務

大部分的Linux版本應該都會內建該程式

#ssh-keygen

#cd .ssh

#cp id_rsa.pub authorized_keys

#ssh node3(如果成功,會顯示上次登陸的時間, node3是主機名稱)

附加資訊:

ifup eth0看看能否啟動eth0

lsmod看看有沒有載入網卡驅動

dmesg看看有沒有網卡啟動時的錯誤資訊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.