Academic Tutorials

English | French | Portugese | German | Italian
Home Advertise Payments Recommended Websites Interview Questions FAQs
News Source Codes E-Books Downloads Jobs Web Hosting

BSD Introduction
BSD Overview
BSD Installation Synopsis
Pre-installation Tasks
Starting the Installation
Introducing Sysinstall
Allocating Disk Space
Choosing What to Install
Installation Media
Committing the Installation
Advanced Installation Guide
Preparing Your Own Installation Media
Installation Process
Post Installation
FreeBSD OS Basic Example
The FreeBSD Kernel
FreeBSD Network interfaces
FreeBSD Firewall
FreeBSD Gatewya/Router
Nat and IPFW

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
Apple Script
PL/SQL Tutorial
SQL Server
.NET (dotnet)
.Net Mobile
C# : C Sharp
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Assembly Language
Forth Programming
Lisp Programming
Data Warehousing
CGI Programming
Emacs Tutorial
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Operating System
Software Testing
SAP Module
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Financial Accounting
Managerial Accounting
Network Sites

FreeBSD Gatewya/Router

Previoushome Next

FreeBSD Gatewya/Router



This guide takes takes you through the steps of setting up your FreeBSD box to be your gateway/router. Some fundamentals of routing and networks is required by the reader. I won't get into too much detail about the routing but you'd be better off at least knowing the concpets.

FreeBSD Gateway Concepts

One of the most popular things to do is to use your PC and FreeBSD to be the router for your home network. The concept is fairly straight forward. You have 2 ethernet cards one for your 'inside' network and one for your 'internet connection' or 'outside' network. You enable routing and wallah! Conceptually, here is a map of how your network will look when you are done:

Adding a local network

First off, let's add a local network. This is sometimes called an 'inside' or 'private' network. This do to the fact that the IP space (IPs used on the network) are private and reserved (see RFC1918). Anyhow, In order to add a 'private' network you need to add another ethernet card to your FreeBSD machine. You need at least 2 ethernet cards to use this setup. Make sure you install the both cards. Bring the machine up with both network cards installed. In my example I use the xl0 interface as the 'outside' or 'public' ethernet card. This xl0 card connects to my internet connection. In this example, I'm using ethernet cards but they could be ANY interface (ppp, tun, gif, etc). I'm using xl1 as my 'private' ethernet connection. The ordering is irrelevant. I could have just as easily chosen xl0 to be my private and xl1 to be my public. Make no difference.

Once you have both cards installed and they show up in ifconfig output, you are set and ready to go. Configure the inside address as some IP in your private IP space. In my example I chose to use as my RFC1918 private IP space. In reality it doesn't matter what IP range is used. But for simplicity, I'm using through I assign an ip to my xl1 card. I chose to use as my BSD machines interface (once again pick anyone out of your range of private IP space). If you don't know how to set up the interfaces, please visit my Interfaces page. Remember what IP you assign to the xl0 interface as you will need it later. xl0 will have an IP from my ISP. Basically, leave xl0 alone. We will be doing work on xl1 only.

Enabling gateway routing

Now time to tell BSD that it is OK to let packets get forwarded or 'routed' between interfaces. This is accomplished by a sysctl variable: net.inet.ip.forwarding. To set this:

	# sysctl -w net.inet.ip.forwarding=1

This flag (when set to 1 meaning ON) tells the kernel it is OK to forward packets between interfaces. Of course, this won't set it permanently. You need to add an option to /etc/rc.conf:


You just turned your machine into a ROUTER!!!

Client setups

Setting options in the clients TCP/IP settings is crucial for this to work right. The idea is to have the client machines on the private network ( point the gateway to the IP you assigned to xl1 (In my case it is To do this, edit the client machine TCP/IP settings. Add an IP from the range of through, set the netmask to (/24), set the gateway address to the IP you assigned to your xl1 interface ( Add the DNS servers. If you setup DNS on your BSD machine like shown in the DNS section, you can use your DNS server on your machine by putting the IP assigned to xl1 in as the DNS server (In my case If you didn't setup DNS on your BSD machine, just use your ISP's DNS server. Although, I would recommend setting up a caching-only nameserver for several reasons (all of which are out of scope for this).

Before you go any further, make sure you can 'ping' from ALL YOUR CLIENT MACHINES! Nothing irritating more than troubleshooting complex problems when there is a simple problem.


At this point if you try to ping or goto an internet address nothing will work. The reason for this is that when you send traffic to a machine outside your private network, the packet gets sent to your default gateway. The default gateway, in this case its your FreeBSD machine, sends the packet unchanged out the xl0 interface to the internet (through your ISP). Well, the problem with that is the IP space your are running on your inside network is what they call 'nonrouteable'. In simple terms, it means that those IPs can't be routed across the backbone of the internet. See RFC1918 for more detail.

So, we have a solution. It is called NAT. It changes your private IP's to a public IP, sends it out, and when the packet comes back it changes it back to the private IP that originally sent it. NAT is very complex which is why I wrote a whole how-to on it. To set it up please read the Nat Section

Testing your Solution

Testing is fairly straight forward. Try surfing with your clients, checking mail, etc. If you run into problems, turn on logging on both natd and with the firewall. Most of the time you missed something real straight forward.

Another problem with NAT is that somethings just won't work through NAT. Noteably, IPSEC VPNs, H323, and some chat/transfer programs. This has to do with the stupidity of Microsoft and others but there are workarounds...all of which are difficult to implement.

Be the first one to comment on this page.

  BSD eBooks

No eBooks on BSD could be found as of now.

More Links » »
 BSD Interview Questions
More Links » »
 BSD Articles

No BSD Articles could be found as of now.

 BSD News

No News on BSD could be found as of now.

 BSD Jobs

No BSD Articles could be found as of now.

Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previoushome Next

Keywords: bsd programming language, bsd language programming tutorial pdf, history of bsd programming, basic bsd programming, bsd band satellite programming, syntax use in bsd programming, bsd programming software download, turbo bsd programming, bsd programming code, learn bsd programming

HTML Quizzes
CSS Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
XML Quizzes
XML Quiz
XSL Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizzes
JavaScript Quiz
VBScript Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizzes
ASP Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizzes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
VC++ Quiz
Multimedia Quizzes
SVG Quiz
Flash Quiz
Media Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building Quizzes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizzes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
Programming Langauges Quizzes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizzes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizzes
Oracle Quiz
MySQL Quiz
Operating System Quizzes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
Software Testing Quizzes
Testing Quiz
Firewalls Quiz
SAP Module Quizzes
ERP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizzes
Corba Quiz
Networking Quiz
Microsoft Office Quizzes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizzes
Financial Accounting Quiz
Managerial Accounting Quiz
Testimonials | Contact Us | Link to Us | Site Map
Copyright ? 2008. Academic All rights reserved Privacy Policies | About Us
Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Webhosting in India | Dedicated Server in India | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World | Important Websites
Copyright ? 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.