05.03.2024, 06:18
Use this:
If DHCP is used it is highly recommended to use a static IP-MAC binding so LM IP cannot change randomly.
Code:
routes = io.readproc('route')
gateway = routes:match('default%s+([%d%.]+)')
ifinfo = require('ifinfo')()
ip = ifinfo.eth0.inetaddr
log(ip, gateway)
If DHCP is used it is highly recommended to use a static IP-MAC binding so LM IP cannot change randomly.