天天看點

網卡配置及lspci指令

總是忘記centos和ubuntu網卡配置檔案的寫法:

centos:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=static #可選項還有dhcp bootp

ONBOOT=yes

IPADDR=192.168.1.209

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

BROADCAST=192.168.0.255

HWADDR=00:07:E9:05:E8:B4

/etc/sysconfig/network檔案中配置主機名

ubuntu:

vim /etc/network/interfaces

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0

iface eth0 inet static

address 192.168.1.130

netmask 255.255.255.0

gateway 192.168.1.1

auto eth1

iface eth1 inet static

address 10.168.1.130

lspci指令:

PCI是一種外設總線規範。PCI是Peripheral Component Interconnect(外圍裝置互聯)的簡稱。總線是一種傳輸信号的信道。總線由電氣接口和程式設計接口組成。通過讀寫PCI/PCI-E配置空間,可以更改裝置運作參數,優化裝置運作。

是以lspci就是檢視pci裝置的工具了,下面是虛機中看到的資訊:

[root@grxtpayd ~]# lspci

00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)

00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]

00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]

00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)

00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)

00:02.0 VGA compatible controller: Cirrus Logic GD 5446

00:03.0 Ethernet controller: Red Hat, Inc Virtio network device

00:04.0 Ethernet controller: Red Hat, Inc Virtio network device

00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device

00:06.0 SCSI storage controller: Red Hat, Inc Virtio block device

00:07.0 RAM memory: Red Hat, Inc Virtio memory balloon

常用參數:

-v 顯示裝置的詳細資訊。

-vv 顯示裝置更詳細的資訊。

-vvv 顯示裝置所有可解析的資訊。

-x 以16進制顯示配置空間的前64位元組,或者CardBus橋的前128位元組。

-xxx 以16進制顯示整個PCI配置空間(256位元組)。

-xxxx 以16進制顯示整個PCI-E配置空間(4096位元組)。