 




<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Open Source Software and Linux &#187; dom0</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/linux-lotus-domino/tag/dom0/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/linux-lotus-domino</link>
	<description></description>
	<lastBuildDate>Thu, 02 May 2013 21:07:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Adding the iptables firewall to the Xen domU (part 2)</title>
		<link>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/adding-the-iptables-firewall-to-the-xen-domu-part-2/</link>
		<comments>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/adding-the-iptables-firewall-to-the-xen-domu-part-2/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 22:59:29 +0000</pubDate>
		<dc:creator>Xjlittle</dc:creator>
				<category><![CDATA[centos]]></category>
		<category><![CDATA[dom0]]></category>
		<category><![CDATA[domU]]></category>
		<category><![CDATA[Firewalls]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[pciback]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/linux-lotus-domino/adding-the-iptables-firewall-to-the-xen-domu-part-2/</guid>
		<description><![CDATA[In my last column we set up a physical NIC in our Xen domU to expose it to the internet and setup our iptables firewall. At this point you should have 2 interfaces in your domU. One should be facing the internet and have an IP Address assigned from your ISP. The other should be [...]]]></description>
				<content:encoded><![CDATA[<p>In my last column we set up a physical NIC in our Xen domU to expose it to the internet and setup our iptables firewall.</p>
<p>At this point you should have 2 interfaces in your domU.  One should be facing the internet and have an IP Address assigned from your ISP. The other should be a typical Xen interface with a static IP that connects to the rest of your network.</p>
<p>To start off our iptables network let&#8217;s open up the system-config-security application and make sure that iptables is enabled.   Go ahead and close this once that is done.  That should create a standard Red Hat\CentOS firewall setup as a starting point.  You can check this by issuing the command:<br />
<code><br />
iptables -L<br />
</code></p>
<p>Notice the chain that Red Hat\Centos adds to the typical iptables -L output.  It is referenced by the input and forward chains.  Generally when you put in a reference to the input chain you need a corresponding reference to the forward chain.  This extra chain is the one that we will work with the most.  Since it is referenced by both the forward and input chains we don&#8217;t need to put corresponding rules in both chains  It is called:<br />
<code><br />
RH-Firewall-1-INPUT<br />
</code></p>
<p>The first thing that we want to do is get the machines on our network out to the internet.  We do this by using the nat table and the postrouting chain. This is the command to accomplish that:<br />
<code><br />
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE<br />
</code><br />
This will let any internet request from your internal network access the internet.  My internet facing NIC is eth1. Your&#8217;s may vary.  Notice the -o eth1.  This indicates that it is looking for outbound packets on eth1.</p>
<p>By default anything coming in from the internet is blocked. You&#8217;re probably going to want to let ssh and maybe openvpn come in from the internet.  The solution that I use for this is to use domUs behind the firewall so that these requests land there rather than on the firewall machine.  Here is how to setup an inbound request and have it directed to the landing server.  From there you can go where you need on the network.<br />
<code><br />
##ssh<br />
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 22 -j DNAT --to 172.16.0.201<br />
##openvpn<br />
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 1194 -j DNAT --to 172.16.0.201<br />
</code><br />
Any port that you need uses the exact same syntax except for the port number.</p>
<p>We also need to enable port forwarding so that it will survive a reboot.  Use the following commands to enable it for your current session and set it up to survive a reboot:<br />
<code><br />
[root@virtual-host ~]# sysctl -w net.ipv4.ip_forward=1<br />
[root@virtual-host ~]# sysctl -p<br />
#output<br />
net.ipv4.ip_forward = 1<br />
net.ipv4.conf.default.rp_filter = 1<br />
net.ipv4.conf.default.accept_source_route = 0<br />
kernel.sysrq = 0<br />
kernel.core_uses_pid = 1<br />
net.ipv4.tcp_syncookies = 1<br />
kernel.msgmnb = 65536<br />
kernel.msgmax = 65536<br />
kernel.shmmax = 4294967295<br />
kernel.shmall = 268435456<br />
[root@virtual-host ~]#<br />
</code><br />
As we can see from the first line under #output ip forwarding is set to 1 which means that it is turned on.</p>
<p>Note that if you go back and use any of the firewall GUIs provided you will lose all of the settings that used the nat table.  I suggest that you stick with the command line after making your initial setup.</p>
<p>Here is what my iptables output looks like:<br />
</code><br />
[root@fw0 ~]# iptables -L<br />
Chain INPUT (policy ACCEPT)<br />
target     prot opt source               destination<br />
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            </p>
<p>Chain FORWARD (policy ACCEPT)<br />
target     prot opt source               destination<br />
RH-Firewall-1-INPUT  all  --  anywhere             anywhere<br />
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:servicetag<br />
ACCEPT     udp  --  anywhere             anywhere            udp dpt:servicetag </p>
<p>Chain OUTPUT (policy ACCEPT)<br />
target     prot opt source               destination         </p>
<p>Chain RH-Firewall-1-INPUT (2 references)<br />
target     prot opt source               destination<br />
DROP       tcp  --  yktgi01e0-s4.watson.ibm.com  anywhere            tcp dpt:https<br />
DROP       tcp  --  yktgi01e0-s4.watson.ibm.com  anywhere            tcp dpt:http<br />
ACCEPT     all  --  anywhere             anywhere<br />
ACCEPT     all  --  anywhere             anywhere<br />
ACCEPT     icmp --  anywhere             anywhere            icmp any<br />
ACCEPT     esp  --  anywhere             anywhere<br />
ACCEPT     ah   --  anywhere             anywhere<br />
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns<br />
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp<br />
ACCEPT     udp  --  anywhere             anywhere            state NEW,RELATED,ESTABLISHED udp dpt:servicetag<br />
ACCEPT     tcp  --  anywhere             anywhere            state NEW,RELATED,ESTABLISHED tcp dpt:servicetag<br />
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp<br />
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED<br />
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:domain<br />
ACCEPT     udp  --  anywhere             anywhere            state NEW udp dpt:domain<br />
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh<br />
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:smtp<br />
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http<br />
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https<br />
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited<br />
[root@fw0 ~]#</p>
<p>The two drops that you see at the top of the input chain are from somebody that kept hitting on my web server.  Usually if you want to put a drop in against a specific target your will want to insert (I) it at the top of the chain like so:<br />
<code><br />
iptables -I RH-Firewall-1-INPUT 1 -p tcp  --dport 80  --source 11.22.33.444 -j DROP<br />
</code><br />
The 1 just after INPUT instructs iptables to make that the first rule in the chain.  Since both the input and forward chains are reference by the RH-Firewall-1-INPUT chain we don't have to concern ourselves with putting the same rule in the forward chain.</p>
<p>I hope this helps you get started with your domU firewall.</p>
<p>-j</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/adding-the-iptables-firewall-to-the-xen-domu-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a physical NIC for a firewall on a Xen domU (Part 1)</title>
		<link>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/setting-up-an-iptables-firewall-on-a-xen-domu/</link>
		<comments>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/setting-up-an-iptables-firewall-on-a-xen-domu/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 19:56:12 +0000</pubDate>
		<dc:creator>Xjlittle</dc:creator>
				<category><![CDATA[centos]]></category>
		<category><![CDATA[dom0]]></category>
		<category><![CDATA[domU]]></category>
		<category><![CDATA[domU firewall]]></category>
		<category><![CDATA[pciback]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[xen firewall]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/linux-lotus-domino/setting-up-an-iptables-firewall-on-a-xen-domu/</guid>
		<description><![CDATA[Recently I brought up a new Xen server that needed an iptables firewall on a domU. My first thought had been to setup the firewall on dom0 but that turned out to be a difficult task because of all of the virtual interfaces that are created. Red Hat/Centos also installs a set of rules by [...]]]></description>
				<content:encoded><![CDATA[<p>Recently I brought up a new Xen server that needed an iptables firewall on a domU.  My first thought had been to setup the firewall on dom0 but that turned out to be a difficult task because of all of the virtual interfaces that are created.  Red Hat/Centos also installs a set of rules by default to make sure that all of these interfaces will interact with each other properly.  Onward to domU.</p>
<p>The first thing necessary to setting up a domU firewall that is exposed to the internet is to &#8220;hide&#8221; an interface from dom0 and import it into the domU firewall machine.  To start we need to do a few things.  Ultimately this is going to cause of reboot of dom0 so consider if this is feasible for your situation.</p>
<p>Let&#8217;s get started.  First we need to get some numbers from the interface  To do this use the lspci command.<br />
<code><br />
[root@virtual-host ~]# lspci |grep -i ethernet<br />
==&gt;01:02.0 Ethernet controller: Intel Corporation 82546GB Gigabit Ethernet Controller (rev 03)<br />
01:02.1 Ethernet controller: Intel Corporation 82546GB Gigabit Ethernet Controller (rev 03)<br />
01:06.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)<br />
</code><br />
As you can see I have three interfaces on this machine.  The marked interface requires an entry into modprobe.conf and the xen firewall configuration file.<br />
<code><br />
##modprobe.conf<br />
options pciback hide=(01:02.0)</p>
<p>##xen firewall configuration<br />
pci = [ "01:02.0" ]<br />
</code></p>
<p>Now we need to use the lspci -n command and use this entry in the xend-pci-permissive.sxp file under /etc/xen.<br />
<code><br />
[root@virtual-host xen]# lspci -n<br />
==&gt;01:02.0 0200: 8086:1079 (rev 03)<br />
01:02.1 0200: 8086:1079 (rev 03)<br />
1:06.0 0200: 8086:100e (rev 02)<br />
</code><br />
Match the pci numbers from the lspci command to find the correct line.  You&#8217;ll want the last 8 characters of this line.  In the code above we want the 8086:1079 part of the output.</p>
<p>Open the xend-pci-permissive.sxp  and make an entry like the following:<br />
<code><br />
(unconstrained_dev_ids<br />
('8086:1079')<br />
)<br />
</code></p>
<p>Once we have this done we need to make a new initrd image that preloads the pciback module.  Before running the following code you should make a copy of your current initrd.  If you run into problems you can use this to replace the one that you created and try again.  Use the following code to create the new initrd:<br />
<code><br />
cd /boot<br />
mkinitrd -f --preload pciback initrd-$(uname -r).img $(uname -r)<br />
</code></p>
<p>After creating the new initrd it&#8217;s time to reboot and check your work.</p>
<p>Once dom0 is up we need to look for certain entries in /var/log/messages:<br />
<code><br />
[root@virtual-host ~]# grep pciback /var/log/messages<br />
vpci: 0000:01:02.0: assign to virtual slot 0<br />
virtual-host kernel: pciback 0000:01:02.0: seizing device<br />
virtual-host kernel: pciback 0000:01:02.0: enabling permissive mode configuration space accesses!<br />
virtual-host kernel: pciback 0000:01:02.0: permissive mode is potentially unsafe!<br />
virtual-host kernel: pciback: vpci: 0000:01:02.0: assign to virtual slot 0<br />
</code></p>
<p>Once you see that the device is seized and assigned to a virtual slot check your firewall machine to make sure it is getting an ip from your ISP as well as connected to your local lan IP.<br />
<code><br />
[root@fw0 ~]# ifconfig<br />
eth0      Link encap:Ethernet  HWaddr 00:16:3E:36:73:82<br />
          inet addr:172.16.0.254  Bcast:172.16.255.255  Mask:255.255.0.0<br />
          inet6 addr: fe80::216:3eff:fe36:7382/64 Scope:Link<br />
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br />
          RX packets:548690 errors:0 dropped:0 overruns:0 frame:0<br />
          TX packets:291190 errors:0 dropped:0 overruns:0 carrier:0<br />
          collisions:0 txqueuelen:1000<br />
          RX bytes:486044371 (463.5 MiB)  TX bytes:47023339 (44.8 MiB)</p>
<p>eth1      Link encap:Ethernet  HWaddr 00:04:23:A6:C1:0E<br />
          inet addr:76.240.xxx.xxx  Bcast:76.240.xxx.xxx  Mask:255.255.255.0<br />
          inet6 addr: fe80::204:23ff:fea6:c10e/64 Scope:Link<br />
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br />
          RX packets:311217 errors:0 dropped:0 overruns:0 frame:0<br />
          TX packets:564587 errors:0 dropped:0 overruns:0 carrier:0</p>
<p>          collisions:0 txqueuelen:100<br />
          RX bytes:50257788 (47.9 MiB)  TX bytes:487593757 (465.0 MiB)<br />
          Base address:0xb400 Memory:fea40000-fea60000<br />
</code></p>
<p>As you can see from the above output eth0 is connected to my lan and eth1 has received it&#8217;s internet address so that we are connected to the internet.  The OS (Red Hat/CentOS) should create the entry for eth1 without any input on your part.</p>
<p>Please read my next post for setting up iptables in your domU.</p>
<p>-j</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/setting-up-an-iptables-firewall-on-a-xen-domu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up your firewall on domU with iptables</title>
		<link>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/setting-up-your-firewall-on-domu-with-iptables/</link>
		<comments>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/setting-up-your-firewall-on-domu-with-iptables/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 18:32:11 +0000</pubDate>
		<dc:creator>Xjlittle</dc:creator>
				<category><![CDATA[centos 5]]></category>
		<category><![CDATA[dom0]]></category>
		<category><![CDATA[domU]]></category>
		<category><![CDATA[domU firewall]]></category>
		<category><![CDATA[Firewalls]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[pciback]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/linux-lotus-domino/setting-up-your-firewall-on-domu-with-iptables/</guid>
		<description><![CDATA[As discussed in an earlier post you must first hide your NIC from dom0 to set up your iptables firewall on your domU. After you have successfully hidden the NIC from dom0 then we can proceed to our domU firewall setup. You must first decide which domU that you are going to use for a [...]]]></description>
				<content:encoded><![CDATA[<p>As discussed in an earlier post you must first hide your NIC from dom0 to set up your iptables firewall on your domU.  After you have successfully hidden the NIC from dom0 then we can proceed to our domU firewall setup.</p>
<p>You must first decide which domU that you are going to use for a firewall.  Personally I prefer my firewall domU to have nothing on it but iptables.  I can then use POSTROUTING and PREROUTING to nat my outbound packets and redirect the new inbound packets to their correct destinations.  After you have your domU built and working properly you need to make the following entry into the configuration file:<br />
<code><br />
name = "fw0"<br />
uuid = "203e2874-a08b-4065-7155-cdad1b5b7341"<br />
maxmem = 256<br />
memory = 256<br />
vcpus = 1<br />
bootloader = "/usr/bin/pygrub"<br />
on_poweroff = "destroy"<br />
on_reboot = "restart"<br />
on_crash = "restart"<br />
vfb = [ "type=vnc,vncunused=1,keymap=en-us" ]<br />
disk = [ "phy:/dev/linux-virtuals/secure,xvda,w" ]<br />
vif = [ "mac=00:16:3e:36:73:82,bridge=xenbr0" ]<br />
<strong>pci = [ '01:02.0' ] =====Should be the same as obtained from your lspci command</strong><br />
</code></p>
<p>Now start your domU.  You should see a second interface, eth1, show up when you use ifconfig.  There is no need to build an ifcfg-eth1 file for this as the operating system will take care of it for you.  This is the interface that is connected to your DSL\Cable connection to the internet.  Make sure that you have a cable plugged into the physical interface that [ '01:02.0' ] represents and the other end into your Cable or DSL modem.  You should see that it gets a publicly routed interface like this:<br />
<code><br />
[root@fw0 ~]# ifconfig<br />
eth0      Link encap:Ethernet  HWaddr 00:16:3E:36:73:82<br />
          inet addr:172.16.0.254  Bcast:172.16.255.255  Mask:255.255.0.0<br />
          inet6 addr: fe80::216:3eff:fe36:7382/64 Scope:Link<br />
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br />
          RX packets:37856 errors:0 dropped:0 overruns:0 frame:0<br />
          TX packets:27763 errors:0 dropped:0 overruns:0 carrier:0<br />
          collisions:0 txqueuelen:1000<br />
          RX bytes:7935825 (7.5 MiB)  TX bytes:11696196 (11.1 MiB)</p>
<p>eth1      Link encap:Ethernet  HWaddr 00:0E:0C:80:22:B8<br />
          <strong>inet addr:76.252.xxx.xxx  Bcast:76.252.xxx.xxx  Mask:255.255.255.0 ===This is the routable IP</strong><br />
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br />
          RX packets:28701 errors:0 dropped:0 overruns:0 frame:0<br />
          TX packets:28332 errors:0 dropped:0 overruns:0 carrier:0<br />
          collisions:0 txqueuelen:100<br />
          RX bytes:11911130 (11.3 MiB)  TX bytes:7313287 (6.9 MiB)<br />
          Base address:0xb400 Memory:fea40000-fea60000 </p>
<p>lo        Link encap:Local Loopback<br />
          inet addr:127.0.0.1  Mask:255.0.0.0<br />
          inet6 addr: ::1/128 Scope:Host<br />
          UP LOOPBACK RUNNING  MTU:16436  Metric:1<br />
          RX packets:50 errors:0 dropped:0 overruns:0 frame:0<br />
          TX packets:50 errors:0 dropped:0 overruns:0 carrier:0<br />
          collisions:0 txqueuelen:0<br />
          RX bytes:89159 (87.0 KiB)  TX bytes:89159 (87.0 KiB)</p>
<p>[root@fw0 ~]#<br />
</code></p>
<p>The x&#8217;s are place in the last two octets for security reasons.  However you can see by the first two octets that this is a publicly routable interface that got it&#8217;s address from my ISP provider.</p>
<p>Now to get your machines on your LAN out to the internet two things must happen.  Their default gateway must be set to the ip address of eth0 on your domU.  In my case this is 172.16.0.254.  This is quite simple if you are using DHCP.  Just make an entry like this into the dhcpd.conf file:<br />
<code><br />
subnet 172.16.0.0 netmask 255.255.0.0 {<br />
  range 172.16.0.111 172.16.0.150;<br />
  <strong>option routers 172.16.0.254;=====set this option for your default gateway</strong><br />
  option broadcast-address 172.16.255.255;<br />
  default-lease-time 259200;<br />
  max-lease-time 604800;<br />
  option domain-name-servers 172.16.0.205, xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx;<br />
}<br />
</code></p>
<p>If you&#8217;re not using DHCP then you can make an entry either into /etc/sysconfig/network or /etc/sysconfig/network-scripts/ifcfg-eth* where the * is replaced by whatever your interface number is:<br />
<code><br />
GATEWAY=172.16.0.254<br />
</code></p>
<p>Once that is done now we need to set up our masquerade so that our outbound packets are nat&#8217;d and we can browse the internet.  On the firewall machine issue the following commands:<br />
<code><br />
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE<br />
service iptables save<br />
service iptables restart<br />
</code></p>
<p>There you have it.  Your domU is now connected to the internet, firewalling your network and allowing your internal machines on your LAN to browse the internet.  This setup was done on CentOS 5.2 with the native virtualization that is built in.</p>
<p>-j</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/setting-up-your-firewall-on-domu-with-iptables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS 5 and pciback aka hiding pci card from Xen DOM0</title>
		<link>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/centos-5-and-pciback-aka-hiding-pci-card-from-xen-dom0/</link>
		<comments>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/centos-5-and-pciback-aka-hiding-pci-card-from-xen-dom0/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 02:59:16 +0000</pubDate>
		<dc:creator>Xjlittle</dc:creator>
				<category><![CDATA[dom0]]></category>
		<category><![CDATA[domU]]></category>
		<category><![CDATA[pciback. pciback.hide]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[xen pciback. centos xen]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/linux-lotus-domino/centos-5-and-pciback-aka-hiding-pci-card-from-xen-dom0/</guid>
		<description><![CDATA[I just recently spent more hours than I care to think about getting a NIC in Xen Dom0 hidden and passed to a DomU via pciback in CentOS 5. Lesson number 1: pciback or pciback.hide is now a module. Putting it on GRUB&#8217;s kernel line is no longer sufficient. Lesson number 2: If you NIC [...]]]></description>
				<content:encoded><![CDATA[<p>I just recently spent more hours than I care to think about getting a NIC in Xen Dom0 hidden and passed to a DomU via pciback in CentOS 5.</p>
<p>Lesson number 1:  pciback or pciback.hide is now a module.  Putting it on GRUB&#8217;s kernel line is no longer sufficient.</p>
<p>Lesson number 2:  If you NIC module does not load until late in the boot process either use another one or put it in your initrd.  Davicom cards are a good example of this.  Use an Intel.</p>
<p>Lesson number 3:  Much of the information that you find online about what to put in your /etc/modprobe.config incorrect.</p>
<p>So now that we&#8217;ve covered all of that here is what you need to do to use pciback in CentOS 5.</p>
<p>Step 1.  Put the following and only the following in your /etc/modprobe.conf:<br />
<code><br />
options pciback hide=(01:06.0)<br />
</code><br />
The numbers that you see there are found by running lspci |grep ethernet (or whatever you want to hide such as vga, usb, etc).<br />
<code><br />
[root@virtual-host xen]# lspci |grep -i ethernet<br />
01:02.0 Ethernet controller: Davicom Semiconductor, Inc. 21x4x DEC-Tulip compatible 10/100 Ethernet (rev 31)<br />
01:06.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)<br />
[root@virtual-host xen]#<br />
</code></p>
<p>Now you need to create a new initrd image.  Before doing so make a backup copy of the one that you are currently using.  Then create a new initrd so that the pciback module is loaded early on.<br />
<code><br />
mkinitrd -f --preload=pciback /boot/initrd-$(uname -r).img $(uname -r)<br />
</code><br />
This will place the new initrd into your boot directory and overwrite the old one.</p>
<p>Moving on to the /etc/xen directory we have a little work do here.  In the domU config file make two entries like the following:<br />
<code><br />
pci = [ "01:06.0"]<br />
vif = [ '' ]<br />
</code></p>
<p>Now open  /etc/xen/xend-pci-permissive.sxp and make an entry like the following:<br />
<code><br />
(unconstrained_dev_ids<br />
     #('0123:4567:89AB:CDEF')<br />
('8086:100e')       ##Everything but this entry is already in here for an example.<br />
)<br />
</code></p>
<p>You get the 8086:100e number from running lspci -n:<br />
<code><br />
[root@virtual-host xen]# lspci -n<br />
00:00.0 0600: 8086:254c (rev 01)<br />
00:00.1 ff00: 8086:2541 (rev 01)<br />
00:1d.0 0c03: 8086:2482 (rev 02)<br />
00:1d.1 0c03: 8086:2484 (rev 02)<br />
00:1e.0 0604: 8086:244e (rev 42)<br />
00:1f.0 0601: 8086:2480 (rev 02)<br />
00:1f.1 0101: 8086:248b (rev 02)<br />
00:1f.3 0c05: 8086:2483 (rev 02)<br />
01:02.0 0200: 1282:9102 (rev 31)<br />
01:04.0 0300: 1002:4752 (rev 27)<br />
01:06.0 0200: 8086:100e (rev 02)<br />
As you can see those number match up with the 01:06.0 number that we used in modprobe.conf and the domU config file.</p>
<p>Now if all has gone well you should see that your domU has direct access to the pci card and that dom0 no longer attempts to use it.  This can be confirmed by grep'ing dmesg:<br />
<code><br />
[root@virtual-host xen]# dmesg |grep pciback<br />
pciback 0000:01:06.0: seizing device<br />
pciback 0000:01:06.0: enabling permissive mode configuration space accesses!<br />
pciback 0000:01:06.0: permissive mode is potentially unsafe!<br />
pciback: vpci: 0000:01:06.0: assign to virtual slot 0<br />
pciback: vpci: 0000:01:06.0: assign to virtual slot 0<br />
[root@virtual-host xen]#<br />
</code></p>
<p>There you have the results of several hours of reading and trial and error.  Don't forget that if you install a new xen kernel you will again have to make a new initrd.</p>
<p>One way around having to create a new initrd is to create a file named pciback under /etc/sysconfig/mkinitrd.  Put an entry into the pciback file that reads PREMODS="$PREMODS pciback".  That should automatically install the pciback module when your new kernel creates it's new mkinitrd.</p>
<p>Hope this helps.</p>
<p>-j</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/linux-lotus-domino/centos-5-and-pciback-aka-hiding-pci-card-from-xen-dom0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
