고정 IP에 무엇이 빠졌는지 잘 모르겠습니다.
이것은 내 네트워크 구성 파일입니다.
/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
기본 인터페이스 구성 파일 /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
출력은 다음과 같습니다 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
명령을 통해 인터넷에 연결되어 있음을 확인했습니다 ping
.
현재 최신 구성입니다.
[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 ~]#
이 모든 내용은 Windows 10에 설치된 VirtualBox에 있습니다. 네트워크 어댑터는 어댑터 1 브리지와 어댑터 2 호스트 두 개뿐입니다.
이 정보가 문제를 식별하고 해결하는 데 도움이 되기를 바랍니다.
답변1
네임서버 resolve.conf
를8.8.8.8
당신의 편집/etc/sysconfig/network-scripts/ifcfg-enp0s3
ONBOOT=no
NAME=eth0
DEVICE=eth0
맨 아래로
ONBOOT=yes
NAME=enp0s3
DEVICE=enp0s3
systemctl restart network.service