Sunday, August 10, 2008
The Server is Up! Also, Internet Forwarding!
Two very exciting pieces of news today. Well, tonight.

My friend, and future roommate, and I have successfully set up our file server for the up coming semester. We're using his old computer and two 750GB drives in a software Raid (RAID1). Everything works very nicely. It was extremely easy to set up under Arch Linux. All hail the mighty Arch! Here's how I did it:

1.) Format the two drives. Make sure they have the filesystem "Linux raid autodetect"

2.) Create the array. This will create a new node in /dev/ named 'md0'. This will be the mountable drive.
# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/s
d* /dev/sd*

3.) Then we simply add this array to the mdadm.conf file so that it may be assembled on boot.
# mdadm -D --scan >>/etc/mdadm.conf

4.) Don't forget to add your raid to fstab so that it can b
e mounted on boot!

Freakin' DONE. Now onto the second bit of news:

I managed to get my laptop onto the 'net through my desktop PC. This was also very very easy to do on two Arch machines. It takes a tad bit longer, but only in the number of steps to complete. No thinking really required. Here's how I did it:

1.) Set up the above scenario. Wait to configure the laptop part; we'll do this last.

2.) "Computer" should have iptables installed. If it doesn't, install it.

3.) # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
- The above will set a rule for device eth0 to Masquerade any packet leaving as its own address. I'm really not sure about the nitty gritty of this, but just stay with me.

4.) # echo 1 > /proc/sys/net/ipv4/ip_forward
-This tells the running kernel that you DO want to forward packets.

4.5) Edit /etc/sysctl.conf so that net.ipv4.ip_forward=1
-This will be set on every boot

5.) # /etc/rc.d/iptables save; /etc/rc.d/iptables start
-Saves the running configuration and starts iptables

...On to the laptop...

6.) # ifconfig eth0; route add default gw
-Sets the ip address and default gateway for the ethernet device on the laptop.

7.) Check to see if you can ping:

...Back to Computer...

8.) # iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-Sets to allow any existing connections and anything "Related" such as FTP servers connecting back to you (?)

9.) # iptables -A INPUT -m state --state NEW -i ! eth0 -j ACCEPT
-Allows any new connections coming from anywhere EXCEPT eth0

10.) # iptables -P INPUT DROP
-Drops everything else.

For any additional info, go to where I found all of this info:
Links to this post:
Create a Link