Alexandre Blanchette
2014-Dec-10 13:17 UTC
[syslinux] Checking if host is on the same subnet
We are doing a deployment across many sites, we're doing one site at a time and we're bringing a "mobile server" (a laptop, really) to keep traffic local instead saturating the WAN link of each site. I'd like to make a script so each client can determine if the mobile server is on the same subnet either with a ping with a zero TTL value, with the ip/netmask and a bit of binary logic, or any other mean. Currently, PXELINUX is calling an iPXE script, so the solution can be at either level. -- Alexandre Blanchette <blanalex at gmail.com>
Alexandre Blanchette <blanalex at gmail.com> writes:> We are doing a deployment across many sites, we're doing one site at a time > and we're bringing a "mobile server" (a laptop, really) to keep traffic > local instead saturating the WAN link of each site. > > I'd like to make a script so each client can determine if the mobile server > is on the same subnet either with a ping with a zero TTL value, with the > ip/netmask and a bit of binary logic, or any other mean. > > Currently, PXELINUX is calling an iPXE script, so the solution can be at > either level.You should be able to do this via Lua and its DHCP module. You will find partial documentation only, but for generic info see https://github.com/wferi/syslinux/blob/pub/com32/lua/doc/syslinux.asc (the loadfile and initramfs parts document a future plan) and https://github.com/wferi/syslinux/blob/pub/com32/lua/src/dhcp.c (but don't forget the dhcp = require "dhcp"). -- Regards, Feri.
Alexandre Blanchette <blanalex at gmail.com> writes:> On Wed, Dec 10, 2014 at 10:14 AM, Ferenc Wagner <wferi at niif.hu> wrote: > >> Alexandre Blanchette <blanalex at gmail.com> writes: >> >>> We are doing a deployment across many sites, we're doing one site at >>> a time and we're bringing a "mobile server" (a laptop, really) to >>> keep traffic local instead saturating the WAN link of each site. >>> >>> I'd like to make a script so each client can determine if the mobile >>> server is on the same subnet either with a ping with a zero TTL >>> value, with the ip/netmask and a bit of binary logic, or any other >>> mean. >>> >>> Currently, PXELINUX is calling an iPXE script, so the solution can >>> be at either level. >> >> You should be able to do this via Lua and its DHCP module. You will >> find partial documentation only, but for generic info see >> https://github.com/wferi/syslinux/blob/pub/com32/lua/doc/syslinux.asc >> (the loadfile and initramfs parts document a future plan) and >> https://github.com/wferi/syslinux/blob/pub/com32/lua/src/dhcp.c >> (but don't forget the dhcp = require "dhcp"). > > Well, I'm missing a piece of the puzzle, I need to do a DNS lookup of > the mobile host. This is a "mobile" server, it doesn't have a static > IP.And you always change its DNS record according to the current location? I thought its address was provided via DHCP to the clients. Can't you arrange that? Exporting Lua bindings to DNS functionality would also be feasible by patching Syslinux, but I'm somewhat confused by the PXE/lwIP duality here. But for booting, DHCP should be enough, and if you need this decision after booting, then you've already got your operation system to help you. What does this mobile server provide? -- Regards, Feri.
> Alexandre Blanchette <blanalex at gmail.com> writes: > > > On Wed, Dec 10, 2014 at 10:14 AM, Ferenc Wagner <wferi at niif.hu> wrote: > > > >> Alexandre Blanchette <blanalex at gmail.com> writes: > >> > >>> We are doing a deployment across many sites, we're doing one site at > >>> a time and we're bringing a "mobile server" (a laptop, really) to > >>> keep traffic local instead saturating the WAN link of each site. > >>> > >>> I'd like to make a script so each client can determine if the mobile > >>> server is on the same subnet either with a ping with a zero TTL > >>> value, with the ip/netmask and a bit of binary logic, or any other > >>> mean. > >>> > >>> Currently, PXELINUX is calling an iPXE script, so the solution can > >>> be at either level. > >> > >> You should be able to do this via Lua and its DHCP module. You will > >> find partial documentation only, but for generic info see > >> https://github.com/wferi/syslinux/blob/pub/com32/lua/doc/syslinux.asc > >> (the loadfile and initramfs parts document a future plan) and > >> https://github.com/wferi/syslinux/blob/pub/com32/lua/src/dhcp.c > >> (but don't forget the dhcp = require "dhcp"). > > > > Well, I'm missing a piece of the puzzle, I need to do a DNS lookup of > > the mobile host. This is a "mobile" server, it doesn't have a static > > IP. > > And you always change its DNS record according to the current location? > I thought its address was provided via DHCP to the clients. Can't you > arrange that? Exporting Lua bindings to DNS functionality would also be > feasible by patching Syslinux, but I'm somewhat confused by the PXE/lwIP > duality here. But for booting, DHCP should be enough, and if you need > this decision after booting, then you've already got your operation > system to help you. What does this mobile server provide? > -- > Regards, > Feri. > _______________________________________________ > Syslinux mailing list > Submissions to Syslinux at zytor.com > Unsubscribe or set options at: > http://www.zytor.com/mailman/listinfo/syslinux >I'm not sure about this, but perhaps the SYSAPPEND directive could help? http://www.syslinux.org/wiki/index.php/Config#SYSAPPEND Regards, Ady.