Bug 1376924

Summary: satellite 6 provisioning a client with 2 nics will have to default gateways
Product: Red Hat Satellite Reporter: Fotios Tsiadimos <ftsiadim>
Component: NetworkingAssignee: Marek Hulan <mhulan>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: urgent Docs Contact:
Priority: medium    
Version: 6.2.0CC: bbuckingham, dmoessne, jcallaha, kdixon, ldelouw, mhulan, mmccune, mmello, snemeth
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fotios Tsiadimos 2016-09-16 20:26:01 UTC
Description of problem:
satellite 6 provisioning a client with 2 nics will have to default gateways.


Version-Release number of selected component (if applicable):

Satelltie 6.2.2

How reproducible:

Create 2 subnets on the Satellite and specify the gateway for etch one then create a client and add 2 networks to point to these 2 subnets. After you kickstart the client the client will have 2 default gateways. when we create a new host we need to have an option to specify the default gateway instead to remove the gateway from the subnets.

Comment 10 Marek Hulan 2017-01-18 09:45:11 UTC
Created redmine issue http://projects.theforeman.org/issues/18125 from this bug

Comment 12 Satellite Program 2017-01-18 11:18:41 UTC
Upstream bug assigned to mhulan

Comment 13 Satellite Program 2017-01-18 11:18:44 UTC
Upstream bug assigned to mhulan

Comment 14 Satellite Program 2017-01-18 19:18:20 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/18125 has been resolved.

Comment 17 Marek Hulan 2017-04-04 06:54:24 UTC
*** Bug 1386295 has been marked as a duplicate of this bug. ***

Comment 18 daniel 2017-09-27 15:50:26 UTC
In case one has 2 subnets configured with 2 gateways we really get 2 default gateways configured:


[root@server-static-vlan105-test-165 ~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         172.24.105.254  0.0.0.0         UG        0 0          0 eth0
0.0.0.0         172.24.104.254  0.0.0.0         UG        0 0          0 eth1
172.24.104.0    0.0.0.0         255.255.255.0   U         0 0          0 eth1
172.24.105.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0
[root@server-static-vlan105-test-165 ~]# 


----------------------
[root@sat6 ~]# hammer host info --name server-static-vlan105-test-165.vlan105.example.com 
Id:                 220
Name:               server-static-vlan105-test-165.vlan105.example.com
Organization:       server
Location:           Lab/RHV_vlan105
Host Group:         HG-server-vlan105-static
Compute Profile:    CP-server-vlan105-static
Puppet CA Id:       
Puppet Master Id:   
Cert name:          server-static-vlan105-test-165.vlan105.example.com
Managed:            yes
Installed at:       2017/09/27 13:16:39
Last report:        
Network:            
    IP:     172.24.105.165
    MAC:    00:1a:4a:60:00:e0
    Subnet: static-vlan105.example.com
    Domain: vlan105.example.com
Network interfaces: 
 1) Id:          365
    Identifier:  
    Type:        interface (primary, provision)
    MAC address: 00:1a:4a:60:00:e0
    IP address:  172.24.105.165
    FQDN:
 2) Id:          366
    Identifier:  
    Type:        interface
    MAC address: 00:1a:4a:60:00:e1
    IP address:  172.24.104.165
    FQDN:
Operating system:   
    Architecture:           x86_64
    Operating System:       RedHat 7.4
    Build:                  no
    Medium:                 server/Library/Red_Hat_Server/Red_Hat_Enterprise_Linux_7_Server_Kickstart_x86_64_7_4
    Partition Table:        Kickstart default
    Custom partition table:
Parameters:         

Additional info:    
    Owner Id:   6
    Owner Type: User
    Enabled:    yes
    Comment:

[root@sat6 ~]# 

[root@sat6 ~]# hammer host interface list  --host server-static-vlan105-test-165.vlan105.example.com 
----|------------|--------------------------------|-------------------|----------------|------------------------------------------------------------
ID  | IDENTIFIER | TYPE                           | MAC ADDRESS       | IP ADDRESS     | DNS NAME                                                   
----|------------|--------------------------------|-------------------|----------------|------------------------------------------------------------                                                         
365 |            | interface (primary, provision) | 00:1a:4a:60:00:e0 | 172.24.105.165 | server-static-vlan105-test-165.vlan105.example.com
366 |            | interface                      | 00:1a:4a:60:00:e1 | 172.24.104.165 | server-static-vlan104-test-165.vlan104.example.com  
----|------------|--------------------------------|-------------------|----------------|------------------------------------------------------------
[root@sat6 ~]# 





------------------------

cloned kickstart_networking_setup to kickstart_networking_setup2 and changed it as suggested by https://bugzilla.redhat.com/show_bug.cgi?id=1376924 / http://projects.theforeman.org/issues/18125  , also cloned default kickstart template and added the new snippet there (renaming kickstart_networking_setup to kickstart_networking_setup2 and associated this to the OS,
redeployed host:


[root@server-static-vlan105-test-165 ~]# ip r
default via 172.24.105.254 dev eth0 proto static metric 100 
172.24.104.0/24 dev eth1 proto kernel scope link src 172.24.104.100 metric 100 
172.24.105.0/24 dev eth0 proto kernel scope link src 172.24.105.165 metric 100 
[root@server-static-vlan105-test-165 ~]# 

[root@server-static-vlan105-test-165 ~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         172.24.105.254  0.0.0.0         UG        0 0          0 eth0
172.24.104.0    0.0.0.0         255.255.255.0   U         0 0          0 eth1
172.24.105.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0
[root@server-static-vlan105-test-165 ~]# 

[root@sat6 ~]# hammer host info --name server-static-vlan105-test-165.vlan105.example.com 
Id:                 220
Name:               server-static-vlan105-test-165.vlan105.example.com
Organization:       server
Location:           Lab/RHV_vlan105
Host Group:         HG-server-vlan105-static-nw-template
Compute Profile:    CP-server-vlan105-static
Puppet CA Id:       
Puppet Master Id:   
Cert name:          server-static-vlan105-test-165.vlan105.example.com
Managed:            yes
Installed at:       2017/09/27 13:45:41
Last report:        
Network:            
    IP:     172.24.105.165
    MAC:    00:1a:4a:60:00:e0
    Subnet: static-vlan105.example.com
    Domain: vlan105.example.com
Network interfaces: 
 1) Id:          365
    Identifier:  
    Type:        interface (primary, provision)
    MAC address: 00:1a:4a:60:00:e0
    IP address:  172.24.105.165
    FQDN:
 2) Id:          366
    Identifier:  
    Type:        interface
    MAC address: 00:1a:4a:60:00:e1
    IP address:  172.24.104.165
    FQDN:
Operating system:   
    Architecture:           x86_64
    Operating System:       RedHat 7.4
    Build:                  no
    Partition Table:        Kickstart default
    Custom partition table:
Parameters:         

Additional info:    
    Owner Id:   6
    Owner Type: User
    Enabled:    yes
    Model:      RHEV Hypervisor
    Comment:

[root@sat6 ~]# 

[root@sat6 ~]# hammer host interface list  --host server-static-vlan105-test-165.vlan105.example.com 
----|------------|--------------------------------|-------------------|----------------|------------------------------------------------------------
ID  | IDENTIFIER | TYPE                           | MAC ADDRESS       | IP ADDRESS     | DNS NAME                                                   
----|------------|--------------------------------|-------------------|----------------|------------------------------------------------------------
365 |            | interface (primary, provision) | 00:1a:4a:60:00:e0 | 172.24.105.165 | server-static-vlan105-test-165.vlan105.example.com
366 |            | interface                      | 00:1a:4a:60:00:e1 | 172.24.104.165 | server-static-vlan104-test-165.vlan104.example.com  
----|------------|--------------------------------|-------------------|----------------|------------------------------------------------------------
[root@sat6 ~]# 



template :

~~~
#  interface
real=`ip -o link | grep 00:1a:4a:60:00:e0 | awk '{print $2;}' | sed s/:$//`

# ifcfg files are ignored by NM if their name contains colons so we convert colons to underscore
sanitized_real=$real

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$sanitized_real
BOOTPROTO="none"
IPADDR="172.24.105.165"
NETMASK="255.255.255.0"
GATEWAY="172.24.105.254"
DEVICE=$real
HWADDR="00:1a:4a:60:00:e0"
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
DEFROUTE=yes
DNS1=172.24.105.5
EOF




#  interface
real=`ip -o link | grep 00:1a:4a:60:00:e1 | awk '{print $2;}' | sed s/:$//`

# ifcfg files are ignored by NM if their name contains colons so we convert colons to underscore
sanitized_real=$real

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$sanitized_real
BOOTPROTO="none"
IPADDR="172.24.104.165"
NETMASK="255.255.255.0"
GATEWAY="172.24.104.254"
DEVICE=$real
HWADDR="00:1a:4a:60:00:e1"
ONBOOT=yes
PEERDNS=no
PEERROUTES=no
DEFROUTE=no
EOF

~~~


# diff -u Satellite_Kickstart_Default Satellite_Kickstart_Default_2
--- Satellite_Kickstart_Default	2017-09-27 16:14:53.123359219 +0200
+++ Satellite_Kickstart_Default_2	2017-09-27 16:15:05.189946712 +0200
@@ -94,7 +95,7 @@
 /usr/bin/chvt 3
 (
 <% if subnet.respond_to?(:dhcp_boot_mode?) -%>
-<%= snippet 'kickstart_networking_setup' %>
+<%= snippet 'kickstart_networking_setup2' %>
 <% end -%>
 
 #update local time
#



# diff -u kickstart_networking_setup kickstart_networking_setup2
--- kickstart_networking_setup	2017-09-27 16:16:04.621840310 +0200
+++ kickstart_networking_setup2	2017-09-27 16:16:30.708110389 +0200
@@ -88,6 +88,7 @@
 ONBOOT=yes
 PEERDNS=no
 PEERROUTES=no
+DEFROUTE=no
 <% if vlan -%>
 VLAN=yes
 <% elsif alias_type -%>
@@ -142,6 +143,7 @@
 <% if interface.respond_to?(:primary) && interface.primary -%>
 PEERDNS=yes
 PEERROUTES=yes
+DEFROUTE=yes
 <% if !dhcp && !subnet.dns_primary.nil? && !subnet.dns_primary.empty? -%>
 DNS1=<%= subnet.dns_primary %>
 <% if !subnet.dns_secondary.nil? && !subnet.dns_secondary.empty? -%>
@@ -151,6 +153,7 @@
 <% else -%>
 PEERDNS=no
 PEERROUTES=no
+DEFROUTE=no
 <% end -%>
 <% if vlan -%>
 VLAN=yes
#

Comment 23 Satellite Program 2018-02-21 16:54:17 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.
> 
> For information on the advisory, and where to find the updated files, follow the link below.
> 
> If the solution does not work for you, open a new bug report.
> 
> https://access.redhat.com/errata/RHSA-2018:0336