centOS7.6最小化安装后生成ip

centos minimal 网络配置

在虚拟机上安装发现默认是命令行界面一路进行下去,最后发现是Minimal的安装,并且网卡也没有默认启动
centos7.6查看ip命令是

[root@localhost ~]# ip addr

进入/etc/sysconfig/network-scripts文件

[root@localhost ~]# cd /etc/sysconfig/network-scripts

然后修改ifcfg-ens33文件把ONBOOT=no改成ONBOOT=yes

[root@localhost network-scripts]# vi ifcfg-ens33
[root@localhost network-scripts]# vi ifcfg-ens33 

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
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=f628675b-63e9-4903-802d-38663b52418f
DEVICE=ens33
ONBOOT=yes

最后

[root@localhost network-scripts]# service network restart

应该就有ip了

[root@localhost network-scripts]# ip addr
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33:  mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:c7:4d:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.92.138/24 brd 192.168.92.255 scope global noprefixroute dynamic ens33
       valid_lft 1427sec preferred_lft 1427sec
    inet6 fe80::8601:214d:3c4d:c13f/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

你可能感兴趣的:(centOS7.6最小化安装后生成ip)