Skip to content

Commit

Permalink
use gateway ip from setup.ini rather than firewall ip.
Browse files Browse the repository at this point in the history
  • Loading branch information
HappyBasher committed Aug 1, 2023
1 parent 8b86c6d commit fa83151
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sbin/linuxmuster-import-subnets
Expand Up @@ -2,7 +2,7 @@
#
# linuxmuster-import-subnets
# thomas@linuxmuster.net
# 20230728
# 20230801
#

import ast
Expand All @@ -24,6 +24,7 @@ from IPy import IP
# read necessary values from setup.ini and other sources
serverip = getSetupValue('serverip')
domainname = getSetupValue('domainname')
gateway = getSetupValue('gateway')
firewallip = getSetupValue('firewallip')
# get boolean value
skipfw = ast.literal_eval(getSetupValue('skipfw'))
Expand Down Expand Up @@ -115,13 +116,13 @@ def updateNetplan(subnets):
None
# set default route
ifcfg['routes'] = []
subroute = eval('{"to": \'default\', "via": \'' + firewallip + '\'}')
subroute = eval('{"to": \'default\', "via": \'' + gateway + '\'}')
ifcfg['routes'].append(subroute)
# add subnet routes if there are any beside server network
if len(subnets) > 0:
for item in subnets:
# skip if firewall is gateway, it's the default gw anyway
if servernet_router == firewallip:
# skip if subnet gateway is the default
if servernet_router == gateway:
continue
subnet = item.split(':')[0]
# tricky: concenate dict object for yaml using eval
Expand Down

0 comments on commit fa83151

Please sign in to comment.