Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Few scripting questions
2015-10-22, 23:22 (This post was last modified: 2015-10-22 23:37 by SoulA.)
Post: #1
Few scripting questions
I'm trying to enumerate interfaces from within iPXE. I figured I could loop through each one doing "dhcp net${i}", then looking for info on the NIC like "${netX/dhcp-server}" and finally closing the interface with "ifclose net${i}".

I would like to skip over the interface that iPXE used when initially booting. The problem is I'm not seeing a way to get the name or even index of the current interface. Something like "${netX/ip}" except "${netX/index}" which returns "net0" for example.

Anything like this available that I'm just not seeing?

Second problem is there is the possibility that in our setup iPXE might be waiting around on a menu screen and intermittently checking an HTTP server for any boot instructions. Since iPXE doesn't have anything built into renew it's DHCP address before it's lease expires I figured I could do "dhcp net0" (also needs the index above) which seems to renew it just fine.

The problem with this is after doing that it seems to break being able to do relative paths in scripts. The reason we need to renew is I don't want the DHCP server to hand out another lease with the same IP.
Some psuedo code of what a script might look like for the interface enumeration http://pastebin.com/TRnAMkR5.
Find all posts by this user
Quote this message in a reply
2016-03-17, 12:53
Post: #2
RE: Few scripting questions
With newer versions of iPXE you can get ${netX/ifname} which should return net0 or net1, depending on which interface you use. Then you can use the inc command to iterate through interfaces and skip the one that matches the open one.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)