安装ifconfig命令
若系统提示未安装ifconfig软件,可通过以下命令安装:
yum -y install net-tools
查看网卡信息
[root@machine01 ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.1 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::50c6:fa9f:d76c:2789 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:88:48:82 txqueuelen 1000 (Ethernet)
RX packets 594 bytes 357220 (348.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 403 bytes 62418 (60.9 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 1000 (Local Loopback)
RX packets 32 bytes 2592 (2.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32 bytes 2592 (2.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
查看指定网卡
[root@machine01 ~]# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.1 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::50c6:fa9f:d76c:2789 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:88:48:82 txqueuelen 1000 (Ethernet)
RX packets 628 bytes 359860 (351.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 428 bytes 65296 (63.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
临时设置IP
[root@machine01 ~]# ifconfig ens33 10.0.0.10 netmask 255.255.255.0
这是临时修改,当重启服务systemctl restart network
时,临时IP失效。