Skip to content

Commit

Permalink
Update DHCP ranges and gateway IP
Browse files Browse the repository at this point in the history
  • Loading branch information
jschenke488 authored Oct 30, 2024
1 parent 21e091f commit 7aa774f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions network/dnsmasq.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ func (dm *DnsMasq) ConfigureTeamEthernet(teams [6]*model.Team) error {
if oldTeamVlans[team.Id] == vlan {
delete(oldTeamVlans, team.Id)
} else {
teamPartialIp := fmt.Sprintf("%d.%d", team.Id/100, team.Id%100)
contents := []byte(fmt.Sprintf(
"# Options for VLAN%d\n"+
"# Team %d\n"+
"\n"+
"dhcp-range=set:vlan%d,10.%d.%d.101,10.%d.%d.199,255.255.255.0,12h\n"+
"dhcp-option=tag:vlan%d,3,10.%d.%d.61\n",
vlan, team.Id, vlan, team.Id/100, team.Id%100, team.Id/100, team.Id%100,
vlan, team.Id/100, team.Id%100))
"dhcp-range=set:vlan%d,10.%s.20,10.%s.199,255.255.255.0,12h\n"+
"dhcp-option=tag:vlan%d,3,10.%s.4\n",
vlan, team.Id, vlan, teamPartialIp, teamPartialIp,
vlan, teamPartialIp))
err := ioutil.WriteFile(fmt.Sprintf("/etc/dnsmasq.d/vlan%d.conf", vlan), contents, 0664)
if err != nil {
log.Printf("Failed to configure VLAN%d for team %d: %s", vlan, team.Id, err.Error())
Expand Down

0 comments on commit 7aa774f

Please sign in to comment.