<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>Linux Format forums</title>
  <link>http://www.linuxformat.com/forums/index.php</link>
  <description>Help, discussion, magazine feedback and more</description>
  <language>english</language>
  <copyright>(c) Copyright Tue May 21, 2013 12:42 pm by Linux Format forums</copyright>
  <managingEditor>webmaster@linuxformat.com</managingEditor>
  <webMaster>webmaster@linuxformat.com</webMaster>
  <pubDate>Tue May 21, 2013 12:42 pm</pubDate>
  <lastBuildDate>Tue May 21, 2013 12:42 pm</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>Linux Format forums</title>
    <url></url>
    <link>http://www.linuxformat.com/forums/</link>
    <description>Help, discussion, magazine feedback and more</description>
  </image>

                                      <item>
                                        <title>Re: iptables Questions - Linux Format LXF63 February 2005</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=1640#1640</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=-1'&gt;Anonymous&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed May 11, 2005 9:11 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hi, I managed to answer my own questions and have posted the results below in case anyone else is interested.&lt;br /&gt;
&lt;br /&gt;
1) Kde/gnome locking up at their start-up screens.&lt;br /&gt;
Searching around it appears that X needs access to port 9000 to work correctly. I guess this must be a throwback to its client server origins. I could have opened port 9000 explicitly but in the end just gave localhost 127.0.0.1 full access. All now works as it should. I have posted the updated script at the end of this message in case anyone is interested.&lt;br /&gt;
&lt;br /&gt;
2) How to configure the script for standard system startup.&lt;br /&gt;
A fould a very useful article from PCPlus.co.uk at:&lt;br /&gt;
&lt;a href=&quot;http://davidcoulson.net/writing/pcp/167/masterclass-linuxhelp.pdf&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://davidcoulson.net/writing/pcp/167/masterclass-linuxhelp.pdf&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
On Red Hat systems the scripts which start or stop the various services are located in /etc/rc.d/init.d/. On other systems they may be in /etc/init.d/. These scripts are fairly straightforward and take simple ‘start, stop, restart, status’ arguments. If you take a simple example, such as the one that launches atd, you could hack it to load or kill whichever service you’re interested in. To make the service run at start-up you need to set it up to start when the machine enters the default runlevel (usually 5 if you have a graphical login under Red Hat). If you look in /etc/rc.d/rc5.d/ you’ll notice a lot of files with names like S10atd which is symlinked to ../init.d/atd. Rather than duplicating the whole script or putting a command in a script, the init process looks in /etc/rc.d/rc5.d for everything beginning with a K, in numerical order, and does filename stop. If you had K10atd and K40crond, it would stop atd first, then crond. It then looks for everything beginning with an S and does filename start.&lt;br /&gt;
&lt;br /&gt;
****&lt;br /&gt;
iptables script&amp;#058;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# block_internet_access script&lt;br /&gt;
# Control internet access using IPTABLES rules&lt;br /&gt;
&lt;br /&gt;
case &quot;$1&quot; in&lt;br /&gt;
	start)&lt;br /&gt;
		# Apply firewall restrictions&lt;br /&gt;
		# First set up so default policy is set to DROP&lt;br /&gt;
		iptables -P INPUT DROP&lt;br /&gt;
		iptables -P FORWARD DROP&lt;br /&gt;
		iptables -P OUTPUT DROP&lt;br /&gt;
		# Now flush out any existing rules and non-default chains&lt;br /&gt;
		iptables -F&lt;br /&gt;
		iptables -X&lt;br /&gt;
		# Now allow full access to local lan only&lt;br /&gt;
		iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT&lt;br /&gt;
		iptables -A OUTPUT -s 192.168.0.0/24 -j ACCEPT&lt;br /&gt;
		# Allow full access for localhost, need access&lt;br /&gt;
		# to at least port 9000 for X windows to be able&lt;br /&gt;
		# to function&lt;br /&gt;
		iptables -A INPUT -s 127.0.0.1 -j ACCEPT&lt;br /&gt;
		iptables -A OUTPUT -s 127.0.0.1 -j ACCEPT&lt;br /&gt;
	;;&lt;br /&gt;
&lt;br /&gt;
	stop)&lt;br /&gt;
		# Now remove all rules and allow full access&lt;br /&gt;
		# firewall is ineffect disabled. This is safe&lt;br /&gt;
		# when behind a hardware firewall interface&lt;br /&gt;
		# to the internet&lt;br /&gt;
		&lt;br /&gt;
		# Now flush out any existing rules and non-default chains&lt;br /&gt;
		iptables -F&lt;br /&gt;
		iptables -X&lt;br /&gt;
		# Set up default policy to ACCEPT&lt;br /&gt;
		iptables -P INPUT ACCEPT&lt;br /&gt;
		iptables -P FORWARD ACCEPT&lt;br /&gt;
		iptables -P OUTPUT ACCEPT&lt;br /&gt;
	;;&lt;br /&gt;
&lt;br /&gt;
	restart)&lt;br /&gt;
		# First set up so default policy is set to DROP&lt;br /&gt;
		iptables -P INPUT DROP&lt;br /&gt;
		iptables -P FORWARD DROP&lt;br /&gt;
		iptables -P OUTPUT DROP&lt;br /&gt;
		# Now flush out any existing rules and non-default chains&lt;br /&gt;
		iptables -F&lt;br /&gt;
		iptables -X&lt;br /&gt;
		# Now allow full access to local lan only&lt;br /&gt;
		iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT&lt;br /&gt;
		iptables -A OUTPUT -s 192.168.0.0/24 -j ACCEPT&lt;br /&gt;
		# Allow full access for localhost, need access&lt;br /&gt;
		# to at least port 9000 for X windows to be able&lt;br /&gt;
		# to function&lt;br /&gt;
		iptables -A INPUT -s 127.0.0.1 -j ACCEPT&lt;br /&gt;
		iptables -A OUTPUT -s 127.0.0.1 -j ACCEPT&lt;br /&gt;
	;;&lt;br /&gt;
&lt;br /&gt;
	*)&lt;br /&gt;
		echo 'Only start, stop and restart arguments with this script'&lt;br /&gt;
		exit 1&lt;br /&gt;
	;;&lt;br /&gt;
esac&lt;br /&gt;
exit 0&lt;br /&gt;
;;</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=1640#1640</comments>
                                        <author>Anonymous</author>
                                        <pubDate>Wed May 11, 2005 9:11 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=1640#1640</guid>
                                      </item>
                                      <item>
                                        <title>Re: iptables Questions - Linux Format LXF63 February 2005</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=1441#1441</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=-1'&gt;Anonymous&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Sun May 08, 2005 10:16 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Thanks for all the help so far, but I need a little more advice. As I have the strange situation where what I am doing stops kde/gnome from starting.&lt;br /&gt;
&lt;br /&gt;
I have created the script (at end of this message) and did the following (on Mandrake 10.1):&lt;br /&gt;
&lt;br /&gt;
1) Put script &quot;block_internet_access&quot; in /etc/rc.d/init.d/&lt;br /&gt;
&lt;br /&gt;
2) Changed protection on file with:&lt;br /&gt;
   chmod 744 block_internet_access&lt;br /&gt;
&lt;br /&gt;
3) Edited /etc/rc.d/rc.local file. The comment in this file is:&lt;br /&gt;
   # This script will be executed *after* all the other init scripts.&lt;br /&gt;
   # You can put your own initialization stuff in here if you don't&lt;br /&gt;
   # want to do the full Sys V style init stuff.&lt;br /&gt;
&lt;br /&gt;
   Added following lines to the end of the file:&lt;br /&gt;
   # Run block_internet_access script&lt;br /&gt;
   /etc/init.d/block_internet_access start&lt;br /&gt;
&lt;br /&gt;
Now when I was logged in before a re-boot I could issue as root:&lt;br /&gt;
# /etc/rc.d/init.d/block_internet_access start&lt;br /&gt;
&lt;br /&gt;
# /etc/rc.d/init.d/block_internet_access stop&lt;br /&gt;
&lt;br /&gt;
and all worked as I expected. Checking with a web browser for internet access and chekcing &quot;iptables -nL&quot; output.&lt;br /&gt;
&lt;br /&gt;
However, when I re-booted a major problem occured. I got to the Mandrake login screen (so I think this means X has started ok). Entered username and password, and kde started. It got stuck at &quot;Initialising system services&quot; for about 1 minute or so and then the kde startup box disappeared and I was just left with the blue background screen. The machine was locked solid and I had to do a hard power off. The same thing happened when I tried gnome, rather than kde.&lt;br /&gt;
&lt;br /&gt;
If, however, I pressed &amp;lt;ESC&amp;gt; at the lilo prompt and did a &quot;linux 3&quot; I get the non-graphical start (no X). I can log in and all is ok. When I run &quot;iptables -nL&quot; (as root) I get the following output, (which is what I was expecting):&lt;br /&gt;
&lt;br /&gt;
Chain INPUT (policy DROP)&lt;br /&gt;
target     prot opt source               destination         &lt;br /&gt;
ACCEPT     all  --  192.168.0.0/24       0.0.0.0/0           &lt;br /&gt;
&lt;br /&gt;
Chain FORWARD (policy DROP)&lt;br /&gt;
target     prot opt source               destination         &lt;br /&gt;
&lt;br /&gt;
Chain OUTPUT (policy DROP)&lt;br /&gt;
target     prot opt source               destination         &lt;br /&gt;
ACCEPT     all  --  192.168.0.0/24       0.0.0.0/0 &lt;br /&gt;
&lt;br /&gt;
So my script appears to have run correctly. Via this login I can edit things to change the system.&lt;br /&gt;
&lt;br /&gt;
Obviously I have something wrong though, and would appreciate some pointers as I am out of my depth. Is there access to some other network address kde/gnome is missing? localhost 127.0.0.1 (I believe) comes to mind?&lt;br /&gt;
&lt;br /&gt;
When I comment out the line I added in the rc.local file, kde starts up fine on the next re-boot.&lt;br /&gt;
&lt;br /&gt;
As an aside, I don't think adding the call to the rc.local file is how the rest of the system scripts are called, and some pointers as to how to start my script in the same way as the others is a longer term goal.&lt;br /&gt;
&lt;br /&gt;
Thanks in advance for any help.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Script below:&lt;br /&gt;
&lt;br /&gt;
****&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# block_internet_access script&lt;br /&gt;
# Control internet access using IPTABLES rules&lt;br /&gt;
&lt;br /&gt;
case &quot;$1&quot; in&lt;br /&gt;
	start)&lt;br /&gt;
		# Apply firewall restrictions&lt;br /&gt;
		# First set up so default policy is set to DROP&lt;br /&gt;
		iptables -P INPUT DROP&lt;br /&gt;
		iptables -P FORWARD DROP&lt;br /&gt;
		iptables -P OUTPUT DROP&lt;br /&gt;
		# Now flush out any existing rules and non-default chains&lt;br /&gt;
		iptables -F&lt;br /&gt;
		iptables -X&lt;br /&gt;
		# Now allow full access to local lan only&lt;br /&gt;
		iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT&lt;br /&gt;
		iptables -A OUTPUT -s 192.168.0.0/24 -j ACCEPT&lt;br /&gt;
	;;&lt;br /&gt;
&lt;br /&gt;
	stop)&lt;br /&gt;
		# Now remove all rules and allow full access&lt;br /&gt;
		# firewall is ineffect disabled. This is safe&lt;br /&gt;
		# when behind a hardware firewall interface&lt;br /&gt;
		# to the internet&lt;br /&gt;
		&lt;br /&gt;
		# Now flush out any existing rules and non-default chains&lt;br /&gt;
		iptables -F&lt;br /&gt;
		iptables -X&lt;br /&gt;
		# Set up default policy to ACCEPT&lt;br /&gt;
		iptables -P INPUT ACCEPT&lt;br /&gt;
		iptables -P FORWARD ACCEPT&lt;br /&gt;
		iptables -P OUTPUT ACCEPT&lt;br /&gt;
	;;&lt;br /&gt;
&lt;br /&gt;
	restart)&lt;br /&gt;
		# First set up so default policy is set to DROP&lt;br /&gt;
		iptables -P INPUT DROP&lt;br /&gt;
		iptables -P FORWARD DROP&lt;br /&gt;
		iptables -P OUTPUT DROP&lt;br /&gt;
		# Now flush out any existing rules and non-default chains&lt;br /&gt;
		iptables -F&lt;br /&gt;
		iptables -X&lt;br /&gt;
		# Now allow full access to local lan only&lt;br /&gt;
		iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT&lt;br /&gt;
		iptables -A OUTPUT -s 192.168.0.0/24 -j ACCEPT&lt;br /&gt;
	;;&lt;br /&gt;
&lt;br /&gt;
	*)&lt;br /&gt;
		echo 'Only start, stop and restart arguments with this script'&lt;br /&gt;
		exit 1&lt;br /&gt;
	;;&lt;br /&gt;
esac&lt;br /&gt;
exit 0&lt;br /&gt;
;;</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=1441#1441</comments>
                                        <author>Anonymous</author>
                                        <pubDate>Sun May 08, 2005 10:16 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=1441#1441</guid>
                                      </item>
                                      <item>
                                        <title>RE: reboot</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=1335#1335</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=-1'&gt;Anonymous&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed May 04, 2005 11:37 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Thanks for the last couple of replies on the IP block addressing, I think I now just about understand it. If anyone else is interested I went hunting for some more information and found the following expanded further on the explainations helpfully given above.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.freesoft.org/CIE/Course/Subnet/5.htm&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://www.freesoft.org/CIE/Course/Subnet/5.htm&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.freesoft.org/CIE/Course/Subnet/10.htm&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://www.freesoft.org/CIE/Course/Subnet/10.htm&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
and if you really think you understand it, you can answer a quiz, which I did (sad I know), at:&lt;br /&gt;
&lt;a href=&quot;http://www.freesoft.org/CIE/Course/Subnet/quiz1a.cgi&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://www.freesoft.org/CIE/Course/Subnet/quiz1a.cgi&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Thank-you for your help.&lt;br /&gt;
&lt;br /&gt;
Also thanks for the snort explanation.</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=1335#1335</comments>
                                        <author>Anonymous</author>
                                        <pubDate>Wed May 04, 2005 11:37 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=1335#1335</guid>
                                      </item>
                                      <item>
                                        <title>RE: reboot</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=1305#1305</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=-1'&gt;Anonymous&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed May 04, 2005 8:37 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Sorry about the snort code in the script. I simply copied and pasted my snort shell script instread of creating  a new one.&lt;br /&gt;
Snort is a very good intrustion detection system that help idetify hacking atempts on your system.&lt;br /&gt;
&lt;br /&gt;
just take this code out..&lt;br /&gt;
&lt;br /&gt;
Giz&lt;br /&gt;
GBDesign - ERP for the SME - web based data driven solutions</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=1305#1305</comments>
                                        <author>Anonymous</author>
                                        <pubDate>Wed May 04, 2005 8:37 am</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=1305#1305</guid>
                                      </item>
                                      <item>
                                        <title>RE: reboot</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=1304#1304</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=-1'&gt;Anonymous&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed May 04, 2005 4:24 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Sorry,&lt;br /&gt;
&lt;br /&gt;
Just correcting a typo, I meant:&lt;br /&gt;
&lt;br /&gt;
... start their IP address with 192.168.1. &lt;br /&gt;
&lt;br /&gt;
skecs</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=1304#1304</comments>
                                        <author>Anonymous</author>
                                        <pubDate>Wed May 04, 2005 4:24 am</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=1304#1304</guid>
                                      </item>
                                      <item>
                                        <title>RE: reboot</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=1303#1303</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=-1'&gt;Anonymous&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Wed May 04, 2005 4:12 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hi.&lt;br /&gt;
&lt;br /&gt;
tomdeb talked about a network mask of 24 bit because the IP Address is actually 4 bytes long, each byte is eight bits. Using binary numbers to represent each section of the IP address (the language computers understand) you have a sequence of 0's and 1's like this:&lt;br /&gt;
&lt;br /&gt;
192.168.1.1 =&amp;gt; 11000000.10101000.00000001.00000001&lt;br /&gt;
&lt;br /&gt;
There fore the /24 blocks 24 bits =&amp;gt; the first three sections are blocked and the network from 1 =&amp;gt; 254 is accessible to other computers that start their IP address with 192.168.0.&lt;br /&gt;
&lt;br /&gt;
skecs</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=1303#1303</comments>
                                        <author>Anonymous</author>
                                        <pubDate>Wed May 04, 2005 4:12 am</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=1303#1303</guid>
                                      </item>
                                      <item>
                                        <title>RE: reboot</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=1299#1299</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=-1'&gt;Anonymous&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Tue May 03, 2005 10:42 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Thank-you to the two people who have replied. I already have the rules in a simple script, to save typing the rules in each time. You have given me the pointers I needed as to a sensible way to graft this into the system.&lt;br /&gt;
&lt;br /&gt;
I have question about the example script from gizard, I do not understand the line:&lt;br /&gt;
  test -x $SNORT_PATH/snort || exit 0&lt;br /&gt;
as I don't know what snort is and I haven't had to use so far. Have I missed something?&lt;br /&gt;
&lt;br /&gt;
Also I did some further searching on the web and found some old LXF articles:&lt;br /&gt;
&lt;a href=&quot;http://www.davidcoulson.net/writing/lxf/38/iptables.pdf&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://www.davidcoulson.net/writing/lxf/38/iptables.pdf&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.davidcoulson.net/writing/lxf/39/iptables.pdf&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://www.davidcoulson.net/writing/lxf/39/iptables.pdf&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://davidcoulson.net/writing/lxf/14/iptables.pdf&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://davidcoulson.net/writing/lxf/14/iptables.pdf&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The LXF14 ones talks about using iptables-save and iptables-restore, to save and re-store the rules, not something I have come across before, so I will stick to the script idea.&lt;br /&gt;
&lt;br /&gt;
In the first reply from tomdeb, he said:&lt;br /&gt;
&amp;gt; because it s a 24 bit network mask covering the first 24 bits of the address.&lt;br /&gt;
&amp;gt; Thus 192.168.0.0 -&amp;gt; 192.168.0.255 are accessible.&lt;br /&gt;
  2**24=16.7e6&lt;br /&gt;
I thought that the bits of an ip address between the dots were only three numbers, 000 -&amp;gt; 999 (I guess) and so only 1000 possibilities.&lt;br /&gt;
So I am afraid I still do not understand how:&lt;br /&gt;
  192.168.0.0/24  (a range of 24 bits)&lt;br /&gt;
is equivalent to 192.168.0.0 to 192.168.0.999. (a range of 1000)&lt;br /&gt;
I have a feeling that I have a fundamental flaw in my understanding.</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=1299#1299</comments>
                                        <author>Anonymous</author>
                                        <pubDate>Tue May 03, 2005 10:42 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=1299#1299</guid>
                                      </item>
                                      <item>
                                        <title>reboot</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=1287#1287</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=337'&gt;gizard&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Tue May 03, 2005 3:37 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      I personally like to create boot shell scripts for this type of thing. I can then stop start and restart these without much hastle.&lt;br /&gt;
&lt;br /&gt;
I.e.&lt;br /&gt;
/etc/inint.d/rc.3/myiptable stop&lt;br /&gt;
&lt;br /&gt;
somthing like this might be useful&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Control IPTABLE rules&lt;br /&gt;
&lt;br /&gt;
# path to iptable&lt;br /&gt;
IPTABLE_PATH=/bin&lt;br /&gt;
&lt;br /&gt;
# set interface&lt;br /&gt;
IFACE=eth0&lt;br /&gt;
&lt;br /&gt;
# End of configuration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
test -x $SNORT_PATH/snort || exit 0&lt;br /&gt;
&lt;br /&gt;
case &amp;quot;$1&amp;quot; in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;start&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;# insert IPTABLE rules here&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iptables -A OUTPUT -s 192.168.0.0/24 -j ACCEPT&lt;br /&gt;
&amp;nbsp; &amp;nbsp;;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;stop&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # flush IPTABLE rules here&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iptables -P INPUT DROP&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iptables -P FORWARD DROP&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iptables -P OUTPUT DROP&lt;br /&gt;
&amp;nbsp; &amp;nbsp;;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;restart&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # flush IPTABLE rule&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Reset IPTABLE rules&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iptables -P INPUT DROP&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iptables -P FORWARD DROP&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iptables -P OUTPUT DROP &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; iptables -A OUTPUT -s 192.168.0.0/24 -j ACCEPT&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;*&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo 'you can only use start - stop - restart with this script'&lt;br /&gt;
&amp;nbsp; &amp;nbsp;exit 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp;;;&lt;br /&gt;
esac&lt;br /&gt;
exit 0&lt;br /&gt;
;;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
not sure what your like at bashin the old shell but heres a link for ya that will show you what you need to know&lt;br /&gt;
&lt;a href=&quot;http://www.tldp.org/LDP/abs/html/part1.html&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://www.tldp.org/LDP/abs/html/part1.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Giz&lt;br /&gt;
GBDesign.net - ERP for SME - Data drive web design based solutions - PHP cert - mySQL cert</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=1287#1287</comments>
                                        <author>gizard</author>
                                        <pubDate>Tue May 03, 2005 3:37 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=1287#1287</guid>
                                      </item>
                                      <item>
                                        <title>Re: iptables Questions - Linux Format LXF63 February 2005</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=1278#1278</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=734'&gt;tomdeb&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Tue May 03, 2005 10:00 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      &lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Anonymous wrote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;quote&quot;&gt;&lt;br /&gt;
1) When I re-boot the settings are lost. They default back to a default of all ACCEPT and and my local lan ACCEPT rules have gone.&lt;br /&gt;
The article did not seem to mention what to do to make the changes stay after a re-boot.&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
create a simple bash script in /etc/init.d and then symlink it in your /etc/rc?.d.&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Anonymous wrote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;quote&quot;&gt;&lt;br /&gt;
2) A curiosity question. 192.168.0.0/24 refers to all devices on the subnet 192.168.0. I thought it would only refer to devices 0 to 24. I have checked that it does what the article says, 192.168.0.102 is covered by 192.168.0.0/24, and I am able to ping it on my lan. I just do not understand why.&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
because it s a 24 bit network mask covering the first 24 bits of the address. Thus 192.168.0.0 -&amp;gt; 192.168.0.255 are accessible.</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=1278#1278</comments>
                                        <author>tomdeb</author>
                                        <pubDate>Tue May 03, 2005 10:00 am</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=1278#1278</guid>
                                      </item>
                                      <item>
                                        <title>iptables Questions - Linux Format LXF63 February 2005</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=1251#1251</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=-1'&gt;Anonymous&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Mon May 02, 2005 6:22 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      On one pc I needed to set it up so access to and from the internet was stopped (DROP) but access to and from the local lan was allowed (ACCEPT).&lt;br /&gt;
&lt;br /&gt;
I followed the article in LXF63 (pp 54-55) and also looked at a couple of useful tutorials on the web. I was successful with the following comands:&lt;br /&gt;
&lt;br /&gt;
# iptables -P INPUT DROP&lt;br /&gt;
# iptables -P FORWARD DROP&lt;br /&gt;
# iptables -P OUTPUT DROP&lt;br /&gt;
# iptables -A INPUT -s 192.168.0.0/24 -j ACCEPT&lt;br /&gt;
# iptables -A OUTPUT -s 192.168.0.0/24 -j ACCEPT&lt;br /&gt;
&lt;br /&gt;
Great. However, I have two questions:&lt;br /&gt;
&lt;br /&gt;
1) When I re-boot the settings are lost. They default back to a default of all ACCEPT and and my local lan ACCEPT rules have gone.&lt;br /&gt;
The article did not seem to mention what to do to make the changes stay after a re-boot.&lt;br /&gt;
&lt;br /&gt;
2) A curiosity question. 192.168.0.0/24 refers to all devices on the subnet 192.168.0. I thought it would only refer to devices 0 to 24. I have checked that it does what the article says, 192.168.0.102 is covered by 192.168.0.0/24, and I am able to ping it on my lan. I just do not understand why.&lt;br /&gt;
&lt;br /&gt;
Thanks in advance for any help.</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=1251#1251</comments>
                                        <author>Anonymous</author>
                                        <pubDate>Mon May 02, 2005 6:22 pm</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=1251#1251</guid>
                                      </item></channel></rss>