1、查看当前网卡
[root@localhost Desktop]# ifconfig eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether 00:0c:29:af:60:a0 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 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 0 (Local Loopback) RX packets 386 bytes 32780 (32.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 386 bytes 32780 (32.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2、命令行输入nmtui,出现如下界面,直接回车
3、出现如下界面,选编辑,回车
4、将Automatically改为manual
5、选中show,然后后车
6、出现如下界面
7、设定ip
8、选ok,然后回车
9、选quit
10、再次查看网络
[root@localhost Desktop]# ifconfig eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether 00:0c:29:af:60:a0 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 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 0 (Local Loopback) RX packets 642 bytes 54540 (53.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 642 bytes 54540 (53.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
11、进入网卡配置文件目录
[root@localhost Desktop]# cd /etc/sysconfig/network-scripts/ [root@localhost network-scripts]# ls ifcfg-eno16777728 ifdown-ppp ifup-eth ifup-sit ifcfg-lo ifdown-routes ifup-ippp ifup-Team ifdown ifdown-sit ifup-ipv6 ifup-TeamPort ifdown-bnep ifdown-Team ifup-isdn ifup-tunnel ifdown-eth ifdown-TeamPort ifup-plip ifup-wireless ifdown-ippp ifdown-tunnel ifup-plusb init.ipv6-global ifdown-ipv6 ifup ifup-post network-functions ifdown-isdn ifup-aliases ifup-ppp network-functions-ipv6 ifdown-post ifup-bnep ifup-routes [root@localhost network-scripts]# pwd /etc/sysconfig/network-scripts
12、使用vim编辑网卡配置文件,将ONBOOT选项改为yes,意思是自动启动网卡
[root@localhost network-scripts]# vim ifcfg-eno16777728 TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME=eno16777728 UUID=2acdeb41-84b7-48c4-b552-a4ecca60729f ONBOOT=yes HWADDR=00:0C:29:AF:60:A0 IPADDR0=192.168.10.10 PREFIX0=20 IPV6_PEERDNS=yes IPV6_PEERROUTES=yes
13、重新启动网卡
[root@localhost network-scripts]# systemctl restart network
14、再次查看网络,配置已生效
[root@localhost network-scripts]# ifconfig eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.10.10 netmask 255.255.240.0 broadcast 192.168.15.255 inet6 fe80::20c:29ff:feaf:60a0 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:af:60:a0 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 30 bytes 4121 (4.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 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 0 (Local Loopback) RX packets 642 bytes 54540 (53.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 642 bytes 54540 (53.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0