这里写目录标题
Linux yum
修改yum源
cd /etc/yum.repos.d
# 备份
CentOS-Base.repo
mv CentOS-Base.repo CentOS-Base.repo-back
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
下载ifconfig命令
yum search ifconfig
# 搜到与ifconfig相关的包net-tools.x86_64
yum install net-tools.x86_64 -y
配置静态IP
cd /etc/sysconfig/network-scripts
vim ifcfg-ens33
# 修改
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static" # 配置IP静态
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="59c8f94a-fc40-45fe-b39b-a4faa358e99d"
DEVICE="ens33"
ONBOOT="yes"
IPADDR="172.16.77.2" # 指定IP
NETMASK="255.255.255.0" #配置子网掩码
GATEWAY="172.16.77.1" #配置网关
# 使配置生效
systemctl restart network
查看网关命令
# 有如下三种方式都可以查看网关
more /etc/sysconfig/network-scripts/ifcfg-eth0
ip route show
route -n