The simplest FreeBSD gateway scheme

Source: Internet
Author: User

In order to verify the installation of FreeBSD from the Internet, an experiment has been done in the last two days, mainly on how to use FreeBSD to build a gateway, the target is now commonly used PPPoE, this article does not involve traditional telephone dialing, The content of IPFW and IPFilter, because this part of the content is more complex, and there are already too many articles available for reference.

First, set:

1. The operating environment of this article is FreeBSD 4.8-release, using the system default kernel.

2. The ADSL modem is just a dialer with no additional features (such as routing). Using FreeBSD's own PPP to achieve the PPPoE dialing function, the most basic goal is for all clients in the internal network to connect to the Internet through the FreeBSD gateway net (transparent Gateway). The biggest advantage of this approach is that the internal network client can connect to the external network without special configuration.

3. Server IP and DNS settings

First network card

ip:192.168.1.1

Subnet Mask: 255.255.255.0

Gateways: NONE

Second block card

ip:192.168.1.2

Subnet Mask: 255.255.255.0

Gateways: NONE

Because the author's operating environment is a small local area network, so other client's IP is in 192.168.1 this network segment. ADSL modem connected to the server's first network card, the server's second network card is connected to the hub, all clients are connected to the hub.

Second, set up a PPP call using PPPoE

The/etc/ppp/ppp.conf is backed up, and the following is the modified ppp.conf content (you must have one blank before each of the following lines, except for the label name):

Default

Set device PPPOE:FE1 #fe1为连接ADSL Modem's network card name, should be replaced with the device name you use

Enable DNS #自动获取DNS

ADSL: #标签名, can be arbitrarily named

Set AuthName ******** #ADSL用户名

Set Authkey ******** #ADSL密码

Set dial

Set Login

Add default Hisaddr

Only three of the above needs to be modified, that is, connecting the ADSL modem network card name, Internet user name on the password. If you do not know your own network card name, you can get through the ifconfig-a command.

Setting up automatic connection at startup

Add the following lines to the/etc/rc.conf file:

Ppp_enable= "YES"

Ppp_mode= "Ddial" #断线重拨

Ppp_mprofile= "ADSL" #这里的adsl对应的是 the label name in/etc/ppp/ppp.conf

Getway_enable= "YES"

ppp_nat= "YES"

Netd_enable= "YES"

Natd_interface= "Tun0" #ADSL Modem equipment Name

If you want to connect manually, you can do this by using the following command:

Ppp-nat-ddial ADSL

This way, the FreeBSD gateway server side has been set up, and the client is set up below, taking Windows XP as an example.

Iv. Setting up clients

Client settings are simple and simple, and only need to set up gateways and DNS to access the Internet, the steps are as follows: Open the Network Connections window in Control Panel, right-click the Local Area Connection icon, select Properties from the pop-up shortcut menu, and the Local Area Connection Properties dialog box, double-click the Internet Protocol (TCP/IP), and then set the default gateway DNS server address to the IP address of the network card on the FreeBSD connected to the ADSL modem, that is, 192.168.1.1, as shown in the figure.

At this point, the FreeBSD Gateway Setup is complete. Of course, in terms of its function, it can't be compared with IPFW and IPFilter, however, this provides a simple network connection Sharing scheme, and this scheme also has a certain firewall role, for small enterprises or organizations to connect their local network to the Internet is very practical, This approach can also be used to open Internet cafes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.