说明书大全网 - 海量说明书在线查询
手机版  |  网站地图

电脑新装系统配置怎么看(centos7查看网卡信息及数量)

电脑新装系统配置怎么看(centos7查看网卡信息及数量)(1)

环境:

Centos 7.5
VMware 16.0.0

问题描述:

CentOS7.5 新装系统如何查看网络,配置网卡信息

解决方案:

1.查看ip信息
ip a

ip a1: 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 forever2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000    link/ether 00:50:56:25:19:1c brd ff:ff:ff:ff:ff:ff    inet 192.168.1.227/24 brd 192.168.1.255 scope global noprefixroute ens33       valid_lft forever preferred_lft forever    inet6 fe80::36fd:c3d4:ea0a:5ab4/64 scope link noprefixroute        valid_lft forever preferred_lft forever

2.查看编辑网卡信息

vim /etc/sysconfig/network-scripts/ifcfg-ens33(网卡名)

TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=noneDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens33UUID=bf5bb7c5-da27-44a9-b4be-7f6e4138abfdDEVICE=ens33ONBOOT=yesIPADDR=192.168.1.227PREFIX=24GATEWAY=192.168.1.1

重启网络服务
systemctl restart network

查看ens33网卡信息
ifconfig ens33

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet 192.168.1.227  netmask 255.255.255.0  broadcast 192.168.1.255        inet6 fe80::36fd:c3d4:ea0a:5ab4  prefixlen 64  scopeid 0x20<link>        ether 00:50:56:25:19:1c  txqueuelen 1000  (Ethernet)        RX packets 29155875  bytes 2426699185 (2.2 GiB)        RX errors 0  dropped 108161  overruns 0  frame 0        TX packets 32605674  bytes 12952561612 (12.0 GiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

启用ens33网卡
ifconfig ens33 up

禁用ens33网卡
ifconfig ens33 down

查看ens33网卡其他参数

ethtool ens33

Settings for ens33:Supported ports: [ TP ]Supported link modes:   10baseT/Half 10baseT/Full                         100baseT/Half 100baseT/Full                         1000baseT/Full Supported pause frame use: NoSupports auto-negotiation: YesSupported FEC modes: Not reportedAdvertised link modes:  10baseT/Half 10baseT/Full                         100baseT/Half 100baseT/Full                         1000baseT/Full Advertised pause frame use: NoAdvertised auto-negotiation: YesAdvertised FEC modes: Not reportedSpeed: 1000Mb/sDuplex: FullPort: Twisted PairPHYAD: 0Transceiver: internalAuto-negotiation: onMDI-X: off (auto)Supports Wake-on: dWake-on: dCurrent message level: 0x00000007 (7)       drv probe linkLink detected: yes

DNS设置
vim /etc/resolv.conf

nameserver 192.168.1.1

关闭NetworkManager服务

systemctl stop  NetworkManager.service

停止开机自启

systemctl disable NetworkManager.service

查看网络服务

systemctl status network.service

● network.service - LSB: Bring up/down networking   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)   Active: active (running) since 四 2022-03-17 23:58:09 CST; 7h left     Docs: man:systemd-sysv-generator(8)  Process: 975 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)   CGroup: /system.slice/network.service           └─1304 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-f5774ec4-da78-4594-859b-a17bb015e929-ens33.lease -pf /var/run/dhclient-ens33.pid ens333月 17 23:58:06 localhost.localdomain network[975]: 正在打开环回接口: [  确定  ]3月 17 23:58:07 localhost.localdomain network[975]: 正在打开接口 ens33:3月 17 23:58:07 localhost.localdomain dhclient[1193]: DHCPREQUEST on ens33 to 255.255.255.255 port 67 (xid=0x2c76a023)3月 17 23:58:07 localhost.localdomain dhclient[1193]: DHCPACK from 192.168.1.1 (xid=0x2c76a023)3月 17 23:58:09 localhost.localdomain NET[1300]: /usr/sbin/dhclient-script : updated /etc/resolv.conf3月 17 23:58:09 localhost.localdomain dhclient[1193]: bound to 192.168.1.227 -- renewal in 10429 seconds.3月 17 23:58:09 localhost.localdomain network[975]: 正在确定 ens33 的 IP 信息... 完成。3月 17 23:58:09 localhost.localdomain NET[1350]: /etc/sysconfig/network-scripts/ifup-post : updated /etc/resolv.conf3月 17 23:58:09 localhost.localdomain network[975]: [  确定  ]3月 17 23:58:09 localhost.localdomain systemd[1]: Started LSB: Bring up/down networking.

查看网络服务日志

cat /var/log/messages | grep network

ar 17 23:53:00 localhost systemd: Started LSB: Bring up/down networking.Mar 17 23:54:11 localhost systemd: Stopping LSB: Bring up/down networking...Mar 17 23:54:12 localhost NET[3314]: /etc/sysconfig/network-scripts/ifdown-post : updated /etc/resolv.confMar 17 23:54:12 localhost network: 正在关闭接口 ens33: [  确定  ]Mar 17 23:54:12 localhost network: 正在关闭环回接口: [  确定  ]Mar 17 23:54:12 localhost systemd: Starting LSB: Bring up/down networking...Mar 17 23:54:12 localhost NET[3516]: /etc/sysconfig/network-scripts/ifup-post : updated