Setup networking problem

Issues related to configuring your network
User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Setup networking problem

Post by jlehtone » 2017/11/03 08:28:23

What are all the ifcfg-br0-* files? The ifcfg* and route* files are configuration. Other files are scripts.

This CentOS is a VM guest. If I were you, I would make the Ubuntu VM host act as DHCP server for VM guests and set the CentOS to configure itself via DHCP. This is unrelated to what you want to do with the guest.


The virbr0 interface is a bridge that libvirt creates for its "Default network". You implied that you don't use that. All unnecessary things are a distraction. I usually disable the autostart of the "default" network. The configuration of the interface tends to remain until the next reboot.

Same goes for the superfluous ifcfg-* files. They are probably trouble.
Exception: the ifcfg-lo is vital. Do not remove it. Do not touch it.

You state that you want a "bridged network". A bridge is essentially a network switch.
You state that the "physical interface" of CentOS has device name "eth0".
You want to enslave eth0 to br0.

The eth0 is thus nothing more than a port on a switch that you will "plug the cable from outside" to.
ifcfg-eth0

Code: Select all

TYPE=Ethernet
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
NM_CONTROLLED=no
BRIDGE=br0
The br0 is the interface that the CentOS will use. The IP will be "on the switch" (rather than just one port of it) just like on managed switches.
ifcfg-br0

Code: Select all

TYPE=Bridge
DEVICE=br0
ONBOOT=yes
BOOTPROTO=dhcp
NM_CONTROLLED=no
STP=no
If/when you do create virtual guests on CentOS with libvirt and you add to those guests a network interface towards br0, you effectively create and connect more ports to the switch br0. Those guests will be on the same subnet as the CentOS br0 and the oVirt(?) of Ubuntu, and preferably should get net config via DHCP (from Ubuntu?).

satimis
Posts: 151
Joined: 2006/11/14 14:24:08

Re: Networking problem - 2 IP addreses

Post by satimis » 2017/11/03 10:11:26

jlehtone wrote:This is clearly continuation/fork of viewtopic.php?f=50&t=64873
I will write more about config there.

On assumption that the current active config is transient and still there despite service restarts,
then a system reboot would be the next logical thing to do.
Hi,

I have performed multiple reboot but problem remains the same

satimis

satimis
Posts: 151
Joined: 2006/11/14 14:24:08

Re: Setup networking problem

Post by satimis » 2017/11/03 11:12:31

TrevorH wrote:Merged the two threads.

Your problem is that your ifcfg-eth0 file has both BRIDGE=br0 and IPADDR=. You should move the IPADDR= to the bridge ifcfg file - don't do any ip configuration in the ifcfg-eth0 file, it should all be on the bridge. You also seem to have a plethora of ifcfg-br0* files as well as yet another one called ifcf-eth0-1. If you created those files as backups you should know that they are probably being used as they all start with ifcfg*. If you want to take backups either do so in a different directory entirely or call them something other than ifcfg-*.
I don't know how those;

Code: Select all

ifcfg-br0-1
ifcfg-br0-2
ifcfg-br0-3
ifcfg-br0-4
ifcfg-br0-5
ifcfg-br0-6
ifcfg-br0-7
ifcfg-br0-8
ifcfg-eth0-1 
would come? I haven't created them.

$ cat /etc/sysconfig/network-scripts/ifcfg-eth0-1

Code: Select all

HWADDR=52:54:00:EE:58:34
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
IPADDR=192.168.8.6
PREFIX=24
GATEWAY=192.168.8.1
DNS1=192.168.8.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV4_ROUTE_METRIC=100
IPV4_DNS_PRIORITY=100
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ROUTE_METRIC=1024
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_DNS_PRIORITY=100
NAME=eth0
UUID=5b2f6350-fb02-4502-9746-459461f13d7d
DEVICE=eth0
ONBOOT=no
Performed following steps;

1)
# cd /etc/sysconfig/network-scripts/
# mkdir Spare
# mv ifcfg-br0-1 ifcfg-br0-2 ifcfg-br0-3 ifcfg-br0-4 ifcfg-br0-5 ifcfg-br0-6 ifcfg-br0-7 ifcfg-br0-8 ifcfg-eth0-1 Spare/
# ls

Code: Select all

ifcfg-br0                   ifdown-routes    ifup-plusb
ifcfg-eth0                  ifdown-sit       ifup-post
ifcfg-lo                    ifdown-Team      ifup-ppp
ifcfg-Wired_connection_1    ifdown-TeamPort  ifup-routes
ifcfg-Wired_connection_1-1  ifdown-tunnel    ifup-sit
ifdown                      ifup             ifup-Team
ifdown-bnep                 ifup-aliases     ifup-TeamPort
ifdown-eth                  ifup-bnep        ifup-tunnel
ifdown-ib                   ifup-eth         ifup-wireless
ifdown-ippp                 ifup-ib          init.ipv6-global
ifdown-ipv6                 ifup-ippp        network-functions
ifdown-isdn                 ifup-ipv6        network-functions-ipv6
ifdown-post                 ifup-isdn        route-br0
ifdown-ppp                  ifup-plip        Spare
# nano /etc/sysconfig/network-scripts/ifcfg-br0

Code: Select all

DEVICE=enp2s0
TYPE=Bridge
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.8.6
NETMASK=255.255.255.0
DELAY=0
# nano /etc/sysconfig/network-scripts/ifcfg-eth0

Code: Select all

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static  #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=enp2s0  #eth0
UUID=3a20e867-00f1-4cda-ab7b-e4ad71f33f5b
DEVICE=enp2s0 #eth0
ONBOOT=yes
ETHTOOL_OPTS="autoneg off speed 100 duplex full"
BRIDGE=br0
HWADDR=b8:ac:6f:65:31:e5
NM_CONTROLLED=no
DNS1=8.8.8.8
DNS2=4.2.2.2
# systemctl restart network

Code: Select all

● network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2017-11-03 19:08:35 HKT; 41s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 4531 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
   CGroup: /system.slice/network.service
           └─1055 /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-657ef9b...

Nov 03 19:08:35 centos7-gnome-pc1b00 network[4531]: RTNETLINK answers: File e...
Nov 03 19:08:35 centos7-gnome-pc1b00 network[4531]: RTNETLINK answers: File e...
Nov 03 19:08:35 centos7-gnome-pc1b00 network[4531]: RTNETLINK answers: File e...
Nov 03 19:08:35 centos7-gnome-pc1b00 systemd[1]: network.service: control pr...1
Nov 03 19:08:35 centos7-gnome-pc1b00 systemd[1]: Failed to start LSB: Bring ....
Nov 03 19:08:35 centos7-gnome-pc1b00 systemd[1]: Unit network.service entere....
Nov 03 19:08:35 centos7-gnome-pc1b00 systemd[1]: network.service failed.
Nov 03 19:09:09 centos7-gnome-pc1b00 dhclient[1055]: DHCPREQUEST on eth0 to 1...
Nov 03 19:09:09 centos7-gnome-pc1b00 dhclient[1055]: DHCPACK from 192.168.8.1...
Nov 03 19:09:11 centos7-gnome-pc1b00 dhclient[1055]: bound to 192.168.8.4 -- ...
Hint: Some lines were ellipsized, use -l to show in full.
But I can ping Internet
# ping yahoo.com

Code: Select all

PING yahoo.com (98.139.180.149) 56(84) bytes of data.
64 bytes from ir1.fp.vip.bf1.yahoo.com (98.139.180.149): icmp_seq=1 ttl=52 time=224 ms
64 bytes from ir1.fp.vip.bf1.yahoo.com (98.139.180.149): icmp_seq=2 ttl=52 time=222 ms
.....
CentOS 7 can ping Host and Host can ping CentOS 7 on 192.168.8.4 and 192.168.8.6

# ip a

Code: Select all

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 52:54:00:ee:58:34 brd ff:ff:ff:ff:ff:ff
    inet 192.168.8.4/24 brd 192.168.8.255 scope global dynamic eth0
       valid_lft 237sec preferred_lft 237sec
    inet 192.168.8.6/24 brd 192.168.8.255 scope global secondary eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:feee:5834/64 scope link 
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
    link/ether 52:54:00:8b:64:ac 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
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
    link/ether 52:54:00:8b:64:ac brd ff:ff:ff:ff:ff:ff
5: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1000
    link/ether 92:08:03:32:24:4b brd ff:ff:ff:ff:ff:ff
    inet 192.168.8.6/24 brd 192.168.8.255 scope global enp2s0
       valid_lft forever preferred_lft forever
    inet6 fe80::9008:3ff:fe32:244b/64 scope link 
       valid_lft forever preferred_lft forever
Still 2 static IP adresses ?

Regards
satimis

satimis
Posts: 151
Joined: 2006/11/14 14:24:08

Re: Setup networking problem

Post by satimis » 2017/11/03 11:22:42

jlehtone wrote:What are all the ifcfg-br0-* files? The ifcfg* and route* files are configuration. Other files are scripts.

This CentOS is a VM guest. If I were you, I would make the Ubuntu VM host act as DHCP server for VM guests and set the CentOS to configure itself via DHCP. This is unrelated to what you want to do with the guest.

- snip -
Hi,

Thanks for your advice.

If I make VM host act as DHCP server other PCs can't connect it.

What I'm prepared to do is;
Install oVirt on CentOS 7 testing nested virtualization

Regards
satimis

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Setup networking problem

Post by jlehtone » 2017/11/03 15:17:02

satimis wrote:If I make VM host act as DHCP server other PCs can't connect it.
DHCP server for the VM guests. [1] Why a service would block all other traffic anyway?
satimis wrote:What I'm prepared to do is;
Install oVirt on CentOS 7 testing nested virtualization
Why oVirt?

You did show interface virbr0, a creation of libvirt. The libvirt is a virtualization platform already installed on your CentOS.

If libvirt, which simply manages KVM guests, does not support nested, then get rid of it.
If libvirt does support nested, then there is no point installing the oVirt.


[1] A DHCP server can listen to specific interfaces. The libvirt, for example, does spawn a dnsmasq process for each "network" that it manages. The dnsmasq process acts as both DHCP and DNS server for VM guests.

If the oVirt does not support such elementary management config, then I have to ask again: Why oVirt?

satimis
Posts: 151
Joined: 2006/11/14 14:24:08

Re: Setup networking problem

Post by satimis » 2017/11/03 16:31:11

Hi all,

Problem solved using "nmcli" (GUI Mode)

Document referred:
How to Setup network on centos 7
http://www.krizna.com/centos/setup-network-centos-7

On terminal run;
# nmcli d

then follow the steps as illustrated on the document.

# ifconfig -a

Code: Select all

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.8.7  netmask 255.255.255.255  broadcast 192.168.8.7
        inet6 fe80::2d33:c384:edc9:5adf  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:14:0e:b0  txqueuelen 1000  (Ethernet)
        RX packets 5025  bytes 12201310 (11.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4082  bytes 309808 (302.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 1  (Local Loopback)
        RX packets 48  bytes 5616 (5.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 48  bytes 5616 (5.4 KiB)
        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:24:11:c0  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

virbr0-nic: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:24:11:c0  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
It is pretty easy and straightforwards.

Regards
satimis

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Setup networking problem

Post by jlehtone » 2017/11/03 16:52:03

1. Which problem?

2. Netmask 255.255.255.255 is most probably wrong.

3. You wrote earlier
# systemctl disable NetworkManager
# systemctl enable network
# systemctl restart network
and
a lot about contents of /etc/sysconfig/network-scripts/
and now
Problem solved using "nmcli"
Then nmcli is a tool for NetworkManager.service It is unusable unless you do use NetworkManager.
The files in /etc/sysconfig/network-scripts/ are for network.service. They are not supposed to even looked at, if you do use NetworkManager.

4. <pedantic> nmcli does not have a "GUI mode". nmcli is strictly a CLI app. 'nmtui' and desktop applets are "graphical". </pedantic>

satimis
Posts: 151
Joined: 2006/11/14 14:24:08

Re: Setup networking problem

Post by satimis » 2017/11/04 07:07:01

jlehtone wrote:1. Which problem?
Networking to set static IP
3. You wrote earlier
# systemctl disable NetworkManager
# systemctl enable network
# systemctl restart network
.......
Ran
# systemctl enable NetworkManager
# systemctl enable network
# systemctl restart network
to restart it

Just performed following steps:

1) Delete CentOS 7 Gnome desktop on KVM
2) Download CentOS-7-x86_64-DVD-1710-01.iso
3) Install new CentOS Gnome desktop on the download ISO

I found that it is much easier to set up static IP during installation.

On Installation Summary:-

-> Network & Host Name
-> Ethernet (eth0) -> On

-> Configure ....
Connection name : eth0

General
check - All users may connect to this network

Ethernet
Device: eth0
MTU: automatic
Wake on LAN: check - Default
Link negotiation: ignore

Proxy
Method: None

IPv4 Settings
Method: change from Automatic (DHCP) -> Manual
(This is why there are 2 IP Addresses if I set static IP address after installation)

Address
-> Add
Address - 192.168.8.6
Netmask - 255.255.255.0
Gateway - 192.168.8.1

DNS servers: xxx.xx.xxx.xx xxx.xxx.xxx.xxx

check - Requires IPv4 addressing for this connection to complete

-> Save

Host name:
change from: localhost localdomain
to: centos7gnome
-> Apply

-> Done

-> Begin Installation
Follow the instruction to complete the details

Set root password and create user
Add root password
User Creation
check - Makes this user administrator
check - Require a password to use this account
-> Done

Installation starts

After installation finished accept license to start CenOS 7 Gnome desktop

On Terminal:
$ ifconfig -a

Code: Select all

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.8.6  netmask 255.255.255.255  broadcast 192.168.8.7
        inet6 fe80::2d33:c384:edc9:5adf  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:14:0e:b0  txqueuelen 1000  (Ethernet)
        RX packets 44  bytes 5512 (5.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 44  bytes 6143 (5.9 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 1  (Local Loopback)
        RX packets 20  bytes 2060 (2.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20  bytes 2060 (2.0 KiB)
        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:24:11:c0  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

virbr0-nic: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:24:11:c0  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
satimis

Post Reply