Não obtendo um IP estático para o CentOS 7 [duplicado]

0

Não tenho certeza do que estou perdendo para ter meu IP estático ??

Aqui estão os meus arquivos de configuração de rede:

/etc/hosts :

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.2 puppet master
192.168.1.3 agent1 machine1
192.168.1.4 agent2 machine2
192.168.1.5 agent3 machine3

/etc/sysconfig/network :

# Created by anaconda
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=agent1
GATEWAY=192.168.1.1

O arquivo de configuração da interface principal, /etc/sysconfig/network-scripts/ifcfg-enp0s3 :

TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eth0
UUID=9b49c161-f7b4-418d-ae5f-a4fae294d302
DEVICE=eth0
ONBOOT=no
IPADDR=192.168.1.3
PREFIX=32
GATEWAY=192.168.1.1
DNS1=192.168.1.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

E aqui está a saída de ip addr :

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:84:c2:b6 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic enp0s3
       valid_lft 85698sec preferred_lft 85698sec
    inet6 fe80::a00:27ff:fe84:c2b6/64 scope link 
       valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:18:f1:a8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.99.100/24 brd 192.168.99.255 scope global dynamic enp0s8
       valid_lft 996sec preferred_lft 996sec
    inet6 fe80::a00:27ff:fe18:f1a8/64 scope link 
       valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN 
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 500
    link/ether 52:54:00:44:89:62 brd ff:ff:ff:ff:ff:ff

Verifiquei que estou conectado à Internet com o comando ping .

Esta é a configuração mais recente a partir de agora.

 [root@agent1 ~]# cat /etc/resolv.conf 
    ; generated by /usr/sbin/dhclient-script
    search netgear
    nameserver 192.168.1.1
    [root@agent1 ~]# ping -c 5 google.com
    ping: unknown host google.com
    [root@agent1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 
    TYPE=Ethernet
    BOOTPROTO=static
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=yes
    IPV6INIT=yes
    IPV6_AUTOCONF=yes
    IPV6_DEFROUTE=yes
    IPV6_FAILURE_FATAL=no
    [b]NAME=enp0s3[/b]
    UUID=9b49c161-f7b4-418d-ae5f-a4fae294d302
    [b]DEVICE=enp0s3[/b]
    [b]ONBOOT=yes
    NM_CONTROLLED=NO[/b]
    IPADDR=192.168.1.3
    PREFIX=32
    GATEWAY=192.168.1.1
    DNS1=192.168.1.1
    IPV6_PEERDNS=yes
    IPV6_PEERROUTES=yes
    [root@agent1 ~]# cat /etc/sysconfig/network
    # Created by anaconda
    NETWORKING=yes
    NETWORKING_IPV6=no
    GATEWAY=192.168.1.1
    [root@agent1 ~]# ip addr
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
        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: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 08:00:27:84:c2:b6 brd ff:ff:ff:ff:ff:ff
        inet [b]192.168.1.3[/b]/32 brd 192.168.1.3 scope global enp0s3
           valid_lft forever preferred_lft forever
        inet6 fe80::a00:27ff:fe84:c2b6/64 scope link 
           valid_lft forever preferred_lft forever
    3: enp0s8: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
        link/ether 08:00:27:18:f1:a8 brd ff:ff:ff:ff:ff:ff
    4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN 
        link/ether 52:54:00:44:89:62 brd ff:ff:ff:ff:ff:ff
        inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
           valid_lft forever preferred_lft forever
    5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500
        link/ether 52:54:00:44:89:62 brd ff:ff:ff:ff:ff:ff
    [root@agent1 ~]# 

Por favor, note que tudo isso está no VirtualBox instalado no Windows 10. Eu tenho apenas dois adaptadores de rede Adaptador 1 Bridege andAdapter 2 Host.

Espero que esta informação nos ajude a identificar e resolver o problema.

    
por learner 02.07.2016 / 17:53

1 resposta

1

Coloque seu servidor de nomes em resolve.conf to 8.8.8.8

edite seu /etc/sysconfig/network-scripts/ifcfg-enp0s3

ONBOOT=no  
NAME=eth0
DEVICE=eth0

para o abaixo

ONBOOT=yes
NAME=enp0s3
DEVICE=enp0s3

systemctl restart network.service

    
por 03.07.2016 / 05:13