网卡的命名规则
- ifconfig :用于显示或设置网络设备
ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.10.12 netmask 255.255.255.0 broadcast 192.168.10.255
inet6 240e:3b4:2eb5:ac10:a6b8:3f5b:8ef:88cf prefixlen 64 scopeid 0x0<global>
inet6 fe80::cab8:f301:9b7b:8034 prefixlen 64 scopeid 0x20<link>
inet6 240e:3b4:2eb5:ac10:5d09:49bc:25cc:ca39 prefixlen 64 scopeid 0x0<global>
ether 00:0c:29:c8:31:f3 txqueuelen 1000 (Ethernet)
RX packets 26288 bytes 11275819 (11.2 MB)
RX errors 0 dropped 7240 overruns 0 frame 0
TX packets 8359 bytes 1192559 (1.1 MB)
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 634 bytes 53491 (53.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 634 bytes 53491 (53.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- ifconfig -a # -a参数,查看所有网站信息,包括没有启动的网卡信息
临时修改:
方法1:临时修改网卡IP地址
ifconfig 网卡名称 IP 地址 -----直接修改网卡的IP地址。重启网络服务,IP配置会失效,修改后当前的终端会终端,需要重新使用新的IP地址进行连接
例如:修改ens32网卡的IP为192.168.10.13
ifconfig ens32 192.168.10.13 netmask 255.255.255.0
删除临时IP:
ip addr delete 192.168.10.13 dev ens32
也可以使用ip addr | more 查看现有的IP
- NetworkManager 服务是管理和监控网络设置的守护进程
systemctl status NetworkManager #查看状态
- 网络配置文件路径:
/etc/sysconfig/network-scripts
/etc/resolv.conf
/etc/host
**
- 修改主机名为 xiaoshimei.cn:
hostnameectl set-hostname xiaoshimei.cn
执行 hostname生效