New CentOS 7 KVM server can't access internet

General support questions
Post Reply
philled
Posts: 28
Joined: 2008/01/29 11:09:28

New CentOS 7 KVM server can't access internet

Post by philled » 2015/07/21 13:09:39

I've just installed CentOS 7.1 to use as a KVM hypervisor (I selected Virtualization under the packages to install). I can SSH into the box but it has no access to the internet. I can ping the gateway but nothing out on the internet:

[root@localhost ~]# ping 192.168.0.254
PING 192.168.0.254 (192.168.0.254) 56(84) bytes of data.
64 bytes from 192.168.0.254: icmp_seq=1 ttl=64 time=0.363 ms
64 bytes from 192.168.0.254: icmp_seq=2 ttl=64 time=0.540 ms
^C
--- 192.168.0.254 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.363/0.451/0.540/0.091 ms

[root@localhost ~]# ping 216.58.220.132
connect: Network is unreachable


I think this is something to do with bridges but I don't understand this area of networking and I don't know what I need to do about setting up networking. When I run if config I get a number of devices:

[root@localhost ~]# ifconfig
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.103 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::a2e:5fff:fe1b:1802 prefixlen 64 scopeid 0x20<link>
inet6 fd2f:5a10:b81c::4c4 prefixlen 128 scopeid 0x0<global>
inet6 fd2f:5a10:b81c:0:a2e:5fff:fe1b:1802 prefixlen 64 scopeid 0x0<glo bal>
ether 08:2e:5f:1b:18:02 txqueuelen 1000 (Ethernet)
RX packets 165 bytes 20355 (19.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 96 bytes 12583 (12.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xfe500000-fe520000

enp5s0f0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:11:0a:55:d9:50 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

enp5s0f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:11:0a:55:d9:51 txqueuelen 1000 (Ethernet)
RX packets 89 bytes 8833 (8.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
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 0 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:be:b0:0d txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


I've been following https://access.redhat.com/documentation ... story.html and it didn't tell me I had to do anything special here.

Can anyone please advise what the problem might be?

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: New CentOS 7 KVM server can't access internet

Post by gerald_clark » 2015/07/21 13:26:27

Did you configure for static IP address, or did you use dhcp?
Did you configure a gateway and nameservers?
Did you read the virtualization documentation at https://access.redhat.com/knowledge/docs/ ?
You did not show us any config files.

philled
Posts: 28
Joined: 2008/01/29 11:09:28

Re: New CentOS 7 KVM server can't access internet

Post by philled » 2015/07/21 22:42:10

Did you configure for static IP address, or did you use dhcp?
I used static during the installation setup.
Did you configure a gateway and nameservers?
I configured a gateway during the installation setup. I can't remember if it asked me for nameserver, but that isn't the problem here as I tried to ping an external IP address not a FQDN.
Did you read the virtualization documentation at https://access.redhat.com/knowledge/docs/ ?
Not these docs - I read the Virtualisation Getting Started Guide. Subsequently I found that CentOS 7 uses firewalld (I used CentOS a few years ago and it was iptables back then). Perhaps I just need to turn off firewalld for the moment to get internet connectivity to install some new packages, and then I can harden firewalld later? Is firewalld configured to prevent outbound internet traffic by default on installation?
You did not show us any config files.
Sorry about that. Which config files are relevant here? Just the ifcfg files?

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: New CentOS 7 KVM server can't access internet

Post by gerald_clark » 2015/07/21 22:46:12

Yes, the ifcfg files would be good along with /etc/sysconfig/network.

philled
Posts: 28
Joined: 2008/01/29 11:09:28

Re: New CentOS 7 KVM server can't access internet

Post by philled » 2015/07/22 20:52:56

gerald_clark wrote:the ifcfg files would be good along with /etc/sysconfig/network.
Hi there, thanks for assisting. Here's my config files.

/etc/sysconfig/network exists but is empty.

/etc/sysconfig/network-scripts/ifcfg-eno1:
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=hyv3.edwards.local
UUID=8c0016de-e887-447c-b059-6188aba82667
DEVICE=eno1
ONBOOT=yes
IPADDR=192.168.0.103
PREFIX=24
DNS1=192.168.0.254
DOMAIN=edwards.local
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no


/etc/sysconfig/network-scripts/ifcfg-enp5s0f0:
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=enp5s0f0
UUID=836b02a7-0ff0-4a19-83bd-042ea04ba981
DEVICE=enp5s0f0
ONBOOT=no


/etc/sysconfig/network-scripts/ifcfg-enp5s0f1:
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=enp5s0f1
UUID=74a7a7ba-0b67-4334-bb30-33e040019a82
DEVICE=enp5s0f1
ONBOOT=no


There isn't an ifcfg config file for virbr0.

philled
Posts: 28
Joined: 2008/01/29 11:09:28

Re: New CentOS 7 KVM server can't access internet

Post by philled » 2015/07/22 20:58:44

I'm also listing the output of firewall-cmd --list-all-zones here in case it helps:

# firewall-cmd --list-all-zones
block
interfaces:
sources:
services:
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

dmz
interfaces:
sources:
services: ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

drop
interfaces:
sources:
services:
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

external
interfaces:
sources:
services: ssh
ports:
masquerade: yes
forward-ports:
icmp-blocks:
rich rules:

home
interfaces:
sources:
services: dhcpv6-client ipp-client mdns samba-client ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

internal
interfaces:
sources:
services: dhcpv6-client ipp-client mdns samba-client ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

public (default, active)
interfaces: eno1
sources:
services: dhcpv6-client ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

trusted
interfaces:
sources:
services:
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

work
interfaces:
sources:
services: dhcpv6-client ipp-client ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

Re: New CentOS 7 KVM server can't access internet

Post by gerald_clark » 2015/07/22 21:01:24

You are missing /etc/sysconfig/network
You have no GATEWAY defined.

Please read and follow the FAQ.
http://wiki.centos.org/FAQ/CentOS7

philled
Posts: 28
Joined: 2008/01/29 11:09:28

Re: New CentOS 7 KVM server can't access internet

Post by philled » 2015/07/23 10:12:55

gerald_clark wrote:You are missing /etc/sysconfig/network. You have no GATEWAY defined. Please read and follow the FAQ http://wiki.centos.org/FAQ/CentOS7
Thanks very much for all your help. My /etc/sysconfig/network now looks like this and I have internet connectivity:

# Created by anaconda
GATEWAY=192.168.0.254

Post Reply