Skip to content

Instantly share code, notes, and snippets.

@phoracek
Created August 9, 2017 11:03
Show Gist options
  • Select an option

  • Save phoracek/0022434b1f105fa0466ed04576b6d7f4 to your computer and use it in GitHub Desktop.

Select an option

Save phoracek/0022434b1f105fa0466ed04576b6d7f4 to your computer and use it in GitHub Desktop.
setup ovirtmgmt network with static ip via vdsm-client
echo '{"bondings": {}, "networks": {"ovirtmgmt": {"nic": "eth0", "netmask": "255.255.255.0", "ipaddr": "1.1.1.2", "gateway": "1.1.1.1", "defaultRoute": true}}, "options": {"connectivityCheck": false}}' | vdsm-client -f - Host setupNetworks
vdsm-client Host setSafeNetworkConfig
@phoracek
Copy link
Author

Hello @raoravin. IIRIC, VDSM owns the networking on its hosts, If you configure a network on top of eno1, it will become owned by it. I would advice you not to fight it and to use VDSM setupNetworks to configure your interface into your desired state explicitly. If it does not solve your issue, I'd recommend you to send your question to users@ovirt.org. Maybe there is another way.

@xiaofanshifu
Copy link

@phoracek Hi, Why did I specify mode=1 and actually mode=0?

echo '{
  "bondings": {
    "bond1": {
      "nics": ["ens34", "ens38"],
      "mode": 1
    }
  },
  "networks": {
    "mgmtnet": {
      "bonding": "bond1",
      "bootproto": "static",
      "ipaddr": "10.17.38.33",
      "netmask": "255.255.255.0",
      "gateway": "10.17.38.1", 
      "defaultRoute": true
    }
  },
  "options": {
    "connectivityCheck": false
  }
}' | vdsm-client -f - Host setupNetworks

vdsm-client Host setSafeNetworkConfig

@phoracek
Copy link
Author

phoracek commented Jan 1, 2024

@thissuper hey. I don't know why you used mode 1. AFAIK you can select any of the supported modes.

@xiaofanshifu
Copy link

@phoracek I read redhat documentation, ovirt should support mode 1. Did I make a mistake in my json?
Very confused, I think you may know, so consult you.
image

@phoracek
Copy link
Author

phoracek commented Jan 2, 2024

Sorry, I don't understand what you are asking. When you apply the JSON you shared above, does it fail?

@xiaofanshifu
Copy link

Sorry, I don't understand what you are asking. When you apply the JSON you shared above, does it fail?

Sorry, I was busy with other things these days, so I couldn't reply to you in time.

I am binding the network configuration of the ovirt host to make the ens192 interface and ens224 interface bonding1, but it is actually bonding0. Did I make a mistake in my json?

English is not my native language, so it may not be accurate enough. Please see shell below

[root@node-1 ~]# echo '{
  "bondings": {
    "bond1": {
      "nics": ["ens192", "ens224"],
      "mode": 1
    }
  },
  "networks": {
    "mgmtnet": {
      "bonding": "bond1",
      "bootproto": "static",
      "ipaddr": "10.17.35.52",
      "netmask": "255.255.255.0",
      "gateway": "10.17.35.1", 
      "defaultRoute": true
    }
  },
  "options": {
    "connectivityCheck": false
  }
}' | vdsm-client -f - Host setupNetworks

[root@node-1 ~]# vdsm-client Host setSafeNetworkConfig

[root@node-1 ~]# 
[root@node-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond1
# Generated by VDSM version 4.20.32-1.el7
DEVICE=bond1
BONDING_OPTS=mode=0
BRIDGE=mgmtnet
ONBOOT=yes
MTU=1500
DEFROUTE=no
NM_CONTROLLED=no
IPV6INIT=no
[root@node-1 ~]#
[root@node-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens192
# Generated by VDSM version 4.20.32-1.el7
DEVICE=ens192
MASTER=bond1
SLAVE=yes
ONBOOT=yes
MTU=1500
DEFROUTE=no
NM_CONTROLLED=no
IPV6INIT=no
[root@node-1 ~]#
[root@node-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens224
# Generated by VDSM version 4.20.32-1.el7
DEVICE=ens224
MASTER=bond1
SLAVE=yes
ONBOOT=yes
MTU=1500
DEFROUTE=no
NM_CONTROLLED=no
IPV6INIT=no
[root@node-1 ~]#

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment