View network interface information:
ifconfig [network interface name]
Network Interface:
eth0: the name of the first ethernet card
lo: loopback network card, non-real network card, virtual network interface, IP is always 127.0.0.1, used to provide network support within Linux when there is no physical network card.
Note: In centos7, instead of using ifconfig, use the ip command to view network information
ip addr
Network card configuration storage directory:
/etc/sysconfig/network-scripts/ifcfg-ens33
NIC restart command:
Start the network card: ifup ens33 Stop the network card: ifdown ens33 Restart the network card: serice network restart is equivalent to service network restart
Network card configuration:
TYPE="Ethernet" #Configure static dchp, static #BOOTPROTO=dhcp|static|none BOOTPROTO="static" DEFROUTE="yes" PEERDNS="yes" PEERROUTES="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_PEERDNS="yes" IPV6_PEERROUTES="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="ens33" UUID="00b1ba4d-9b5c-47db-96fd-1317aad5488e" DEVICE="ens33" ONBOOT="yes" #网卡IP地址 IPADDR="192.168.5.120" #子网掩码 NETMASK="255.255.255.0" #默认网关 GATEWAY="192.168.5.1" #DNS配置 DNS1="192.168.5.1"