Difference between pages "Zero Configuration Networking" and "PXE Network Windows Installation"

From Funtoo
(Difference between pages)
Jump to: navigation, search
(Receiving mDNS)
 
(Creating a Setup Instruction File)
 
Line 1: Line 1:
Zero Configuration Networking, also called Zeroconf or [[wikipedia:Bonjour_(software)|Bonjour]] ([http://developer.apple.com/softwarelicensing/agreements/bonjour.html Apple's trademark] for their Zero Configuration Networking implementation) is a suite of related technologies that allow networked devices to interoperate on a local network without requiring explicit configuration.
+
''Howto use your Funtoo machine to serve a MS Windows installation over the network''
 +
In this guide we will assume that you have followed the [[PXE network boot server]] Wiki article and have a working network/pxe boot setup. As of now this guide will cover Windows XP. Soon it will be expanded to also cover Windows 7.  
 +
==Prerequisites==
 +
#A working Funtoo installation
 +
#A working PXE Setup (DHCP, TFTP, PXELinux)
 +
#app-arch/cabextract
 +
#A legitimate copy of Microsoft Windows
 +
#Driver for your NIC - ''Suggested to use a complete driver pack with all major supported NIC hardware for the version of Windows to be installed.''
 +
#RIS Linux toolkit >=0.4
 +
#A working Samba server setup
  
== Requirements ==
+
== Creating the Windows XP Image ==
  
Zero Configuration Networking requires the following things to operate:
+
*In the previous guide, [http://www.funtoo.org/wiki/PXE_network_boot_server PXE Network Boot Server], we used /tftproot as the working directory so we will also use it in this guide for convenience. If you chose to use a different working directory then please apply it where needed in place of the /tftproot we will be going by here.
  
* A valid IP address, obtained either by:
+
First you will need to create an ISO from your Windows XP installation disc. If you already have the ISO image you may skip this step.
** Static assignment
+
** DHCP
+
** Link-local Addressing (part of Zero Configuration Networking)
+
* A means to address other devices by name, provided either by:
+
** DNS
+
** multicast DNS (mDNS -- part of Zero Configuration Networking)
+
  
== Service Discovery ==
+
<console>
 
+
###i## dd if=/dev/sr0 of=/tftproot/winxp.iso
On top of this, Zero Configuration Networking also provides a means to discover what services are available on each device. This is something that is provided exclusively by Zero Configuration Networking and is called Zeroconf Service Discovery.
+
</console>
 
+
If your cdrom device isn't ''<code>/dev/sr0</code>'' please use the appropriate device in this command.
== Configuration ==
+
 
+
In order to get these sort of networking services running, some configuration needs to happen initially.
+
 
+
== Link-local Addresses ==
+
 
+
{{Note}} It's only necessary to use link-local addressing if you have no other means of obtaining a valid IP address on your LAN. Typically, this is the case if you are setting up a small or ad-hoc network where no DHCP server has been configured.
+
  
To use link-local addressing, first set up the proper routes:
+
== Mount the ISO and Prepare Installation Sources ==
 +
Mount the image to ''<code>/tftproot/cdrom</code>'':  
 
<console>
 
<console>
###i## route add default dev eth0 metric 99
+
###i## mkdir /tftproot/cdrom; mount -o loop /tftproot/winxp.iso /tftproot/cdrom
###i## route add -net 169.254.0.0 netmask 255.255.0.0 dev eth0 metric 99
+
 
</console>
 
</console>
 
+
Create the new directory for the network installation files and copy the needed files to it:
Then, use avahi-autoipd to discover a valid link-local IP address:
+
 
<console>
 
<console>
###i## /usr/sbin/avahi-autoipd --daemonize --syslog --wait eth0
+
###i## mkdir /tftproot/winxp; cp -R /tftproot/cdrom/i386 /tftproot/winxp/i386
 +
</console>
 +
Depending on your CD/DVD copy of windows the directory name may be I386 as opposed to i386, if that is the case you will just need to change the first part of the command, keeping the new directory name i386 - this is going to be very important later on when creating the remap file!
 +
Check the contents of your newly created i386 directory to see if the filenames are in all CAPS or if they are already in lowercase.
 +
<console>
 +
###i## ls /tftproot/winxp/i386
 +
</console>
 +
If you happen to have all UPPERCASE filenames, lets go ahead and run a script to convert it to all lowercase:
 +
<console>
 +
###i## cd /tftproot/winxp/i386;ls | awk '$0!=tolower($0){printf "mv \"%s\" \"%s\"\n",$0,tolower($0)}' | sh
 
</console>
 
</console>
  
Once a valid link-local IP address is found, eth0 will now have a 169.254.x.x address that can be used to communicate on the local LAN.
+
==Extracting and Modifying the Required Boot Files ==
 
+
Install {{Package|app-arch/cabextract}}
As an alternative, you can have dhcpcd built with <code>USE="zeroconf"</code>, and it will provide a link local address if no DHCP server is found.
+
<console>
 
+
###i## emerge -av app-arch/cabextract
== Multicast DNS ==
+
</console>
 
+
Extract the prepackaged drivers:
Multicast DNS, or mDNS, is a means by which individual machines can broadcast their DNS information to machines on the local LAN so that a DNS server is not required to address local devices by name. The ".local" domain is typically used for multicast DNS, so your laptop might be addressable by pinging "mylaptop.local", for example. mDNS is not necessary if you have some other means of addressing machines by name, such as unicast (regular) DNS. But many LANs do not have their own DNS server configured, in which case mDNS can be very handy.
+
<console>
 
+
###i## cd /tftproot/winxp/i386;cabextract driver.cab
=== .local Hostname Suffix ===
+
</console>
 
+
Install support for a large list of network cards:
If you want to configure your Funtoo Linux system to be addressable on your LAN using a <tt>myhostname.local</tt> address, first ensure that you set your system's hostname in <tt>/etc/conf.d/hostname</tt>, and use ''only'' the non-qualified name, so don't add a <tt>.local</tt> yourself. Multicast DNS will automatically use that suffix. Here is a sample <tt>/etc/conf.d/hostname</tt> for a machine on my network that I can ping from other machines as <tt>antec.local</tt>:
+
<console>
 +
###i## cd /tftproot/;wget http://downloads.sourceforge.net/project/bootfloppy/pxefiles.tar.gz
 +
###i## tar zxvf pxefiles.tar.gz; cp pxefiles/drivers/* winxp/i386/
 +
</console>
 +
Copy the BINLSRV /INFParser tools to /tftproot:
 +
<console>
 +
###i## cp pxefiles/script/* /tftproot/
 +
</console>
 +
Extract the netboot startrom:
 +
<console>
 +
###i## cd /tftproot; cabextract winxp/i386/startrom.n1_
 +
</console>
 +
Fix the startrom for netbooting xp:
 +
<console>
 +
###i## sed -i -e 's/NTLDR/XPLDR/gi' startrom.n12
 +
###i## mv startrom.n12 winxp.0
 +
</console>
 +
Fix XPLDR:
 +
<console>
 +
###i## cabextract winxp/i386/setupldr.ex_
 +
###i## sed -i -e 's/winnt\.sif/winxp\.sif/gi' setupldr.exe
 +
###i## sed -i -e 's/ntdetect\.com/ntdetect\.wxp/gi' setupldr.exe
 +
###i## mv setupldr.exe xpldr
 +
###i## cp winxp/i386/ntdetect.com ntdetect.wxp
 +
</console>
  
 +
== Creating a remapping file ==
 +
Create the file <code>/tftproot/tftpd.remap</code> and add the following to it:
 
{{File
 
{{File
|/etc/conf.d/hostname|<pre>
+
|/tftproot/tftpd.remap|<pre>
hostname="antec"
+
ri ^[az]: # Remove “drive letters”
 +
rg \\ / # Convert backslashes to slashes
 +
rg \# @ # Convert hash marks to @ signs
 +
rg /../ /..no../ # Convert /../ to /..no../
 +
rg A a
 +
rg B b
 +
rg C c
 +
rg D d
 +
rg E e
 +
rg F f
 +
rg G g
 +
rg H h
 +
rg I i
 +
rg J j
 +
rg K k
 +
rg L l
 +
rg M m
 +
rg N n
 +
rg O o
 +
rg P p
 +
rg Q q
 +
rg R r
 +
rg S s
 +
rg T t
 +
rg U u
 +
rg V v
 +
rg W w
 +
rg X x
 +
rg Y y
 +
rg Z z
 +
r ^/(.*) \1
 +
r ^xpldr xpldr
 +
r ^ntdetect.wxp ntdetect.wxp
 +
r ^winxp.sif winxp.sif
 
</pre>}}
 
</pre>}}
  
== Receiving mDNS ==
+
==Install/Configure Samba ==
 
+
If you don't already have {{Package|net-fs/samba}} installed, then:
The ebuild "nss-mdns" provides the necessary functionality for your Funtoo/Gentoo Linux machine to receive mDNS broadcasts, so that it can do things like ping mybox.local, or ssh mylaptop.local.
+
 
+
From the [http://0pointer.de/lennart/projects/nss-mdns/#overview nss-mdns] home page:
+
 
+
''nss-mdns is a plugin for the GNU Name Service Switch (NSS) functionality of the GNU C Library (glibc) providing host name resolution via Multicast DNS (aka Zeroconf, aka Apple Rendezvous, aka Apple Bonjour), effectively allowing name resolution by common Unix/Linux programs in the ad-hoc mDNS domain .local.
+
 
+
''nss-mdns provides client functionality only, which means that you have to run a mDNS responder daemon seperately from nss-mdns if you want to register the local host name via mDNS. I recommend Avahi.
+
 
+
''nss-mdns is very lightweight (9 KByte stripped binary .so compiled with -DNDEBUG=1 -Os on i386, gcc 4.0), has no dependencies besides the glibc and requires only minimal configuration.
+
 
+
''By default nss-mdns tries to contact a running avahi-daemon for resolving host names and addresses and making use of its superior record cacheing. Optionally nss-mdns can be compiled with a mini mDNS stack that can be used to resolve host names without a local Avahi installation. Both Avahi support and this mini mDNS stack are optional, however at least one of them needs to be enabled. If both are enabled a connection to Avahi is tried first, and if that fails the mini mDNS stack is used.
+
 
<console>
 
<console>
###i## emerge -av nss-mdns
+
###i## emerge -av net-fs/samba
 
</console>
 
</console>
 +
Create a Samba share for your tftp server in <code>/etc/samba/smb.conf</code>
  
Set up multicast route:
+
{{Note}} Be sure you have the other required samba settings configured in the file
 +
{{File
 +
|/etc/samba/smb.conf|<pre>
 +
[Global]
 +
interfaces = lo eth0 wlan0
 +
bind interfaces only = yes
 +
workgroup = WORKGROUP
 +
security = user
 +
 
 +
[tftproot]
 +
path = /tftproot
 +
browsable = true
 +
read only = yes
 +
writable = no
 +
guest ok = yes
 +
</pre>}}
 +
Start Samba:
 
<console>
 
<console>
###i## route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
+
###i## /etc/init.d/samba start
 +
</console> 
 +
or if samba has already been started:
 +
<console>
 +
###i## /etc/init.d/samba restart
 
</console>
 
</console>
  
Note: Adding <code>multicast="yes"</code> in <code>/etc/conf.d/netif.foo</code> (replace foo with your actual network interface name) will set up the multicast route automatically at startup.
+
== Creating a Setup Instruction File ==
 
+
Create the file <code>/tftproot/winxp.sif</code> and add the following, replacing <tt>SAMBA_SERVER_IP</tt> with the local IP address of your samba server:
Now, it's necessary to modify <tt>/etc/nsswitch.conf</tt> so that your system will use multicast DNS for hostname lookup. In the example, we use the <tt>mdns_minimal</tt> and <tt>mdns</tt> words, which enable multicast DNS for IPv4 and IPv6. If you only want to enable IPv4-based multicast DNS, which is recommended for IPv4-only networks, use <tt>mdns4_minimal</tt> and <tt>mdns4</tt> instead. This will improve hostname lookup performance.
+
 
{{File
 
{{File
|/etc/nsswitch.conf|<pre>
+
|/tftproot/winxp.sif|<pre>
hosts:      files mdns_minimal [NOTFOUND=return] dns mdns
+
[data]
</pre>}}
+
floppyless = "1"
 +
msdosinitiated = "1"
 +
; Needed for second stage
 +
OriSrc = "\\SAMBA_SERVER_IP\tftproot\winxp\i386"
 +
OriTyp = "4"
 +
LocalSourceOnCD = 1
 +
DisableAdminAccountOnDomainJoin = 1
  
== Sending Multicast DNS ==
+
[SetupData]
 +
OsLoadOptions = "/fastdetect"
 +
; Needed for first stage
 +
SetupSourceDevice = "\Device\LanmanRedirector\SAMBA_SERVER_IP\tftproot\winxp"
  
Avahi-daemon handles the task of '''sending''' multicast DNS broadcasts, as well as service discovery broadcasts, on your local LAN. If you want other devices to be able to reach your Funtoo/Gentoo Linux machine via multicast DNS, and Zeroconf Service Discovery, you'll want to enable avahi-daemon. This will also improve the efficiency of performing multicast DNS lookups locally.
+
[UserData]
 +
ComputerName = *
 +
</pre>}}
  
 +
== Editing the pxelinux.cfg/default boot menu ==
 +
Edit your boot menu so that it contains the following entry:
 
<console>
 
<console>
###i## rc-update add avahi-daemon default
+
LABEL WinXP
###i## rc
+
MENU LABEL Install MS Windows XP
 +
KERNEL winxp.0
 
</console>
 
</console>
  
Test:
+
== Re-Start all required daemons ==
 +
If the daemon isn't already running use start instead or restart in the following commands
 
<console>
 
<console>
###i## ping daniel-pc.local
+
###i## /etc/init.d/dnsmasq restart
PING daniel-pc.local (10.0.1.11) 56(84) bytes of data.
+
###i## /etc/init.d/in.tftpd restart
64 bytes from Daniel-PC.local (10.0.1.11): icmp_req=1 ttl=128 time=3.73 ms
+
64 bytes from Daniel-PC.local (10.0.1.11): icmp_req=2 ttl=128 time=0.905 ms
+
64 bytes from Daniel-PC.local (10.0.1.11): icmp_req=3 ttl=128 time=0.922 ms
+
64 bytes from Daniel-PC.local (10.0.1.11): icmp_req=4 ttl=128 time=0.827 ms
+
 
</console>
 
</console>
  
== Service Discovery ==
+
== Modify Binlsrv, update driver cache, and start driver hosting service ==
 
+
Change the BASEPATH= variable at or around line #62 of ''<code>binlsrv.py</code>'' so that it is:
Get a list of services on the LAN:
+
 
<console>
 
<console>
###i## avahi-browse -ac
+
###i## nano binlsrv.py
 +
BASEPATH='/tftproot/winxp/i386/'
 +
</console>
 +
Generate driver cache:
 +
<console>
 +
###i## cd /tftproot;./infparser.py winxp/i386/
 +
</console>
 +
Start binlservice:
 +
<console>
 +
###i## ./binlsrv.py
 
</console>
 
</console>
  
== Resources ==
+
== Booting the client ==  
 
+
If all is well, you should be able to boot the client choosing to ''boot from network'' in the boot options, you should get to your PXELinux bootloader, and see the Install Windows XP option after pressing enter you *should* kick off your XP installation via network!! Congratulations!
* [http://developer.apple.com/library/mac/#qa/qa2004/qa1357.html Apple Technical Q&A QA1357]
+
* [http://en.gentoo-wiki.com/wiki/Avahi Gentoo Wiki Avahi]
+
* [http://www.ibiblio.org/pub/linux/docs/HOWTO/other-formats/html_single/Multicast-HOWTO.html#toc2 Multicast over TCP/IP HOWTO]
+
* [http://sitka.triumf.ca/pub/linux/multicast-FAQ Linux Multicast FAQ]
+
* [http://www.multicastdns.org/ multicastdns.org]
+
  
 
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
[[Category:Networking]]
 

Revision as of 23:52, 14 January 2014

Howto use your Funtoo machine to serve a MS Windows installation over the network In this guide we will assume that you have followed the PXE network boot server Wiki article and have a working network/pxe boot setup. As of now this guide will cover Windows XP. Soon it will be expanded to also cover Windows 7.

Contents

Prerequisites

  1. A working Funtoo installation
  2. A working PXE Setup (DHCP, TFTP, PXELinux)
  3. app-arch/cabextract
  4. A legitimate copy of Microsoft Windows
  5. Driver for your NIC - Suggested to use a complete driver pack with all major supported NIC hardware for the version of Windows to be installed.
  6. RIS Linux toolkit >=0.4
  7. A working Samba server setup

Creating the Windows XP Image

  • In the previous guide, PXE Network Boot Server, we used /tftproot as the working directory so we will also use it in this guide for convenience. If you chose to use a different working directory then please apply it where needed in place of the /tftproot we will be going by here.

First you will need to create an ISO from your Windows XP installation disc. If you already have the ISO image you may skip this step.

# dd if=/dev/sr0 of=/tftproot/winxp.iso

If your cdrom device isn't /dev/sr0 please use the appropriate device in this command.

Mount the ISO and Prepare Installation Sources

Mount the image to /tftproot/cdrom:

# mkdir /tftproot/cdrom; mount -o loop /tftproot/winxp.iso /tftproot/cdrom

Create the new directory for the network installation files and copy the needed files to it:

# mkdir /tftproot/winxp; cp -R /tftproot/cdrom/i386 /tftproot/winxp/i386

Depending on your CD/DVD copy of windows the directory name may be I386 as opposed to i386, if that is the case you will just need to change the first part of the command, keeping the new directory name i386 - this is going to be very important later on when creating the remap file! Check the contents of your newly created i386 directory to see if the filenames are in all CAPS or if they are already in lowercase.

# ls /tftproot/winxp/i386

If you happen to have all UPPERCASE filenames, lets go ahead and run a script to convert it to all lowercase:

# cd /tftproot/winxp/i386;ls | awk '$0!=tolower($0){printf "mv \"%s\" \"%s\"\n",$0,tolower($0)}' | sh

Extracting and Modifying the Required Boot Files

Install app-arch/cabextract

# emerge -av app-arch/cabextract

Extract the prepackaged drivers:

# cd /tftproot/winxp/i386;cabextract driver.cab

Install support for a large list of network cards:

# cd /tftproot/;wget http://downloads.sourceforge.net/project/bootfloppy/pxefiles.tar.gz
# tar zxvf pxefiles.tar.gz; cp pxefiles/drivers/* winxp/i386/

Copy the BINLSRV /INFParser tools to /tftproot:

# cp pxefiles/script/* /tftproot/

Extract the netboot startrom:

# cd /tftproot; cabextract winxp/i386/startrom.n1_

Fix the startrom for netbooting xp:

# sed -i -e 's/NTLDR/XPLDR/gi' startrom.n12
# mv startrom.n12 winxp.0

Fix XPLDR:

# cabextract winxp/i386/setupldr.ex_
# sed -i -e 's/winnt\.sif/winxp\.sif/gi' setupldr.exe
# sed -i -e 's/ntdetect\.com/ntdetect\.wxp/gi' setupldr.exe
# mv setupldr.exe xpldr
# cp winxp/i386/ntdetect.com ntdetect.wxp

Creating a remapping file

Create the file /tftproot/tftpd.remap and add the following to it:

ri ^[az]: # Remove “drive letters”
rg \\ / # Convert backslashes to slashes
rg \# @ # Convert hash marks to @ signs
rg /../ /..no../ # Convert /../ to /..no../
rg A a
rg B b
rg C c
rg D d
rg E e
rg F f
rg G g
rg H h
rg I i
rg J j
rg K k
rg L l
rg M m
rg N n
rg O o
rg P p
rg Q q
rg R r
rg S s
rg T t
rg U u
rg V v
rg W w
rg X x
rg Y y
rg Z z
r ^/(.*) \1
r ^xpldr xpldr
r ^ntdetect.wxp ntdetect.wxp
r ^winxp.sif winxp.sif

Install/Configure Samba

If you don't already have net-fs/samba installed, then:

# emerge -av net-fs/samba

Create a Samba share for your tftp server in /etc/samba/smb.conf

Note Note: Be sure you have the other required samba settings configured in the file

[Global]
interfaces = lo eth0 wlan0
bind interfaces only = yes
workgroup = WORKGROUP
security = user

[tftproot]
path = /tftproot
browsable = true
read only = yes
writable = no
guest ok = yes

Start Samba:

# /etc/init.d/samba start

or if samba has already been started:

# /etc/init.d/samba restart

Creating a Setup Instruction File

Create the file /tftproot/winxp.sif and add the following, replacing SAMBA_SERVER_IP with the local IP address of your samba server:

[data]
floppyless = "1"
msdosinitiated = "1"
; Needed for second stage
OriSrc = "\\SAMBA_SERVER_IP\tftproot\winxp\i386"
OriTyp = "4"
LocalSourceOnCD = 1
DisableAdminAccountOnDomainJoin = 1

[SetupData]
OsLoadOptions = "/fastdetect"
; Needed for first stage
SetupSourceDevice = "\Device\LanmanRedirector\SAMBA_SERVER_IP\tftproot\winxp"

[UserData]
ComputerName = *

Editing the pxelinux.cfg/default boot menu

Edit your boot menu so that it contains the following entry:

LABEL WinXP
	MENU LABEL Install MS Windows XP
	KERNEL winxp.0

Re-Start all required daemons

If the daemon isn't already running use start instead or restart in the following commands

# /etc/init.d/dnsmasq restart
# /etc/init.d/in.tftpd restart

Modify Binlsrv, update driver cache, and start driver hosting service

Change the BASEPATH= variable at or around line #62 of binlsrv.py so that it is:

# nano binlsrv.py
BASEPATH='/tftproot/winxp/i386/'

Generate driver cache:

# cd /tftproot;./infparser.py winxp/i386/

Start binlservice:

# ./binlsrv.py

Booting the client

If all is well, you should be able to boot the client choosing to boot from network in the boot options, you should get to your PXELinux bootloader, and see the Install Windows XP option after pressing enter you *should* kick off your XP installation via network!! Congratulations!