gravitl / netmaker

Netmaker makes networks with WireGuard. Netmaker automates fast, secure, and distributed virtual networks.
https://netmaker.io
Other
9.51k stars 552 forks source link

[Bug]: windows/linux /etc/hosts file repeating entries #1184

Closed si458 closed 2 years ago

si458 commented 2 years ago

Contact Details

No response

What happened?

when checking my c:\windows\system32\drivers\etc\hosts file on ANY of my windows machines the file is neally 1MB in size, when opening it, it is just repeating entry and entry and entry of ALL my servers connected to my netmaker network?

whats also weird is it enters everything on first run correctly, as shown below, but then at intervals its inserting everything again and missing the name off completely?

Version

v0.14.2

What OS are you using?

Windows / Linux

Relevant log output

# profile.on nm-my
10.28.38.4 maycocksserver.myNetwork
10.28.38.8 ColinServer.myNetwork
10.28.38.3 Win2016.myNetwork
10.28.38.254 netmaker-1.myNetwork
10.28.38.5 SalramServer.myNetwork
10.28.38.1 Win2012R2.myNetwork
# end

# profile.on nm-my
10.28.38.4 maycocksserver.myNetwork
10.28.38.8 ColinServer.myNetwork
10.28.38.3 Win2016.myNetwork
10.28.38.254 netmaker-1.myNetwork
10.28.38.5 SalramServer.myNetwork
10.28.38.1 Win2012R2.myNetwork
# end

# profile.on nm-myNetwork
10.28.38.4 maycocksserver.myNetwork
10.28.38.8 ColinServer.myNetwork
10.28.38.3 Win2016.myNetwork
10.28.38.254 netmaker-1.myNetwork
10.28.38.5 SalramServer.myNetwork
10.28.38.1 Win2012R2.myNetwork
# end

Contributing guidelines

si458 commented 2 years ago

so i created a new network called 'othernetwork' and im not seeing this issue now... so it appears to be a Capital letter issue with the network name, a simple fix would be in the create network to only allow lowercase letters

si458 commented 2 years ago

just checked my linux server and wow they are twice as worse! the /etc/hosts file was 15MB in size! with over 250,000 lines in it so just cleared the /etc/hosts files out, rejoined to the my othernetwork and i havent seen any replicate entries now

afeiszli commented 2 years ago

@si458 just want to clarify, this issue is present on both Windows and Linux, and is the result of having a capital letter in the network name, correct?

si458 commented 2 years ago

@si458 just want to clarify, this issue is present on both Windows and Linux, and is the result of having a capital letter in the network name, correct?

That is all correct 👌

mattkasun commented 2 years ago

v0.14.2 has switched to using the interface name (nm-network) rather than the network name for the /etc/hosts profile. Should add a check to switch to lower case if user has changed the interface name

afeiszli commented 2 years ago

fixed in v0.14.3