Mailinglist Archive: opensuse-autoinstall (59 mails)
| < Previous | Next > |
Re: [opensuse-autoinstall] PXE installation and endless loop
- From: Mike Marion <mmarion@xxxxxxxxxxxx>
- Date: Thu, 31 Jan 2008 15:07:37 -0800
- Message-id: <20080131230736.GE20295@xxxxxxxxxxxxxxxxxxxxxx>
On Thu, Jan 31, 2008 at 10:00:26AM -0500, Wayman Smith wrote:
Assuming I'm getting what you're missing :)...
The tftp server exportfs /tftpboot to the world with no_root_squash
(since the clients will be root owned processes when they go to either
delete the file or use sed to change it).
We pass the host and device (some of that left over from when we
sometimes did pxe boots off eth1 on a closed loop network but later
configured eth0 on the company network) on the /proc/cmdline like so:
pxe=eth0,0,1.2.3.4
The values figured out from that before the tftp config file is
deleted/changed are (I do this using Bash variable conventions):
cmdline=`cat /proc/cmdline`
pxe_ip=${cmdline/*pxe=eth[0-9],[0-9],/}
pxe_ip=${pxe_ip/ */}
pxe_dev=${cmdline/*pxe=/}
pxe_dev=${pxe_dev/,*/}
pxe_dev=eth0
Note: the middle number 0 is another left over where scripts would
assume if it was a 1 instead of 0 then the install tree was on the same
host as the pxe_ip value.. I since figured out how to get the full nfs
install path another way, but left this in for old scripts.
Then the script can get the mac address and figure out the file on the
tftp server named for that mac:
mycfg=`ifconfig $pxe_dev | awk '/HWaddr/{print $NF}' | sed 's/:/-/g' | tr
'[:upper:]' '[:lower:]'`
mycfg="01-$mycfg"
So host with mac 00:0C:6E:7A:69:D1 becomes file 01-00-0c-6e-7a-69-d1
Also have to mount the path off the tftp server in order to change the
file:
mount -o rw,nolock ${pxe_ip}:$pxe_path /tmp/pxe
pxe_path=/tftpboot (another thing where we use a slightly different path
in some cases)
So in my example the mount becomes:
mount -o rw,nolock 1.2.3.4:/tftpboot /tmp/pxe
You can then use sed to change the config file, which would be
/tmp/pxe/pxelinux.cfg/01-00-0c-6e-7a-69-d1
--
Mike Marion-Unix SysAdmin/Staff IT Engineer-http://www.qualcomm.com
Beer recipe: free! ~= Source
Cold pints: $2 ~= Product
Safe rides home, any hour: $25 ~= Technical Support
--
To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-autoinstall+help@xxxxxxxxxxxx
I would like to employ this solution. But if I understand correctly, you
use a chroot script to edit the MAC address specific configuration file.
I understand the sed portion of what you are doing, but I don't realize
how the client machine is accessing the MAC address specific
configuration file on the server. But this is the ideal solution.
Assuming I'm getting what you're missing :)...
The tftp server exportfs /tftpboot to the world with no_root_squash
(since the clients will be root owned processes when they go to either
delete the file or use sed to change it).
We pass the host and device (some of that left over from when we
sometimes did pxe boots off eth1 on a closed loop network but later
configured eth0 on the company network) on the /proc/cmdline like so:
pxe=eth0,0,1.2.3.4
The values figured out from that before the tftp config file is
deleted/changed are (I do this using Bash variable conventions):
cmdline=`cat /proc/cmdline`
pxe_ip=${cmdline/*pxe=eth[0-9],[0-9],/}
pxe_ip=${pxe_ip/ */}
pxe_dev=${cmdline/*pxe=/}
pxe_dev=${pxe_dev/,*/}
From the above example, these would result in:pxe_ip=1.2.3.4
pxe_dev=eth0
Note: the middle number 0 is another left over where scripts would
assume if it was a 1 instead of 0 then the install tree was on the same
host as the pxe_ip value.. I since figured out how to get the full nfs
install path another way, but left this in for old scripts.
Then the script can get the mac address and figure out the file on the
tftp server named for that mac:
mycfg=`ifconfig $pxe_dev | awk '/HWaddr/{print $NF}' | sed 's/:/-/g' | tr
'[:upper:]' '[:lower:]'`
mycfg="01-$mycfg"
So host with mac 00:0C:6E:7A:69:D1 becomes file 01-00-0c-6e-7a-69-d1
Also have to mount the path off the tftp server in order to change the
file:
mount -o rw,nolock ${pxe_ip}:$pxe_path /tmp/pxe
pxe_path=/tftpboot (another thing where we use a slightly different path
in some cases)
So in my example the mount becomes:
mount -o rw,nolock 1.2.3.4:/tftpboot /tmp/pxe
You can then use sed to change the config file, which would be
/tmp/pxe/pxelinux.cfg/01-00-0c-6e-7a-69-d1
--
Mike Marion-Unix SysAdmin/Staff IT Engineer-http://www.qualcomm.com
Beer recipe: free! ~= Source
Cold pints: $2 ~= Product
Safe rides home, any hour: $25 ~= Technical Support
--
To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-autoinstall+help@xxxxxxxxxxxx
| < Previous | Next > |