Parsing subnet
|
2016-10-18, 15:44
Post: #1
|
|||
|
|||
Parsing subnet
Hi,
I have a query. I want to get the first three numbers from the subnet mask. For example Net0/netmask = 192.169.168.34 But i need to get first 3 digits, my output should be like 192.169.168 Thanks in advance |
|||
2016-10-18, 18:18
Post: #2
|
|||
|
|||
RE: Parsing subnet
(2016-10-18 15:44)Yeswanth Wrote: I have a query. I want to get the first three numbers from the subnet mask. (assuming that you ment to type netX/ip and not net0/netmask, or that the mask actually is a valid mask?) There is no way inside of iPXE (yet) to parse parts of anything. The recommended way if you really need this is to do it server side, that is doing chain http://server/script?ip=${netX/ip} Which in turn returns something like Code: #!ipxe but most of the time when someone asks similar things about getting part of ip, normally it is for some kind of logic where gateway or dns would make more sense to use. What will you use this 3octet mask for? Use GitHub Discussions VRAM bin |
|||
2016-10-19, 03:10
Post: #3
|
|||
|
|||
RE: Parsing subnet
(2016-10-18 18:18)NiKiZe Wrote:(2016-10-18 15:44)Yeswanth Wrote: I have a query. I want to get the first three numbers from the subnet mask. Hi Thanks for the reply Dhcp server will assign some ip's and subnet to some boards and i need to verify that if the subnet mask iseq to the 192.168.169 (i.e the first 3 octet) then i proceeding with execution of some steps or else i will retry |
|||
2016-10-19, 07:15
Post: #4
|
|||
|
|||
RE: Parsing subnet
(2016-10-19 03:10)Yeswanth Wrote: subnet mask iseq to the 192.168.169 That is not a valid netmask! ( For reference i found this simple list of valid netmasks: http://www.unixwiz.net/techtips/netmask-ref.html ) it could be a ip address, and in that case you would probably have a static address on the gateway that you can check for instead. IMHO a good tool for understanding netmasks is ipcalc Use GitHub Discussions VRAM bin |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)