Skip to content

Commit

Permalink
fix HOSTIP bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Glenn committed Sep 7, 2021
1 parent ae4cb7a commit 645d9a7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ export COMPOSE_DOCKER_CLI_BUILD := 1
ifndef HOSTIP
ifeq ($(OS),Windows_NT)
HOSTIP := $(shell powershell -command '(Get-NetIPConfiguration | Where-Object {$$_.IPv4DefaultGateway -ne $$null -and $$_.NetAdapter.Status -ne "Disconnected"}).IPv4Address.IPAddress' )
# UPSTREAM_DNS := $(shell powershell -command '(Get-NetRoute | where {$$_.DestinationPrefix -eq '0.0.0.0/0'} | select { $$_.NextHop }' )
else
# UPSTREAM_DNS = $(shell /sbin/ip route | awk '/default/ { print $$3 }')
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
HOSTIP := $(shell ip route get 1 | head -1 | awk '{print $$7}' )
endif
Expand All @@ -20,7 +19,6 @@ ifndef HOSTIP
endif

export HOSTIP
export UPSTREAM_DNS

start: build
docker-compose up --force-recreate --remove-orphans -d
Expand All @@ -35,7 +33,6 @@ down:

echo:
@echo "HOSTIP: $(HOSTIP)"
@echo "UPSTREAM_DNS: $(UPSTREAM_DNS)"

logs:
docker-compose logs -f
Expand Down
2 changes: 1 addition & 1 deletion app/dns_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(log)
Template.new("/etc/dnsmasq.conf", "/app/templates/dnsmasq.conf.erb", log).write_template()

#start dnsmasq
log.info "Starting dnsmasq..."
log.info "Starting dnsmasq with HOSTIP=#{ENV['HOSTIP']}..."
@dnsmasq_process = fork { exec "/usr/sbin/dnsmasq" }
end

Expand Down
1 change: 1 addition & 0 deletions app/templates/dnsmasq.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ keep-in-foreground
domain-needed
dns-loop-detect
port=54
cache-size=0
log-facility=-
#log-queries
#log-debug

0 comments on commit 645d9a7

Please sign in to comment.