Bug #11440
closedNetwork bonding is not working properly when provisioning CenOS/RHEL servers because the default gateway is not set.
Description
Hello.
I provisioned the physical server with bonded two interfaces and the final provisioned server didn't have default gateway configured properly.
I successfully create the host and created bond properly for CentOS6 server:
hammer host create --model "ProLiant BL685c G1" --medium "My_CentOS_mirror" --name "server01.example.com" --operatingsystem-id $OPERATINGSYSTEM_ID --partition-table-id $PARTITION_TABLE_ID --root-pass "12345678" \ --puppet-proxy-id 1 --architecture-id $ARCHITECTURE_ID --environment-id $ENVIRONMENT_ID --domain-id $DOMAIN_ID --hostgroup "hosts" \ --interface="type=bond,mac=00:1E:0B:20:FE:3A,ip=10.2.4.5,name=server01-oam,subnet_id=$SUBNET_OAM_ID,domain_id=$DOMAIN_ID,mode=balance-rr,attached_devices=[eth0,eth1],identifier=bond0,primary=true,provision=true" \ --interface="type=bond,mac=00:1c:c4:a6:f4:90,ip=10.2.4.131,name=server01-traffic,subnet_id=$SUBNET_TRAFFIC_ID,domain_id=$DOMAIN_ID,mode=balance-rr,attached_devices=[eth4,eth5],identifier=bond1" \ --interface="type=bond,mac=00:1c:c4:a6:f4:92,ip=192.168.0.5,name=server01-internal,subnet_id=$SUBNET_INTERN_ID,domain_id=$DOMAIN_ID,mode=balance-rr,attached_devices=[eth6,eth7],identifier=bond2" \ --interface="type=interface,mac=00:1E:0B:20:FE:3A,identifier=eth0" \ --interface="type=interface,mac=00:1E:0B:20:FE:3E,identifier=eth1" \ --interface="type=interface,mac=00:1C:C4:AB:E9:45,identifier=eth2" \ --interface="type=interface,mac=00:1C:C4:AB:E9:46,identifier=eth3" \ --interface="type=interface,mac=00:1c:c4:a6:f4:90,identifier=eth4" \ --interface="type=interface,mac=00:1c:c4:a6:f4:91,identifier=eth5" \ --interface="type=interface,mac=00:1c:c4:a6:f4:92,identifier=eth6" \ --interface="type=interface,mac=00:1c:c4:a6:f4:93,identifier=eth7"
I can see these lines especially the "DEFROUTE=no" in the Kickatrt template generated for the server:
# bond0 interface real="bond0" cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$real BOOTPROTO="dhcp" DEVICE="$real" ONBOOT=yes PEERDNS=no PEERROUTES=no DEFROUTE=no TYPE=Bond BONDING_OPTS=" mode=balance-rr" BONDING_MASTER=yes NM_CONTROLLED=no EOF
Parameter "DEFROUTE=no" disables of using the default gateway specified by DHCP or specified in /etc/sysconfig/network in case of static configuration.
This is most probably the bug. I suggest to remove this line when generating the bond configuration (like it's in case of standard "eth" interfaces)
Maybe it's enough to remove this line from "/usr/share/foreman/app/views/unattended/snippets/_kickstart_networking_setup.erb" (I'm not sure)
Here are the details form the provisioned server:
# cat /etc/sysconfig/network-scripts/ifcfg-bond0 BOOTPROTO="dhcp" DEVICE="bond0" ONBOOT=yes PEERDNS=no PEERROUTES=no DEFROUTE=no TYPE=Bond BONDING_OPTS=" mode=balance-rr" BONDING_MASTER=yes NM_CONTROLLED=no # ip r s 10.2.4.0/25 dev bond0 proto kernel scope link src 10.2.4.5 10.2.4.128/25 dev bond1 proto kernel scope link src 10.2.4.131 192.168.0.0/24 dev bond2 proto kernel scope link src 192.168.0.5 169.254.0.0/16 dev bond0 scope link metric 1010 169.254.0.0/16 dev bond1 scope link metric 1011 169.254.0.0/16 dev bond2 scope link metric 1012
No default GW configured above!
I removed manually the "DEFROUTE=no" from "/etc/sysconfig/network-scripts/ifcfg-bond0" + restart the networking and everything starts working like it should be:
# ip r s | grep default default via 10.2.4.1 dev bond0
Thank you for looking at it.
PetrR
Updated by Dominic Cleal about 9 years ago
- Description updated (diff)
- Translation missing: en.field_release deleted (
72)
Updated by The Foreman Bot about 9 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2628 added
- Pull request deleted (
)
Updated by Petr Ruzicka about 9 years ago
I added the fix to the "community-templates":
https://github.com/theforeman/community-templates/pull/201
Regards
PetrR
Updated by Marek Hulán about 9 years ago
- Assignee set to Petr Ruzicka
- Priority changed from High to Normal
- Pull request https://github.com/theforeman/community-templates/pull/201 added
- Pull request deleted (
https://github.com/theforeman/foreman/pull/2628)
Lowering the priority since it's easy to modify the configuration snippet.
Updated by Dominic Cleal almost 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Translation missing: en.field_release set to 63
Updated by Petr Ruzicka almost 9 years ago
Hello.
I was testing it on the real hardware and actually the line should looks like this:
DEFROUTE="<%= bond.primary ? 'yes' : 'no' -%>"
What is committed before will break the whole template :-(
I'll create another pull request via github for this issue and we can discuss it to see it there.
Regards
PetrR
Updated by Dominic Cleal almost 9 years ago
Sure, please just open up a new PR and we'll get it in. Thanks.
Updated by Petr Ruzicka almost 9 years ago
Hello.
Here is the pull request: https://github.com/theforeman/community-templates/pull/204
Please let me know if you want to create new "bug" or if we can manage it as a part of this "closed" one.
Thank you
PetrR
Updated by Dominic Cleal almost 9 years ago
Using this is fine, thanks. We don't usually require tickets for community-templates.