1、获取IPADDR、NETMASK:
[root@192 network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.85.139 netmask 255.255.255.0 broadcast 192.168.85.255
inet6 fe80::11df:c601:5b38:ca41 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:fe:f2:7d txqueuelen 1000 (Ethernet)
RX packets 750 bytes 60532 (59.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 500 bytes 94739 (92.5 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 8 bytes 696 (696.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 696 (696.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2、获取GATEWAY:
[root@192 network-scripts]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.85.2 0.0.0.0 UG 100 0 0 ens33
192.168.85.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
3、配置IPADDR,NETMASK,GATEWAY:
[root@192 sysconfig]# cd /etc/sysconfig/network-scripts
[root@192 network-scripts]# ls
ifcfg-ens33 ifdown-eth ifdown-post ifdown-Team ifup-aliases ifup-ipv6 ifup-post ifup-Team init.ipv6-global
ifcfg-lo ifdown-ippp ifdown-ppp ifdown-TeamPort ifup-bnep ifup-isdn ifup-ppp ifup-TeamPort network-functions
ifdown ifdown-ipv6 ifdown-routes ifdown-tunnel ifup-eth ifup-plip ifup-routes ifup-tunnel network-functions-ipv6
ifdown-bnep ifdown-isdn ifdown-sit ifup ifup-ippp ifup-plusb ifup-sit ifup-wireless
vi ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.85.139
NETMASK=255.255.255.0
GATEWAY=192.168.85.2
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=f3bf2c45-d6af-408e-bcc9-d11b06cae1ad
DEVICE=ens33
ONBOOT=yes
4、修改完后重启网卡:
systemctl restart network
标签:network,0.0,IPADDR,ifup,192.168,Centos7,NETMASK,ifdown,ens33
From: https://blog.51cto.com/u_15391441/6875062