CentOS 系统下加装万兆网卡
1. 查看信息
加装的是Intel X520-SR2双口网卡,两个原装的703模块,还有一根1m长LC-LC多模双芯光纤跳线。
enp2s0f0
和enp2s0f1
就是新装的网卡
$ lspci | grep -i eth
02:00.0 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
02:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
04:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
05:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
06:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
07:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
$ nmcli con show
NAME UUID TYPE DEVICE
enp4s0 408a7c7d-a8dd-4d3a-b34d-326af05f7b3f ethernet enp4s0
enp5s0 2472a8a7-3f14-45c7-b88e-cc69eae2350f ethernet --
enp6s0 54d78ff0-6d57-45af-9ed6-aec3fddb2f1a ethernet --
enp7s0 235acba5-c238-483a-9959-213746b4ed60 ethernet --
Wired connection 1 9e47ad7e-32ce-31f1-b41f-8d71985297c0 ethernet --
Wired connection 2 0305cf13-ed5e-354f-b0d7-ffcfbe4fe989 ethernet --
$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 14:da:e9:96:9f:76 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.215/24 brd 192.168.1.255 scope global noprefixroute dynamic enp4s0
valid_lft 86019sec preferred_lft 86019sec
inet6 fe80::8171:630d:41e1:b6b7/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: enp2s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 90:e2:ba:8e:28:4c brd ff:ff:ff:ff:ff:ff
4: enp5s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 14:da:e9:96:9f:77 brd ff:ff:ff:ff:ff:ff
5: enp6s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 14:da:e9:96:9f:78 brd ff:ff:ff:ff:ff:ff
6: enp7s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 14:da:e9:96:9f:79 brd ff:ff:ff:ff:ff:ff
7: enp2s0f1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 90:e2:ba:8e:28:4d brd ff:ff:ff:ff:ff:ff
$ sudo ifconfig
enp2s0f0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.77.11 netmask 255.255.255.0 broadcast 192.168.77.255
inet6 fe80::31c7:16b9:1ccd:12ce prefixlen 64 scopeid 0x20<link>
ether 90:e2:ba:8e:28:4c txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp2s0f1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.77.12 netmask 255.255.255.0 broadcast 192.168.77.255
inet6 fe80::fcb:5b24:9f18:b4f6 prefixlen 64 scopeid 0x20<link>
ether 90:e2:ba:8e:28:4d txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.215 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::8171:630d:41e1:b6b7 prefixlen 64 scopeid 0x20<link>
ether 14:da:e9:96:9f:76 txqueuelen 1000 (Ethernet)
RX packets 84 bytes 9370 (9.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 74 bytes 9908 (9.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xfb800000-fb820000
enp5s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 14:da:e9:96:9f:77 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 17 memory 0xfb700000-fb720000
enp6s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 14:da:e9:96:9f:78 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 18 memory 0xfb600000-fb620000
enp7s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 14:da:e9:96:9f:79 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 19 memory 0xfb500000-fb520000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2. 配置网卡
我为了让这块网卡的两口之间进行互连,所以配置了静态IP。
$ cat /etc/sysconfig/network-scripts/ifcfg-enp2s0f0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.77.11
NETMASK=255.255.255.0
# GATEWAY=192.168.77.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp2s0f0
UUID=9e47ad7e-32ce-31f1-b41f-8d71985297c0
DEVICE=enp2s0f0
ONBOOT=yes
$ cat /etc/sysconfig/network-scripts/ifcfg-enp2s0f1
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.77.12
NETMASK=255.255.255.0
# GATEWAY=192.168.77.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp2s0f1
UUID=0305cf13-ed5e-354f-b0d7-ffcfbe4fe989
DEVICE=enp2s0f1
ONBOOT=yes
3. 网卡测速
3.1 安装工具
$ sudo yum install iperf3
3.2 测试