修改网卡配置文件

//进入到配置文件目录
[[email protected] ~]# cd /etc/sysconfig/network-scripts 
//列出目录下文件
[[email protected] network-scripts]# ls
1             ifdown-isdn      ifup          ifup-plusb     ifup-wireless
ifcfg-ens192  ifdown-post      ifup-aliases  ifup-post      init.ipv6-global
ifcfg-lo      ifdown-ppp       ifup-bnep     ifup-ppp       network-functions
ifdown        ifdown-routes    ifup-eth      ifup-routes    network-functions-ipv6
ifdown-bnep   ifdown-sit       ifup-ippp     ifup-sit       tcp.sh
ifdown-eth    ifdown-Team      ifup-ipv6     ifup-Team
ifdown-ippp   ifdown-TeamPort  ifup-isdn     ifup-TeamPort
ifdown-ipv6   ifdown-tunnel    ifup-plip     ifup-tunnel
//找到自己网卡的名字,并用vi命令编辑
[[email protected] network-scripts]# vi ifcfg-ens192
//修改参数,按下键盘上的"i"键进入编辑模式
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="none"
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="ens192"
UUID="fe98cfcd-6f00-4076-9454-9194ce89998"
DEVICE="ens192"
ONBOOT="yes"
IPADDR="172.16.1.2"
PREFIX="24"
GATEWAY="172.16.1.1"
DNS1="172.16.1.1"
DNS2="223.5.5.5"
DNS3="114.114.114.114"
IPV6_PRIVACY="no"
~                                                                                       
~    
//修改完按键盘左上角"Esc"键,然后再同时按"Shift"+":"(:键位于L键右)这是屏幕上显示":"然后输入"wq"按回车退出编辑

退出编辑后输入systemctl restart network重载网络信息令配置生效

Last modification:June 26th, 2020 at 09:47 pm
如果觉得我的文章对你有用,请随意赞赏