Build It Yourself: A Linux Network Appliance, Part 5 Cary NC

In this installment, we take a quick tour of Webmin and set up an IP tables Internet-connection sharing firewall. Read on for more information about working with Linux.

Local Companies

C Bridge Internet Solutions
(919) 806-4413
2530 Meridian Pkwy
Durham, NC
Icontact
(919) 287-0060
2635 Meridian Pkwy
Durham, NC
Savvis Communications
(919) 484-8932
6910 Fayetteville RD
Durham, NC
Up Associates USA LLC
(919) 313-2501
1000 Park Forty Plz
Durham, NC
Bhi Advance Internet
(919) 598-1317
1808 S Miami Blvd
Durham, NC
Emj Internet
(919) 474-8514
5400 S Miami Blvd
Durham, NC
Inflow Corporation
(919) 941-1082
4518 S Miami Blvd
Durham, NC
Principled Technologies
(919) 941-9812
1007 Slater Rd
Durham, NC
Propellor Interactive Design
(919) 544-7750
2314 S Miami Blvd
Durham, NC
HughesNet High Speed Internet Authorized Dealer
(919) 246-9668
350 Holloway St
Durham, NC

provided by: 
Originally published at Internet.com


In our previous installments we did a lot of important preliminary configuration, and we hardened our firewall box. Now we'll take a quick tour of Webmin, and set up an iptables Internet-connection sharing firewall. Don't connect your firewall box to the Internet just yet, as there are some important steps to take first.

Cruising Webmin
Webmin is an excellent, flexible graphical configuration interface for Linux. You can find modules to configure and manage virtually every Linux service. Unlike a lot of graphical configurators, Webmin reads the source configuration files directly, so you can switch back and forth between using Webmin and editing the files yourself without making a mess.

A word of caution: Just having a good graphical interface does not instantly make you a system administrator. You need the same knowledge whether you use Webmin or you edit text configuration files directly. Take some time to look around Webmin and see what you can do with it. You can't accidentally hurt anything, because you always have to a click a button to activate any changes.

Sharing an Internet Connection
We're going to use two scripts for our iptables firewall; one to turn it on, and one to turn it off. Plus we're going to enter some important kernel parameters in /etc/sysctl.conf. Make it look just like this, with no other entries: # /etc/sysctl.conf - Configuration file for setting system variables # See sysctl.conf (5) for information. net.ipv4.ip_forward = 1 net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.tcp_syncookies = 1 net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.all.accept_source_route = 0

Build a Linux Appliance
* Part 1: Introduction and Hardware Requirements * Part 2: Install and Configure Linux * Part 3: The Firewall * Part 4: Locking Down the Firewall Box * Part 5: Internet Connection Sharing Firewall * Part 6: The Firewall The first line, net.ipv4.ip_forward = 1 is what turns on Internet connection sharing. The remaining items are security features.

I call the firewall script firewall_nat; you may name it whatever you want. (Access the firewall nat script here.)

Copy this just as it's shown, with these exceptions: * Use your own network interface names * Use your own IP addresses * On the "Enable IP masquerading" line, you have two choices. If you have a static WAN IP, use the SNAT line, substituting your own IP. If you are on DHCP, use the MASQUERADE line

Make this script executable, and read/write for root only:

# chmod 0700 firewall_nat
# chown root:root firewall_nat

This is the "shutoff" script, which I call ipt_flush. Give it the same ownership and permissions as firewall_nat: (Access the ipt_flush script here.)

Place firewall_nat in /etc/init.d, and ipt_flush in /usr/local/bin. As root, test both of them:

# /etc/init.d/firewall_nat
The firewall has now started up and is faithfully protecting your system
# ipt_flush
The firewall is now being shut down. All policies are set to ACCEPT, all rules and chains are deleted, all counters are set to zero

Well OK then. They work!

Testing the Firewall
Fire up the firewall and run this command to verify that your iptables rulesets are active: # iptables -L Chain INPUT (policy DROP)target prot opt source destination ACCEPT all - anywhere anywhere ACCEPT tcp - localnet/24 anywhere tcp dpt:ssh state NEW ACCEPT tcp - localnet/24 anywhere tcp dpt:10000 state NEW ACCEPT all - anywhere anywhere state RELATED,ESTABLISHED ACCEPT icmp - anywhere anywhere icmp echo-request ACCEPT icmp - anywhere anywhere icmp time-exceeded ACCEPT icmp - anywhere anywhere icmp destination-unreachable DROP tcp - anywhere anywhere tcp flags:SYN,RST,ACK/SYN Chain FORWARD (policy DROP)target prot opt source destination ACCEPT all - anywhere anywhere state RELATED,ESTABLISHED ACCEPT all - anywhere anywhere state NEW,RELATED,ESTABLISHED Chain OUTPUT (policy ACCEPT)target prot opt source destination

Connect your WAN interface to the big scary Internet, and disconnect the firewall box from the LAN. Ping Google and other sites you can reasonably expect will always work. When your ping tests succeed, boot up one of your LAN clients with a live Linux on CD-ROM, connect it to your switch/hub, and do a bit of Web-surfing to verify that everything works. This is the safest way to test LAN connectivity, since a CD-ROM cannot be compromised.

The last step is to configure the firewall to start at boot. Do this in Webmin, using System -> Bootup and Shutdown.

You now have a nice sturdy Internet-connection sharing iptables firewall. Next week we'll learn how to configure it for public services like a Web or mail server, and how to prevent bad packets from escaping your network.

Resources * Thank you to the gang at Linuxchix.org for their invaluable assistance
* FrozenTech's list of Live Linux CDs
* The Penguin's Practical Network Troubleshooting Guide, Part 1
* The Penguin's Practical Network Troubleshooting Guide, Part 2
* The Linux Cookbook, step-by-step Linux system administration

Adapted from PracticallyNetworked.com, part of the EarthWeb.com Network.

Do you have a comment or question about this article or other small business topics in general? Speak out in the SmallBusinessComputing.com Forums. Join the discussion today! The first line, net.ipv4.ip_forward = 1 is what turns on Internet connection sharing. The remaining items are security features.

I call the firewall script firewall_nat; you may name

Author: Carla Schroder

Read article at Internet.com site

Featured Local Company

C Bridge Internet Solutions

(919) 806-4413
2530 Meridian Pkwy
Durham, NC

Related Articles
- Fasthosts Linux Standard Cary NC
Fasthosts gives you a lot of web hosting for your money. Experienced users will welcome the advanced tools and scripting. If you're new to building websites, the 750MB of web space and 200 email boxes are still worth the money.
- WebDefend Appliance Cary NC
- Domia Bye Bye Standby Online Controller Cary NC
- Ubuntu Linux 7.04 Cary NC
- Billion BiGuard S5 Cary NC
- Configuring NTP Cary NC
- Email Anti-Spam And Anti-Virus Protection Cary NC
- How to Monitor Network Speed and Performance Cary NC
- Trustix Linux for Small Businesses Cary NC
- Virtual Servers Within the DMZ Networks Cary NC
Related Articles
- Fasthosts Linux Standard Cary NC
Fasthosts gives you a lot of web hosting for your money. Experienced users will welcome the advanced tools and scripting. If you're new to building websites, the 750MB of web space and 200 email boxes are still worth the money.
- WebDefend Appliance Cary NC
- Domia Bye Bye Standby Online Controller Cary NC
- Ubuntu Linux 7.04 Cary NC
- Billion BiGuard S5 Cary NC
- Configuring NTP Cary NC
- Email Anti-Spam And Anti-Virus Protection Cary NC
- How to Monitor Network Speed and Performance Cary NC
- Trustix Linux for Small Businesses Cary NC
- Virtual Servers Within the DMZ Networks Cary NC
Related Local Events
North Carolina Legislative Holiday Reception (Govt. Affairs)
Dates: 12/3/2009 - 12/3/2009
Location: Washington Duke Inn & Golf Club
Durham, NC
View Details

North Carolina Legislative Holiday Reception (Govt. Affairs)
Dates: 12/3/2009 - 12/3/2009
Location: Washington Duke Inn & Golf Club
Durham, NC
View Details

Breakfast & Business (PWN)
Dates: 11/24/2009 - 11/24/2009
Location: Durham Chamber
Durham, NC
View Details

Breakfast & Business (PWN)
Dates: 11/24/2009 - 11/24/2009
Location: Durham Chamber
Durham, NC
View Details

Lunch & Learn (SBC)
Dates: 11/11/2009 - 11/11/2009
Location: Durham Chamber
Durham, NC
View Details

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Advertising Family Home Services Real Estate Resources
Business Services Fashion Industrial Goods & Services Retail & Consumer Services
Career Financial Services Insurance Software
Cars Food & Beverage Internet Technology
Computer Hardware Franchise Legal Telecommunications
Construction Health Miscellaneous Trade Shows
Education Holidays Nightlife Travel
Entertainment Home Appliances Online Database Weddings
Environmental Home Electronics Pets World History