Build a home network world with FreeBSD

Source: Internet
Author: User
Tags gz file domain name server ftp client administrator password nameserver

With the popularization and upgrading of computers, more and more families already have several computers, and more families are surfing the Internet. As a result, several computers often want to access the Internet at the same time, in this case, two NICs must be installed on one computer as the gateway server (provided that you do not have money to buy a router). Most people will choose Windows2000 as the operating system of the server, because the configuration is very simple, and this server can still be used as a normal workstation, but the configuration of such a server is generally the "Main Force" in the house, otherwise running Win2000 will be very slow, in addition, in order to enable other computers to access the Internet at any time, it still has to work 24 hours a day, and we all know that the current mainstream computer power consumption is very high, in this case, it will be a small amount to pay for the electricity bill. Besides, you are not willing to turn your computer into a single axis, are you? In addition, the current worm is everywhere, and it is troublesome to accidentally trick, because this will often lead to the normal use of the network, it may be a small matter for family users, but for some scientific research, enterprises and institutions, the network may be disconnected for one minute. At the same time, the old computers that have been chased by stars for several years are mostly left out in the corner. These computers basically cannot run Win2000, so we cannot use the traditional method to take advantage of it, but with the FreeBSD operating system, everything is different.

FreeBSD was born from the sort BSD program, which was initiated by researchers such as Bill jolitz to port UNIX from an expensive Unix server to a PC on a common X86 platform, later there were three other participants-nate Williams, Rod Grimes and Jordan K. hubbard joined the program and they decided to continue the very meaningful work. Later, they used the "FreeBSD" from David Green Man as the new name of the system, because after their efforts, since then, there is a UNIX operating system that anyone can use freely. Free means only. FreeBSD is a multi-user operating system. FreeBSD fully supports the TCP/IP protocol. From December 1993, FreeBSD 1.0 was officially released to today's freebsd5.x, the operating system's super stability, operability, high efficiency, security, and low dependence on the system have attracted many users. After familiarizing themselves with FreeBSD, no one will doubt the performance of this system. It is already a very popular network operating system on the Internet, the famous Yahoo, Hotmail, and 163 e-Post Offices all use them as system platforms. After talking about so many things, you must have waited, next I will go to the topic right away-how to use freebsd4.5 to configure an old master as a Pentium 150 CPU, 16 m Edo memory, and 486 m hard drive host (buy about yuan from the second-hand computer city, yuan) it becomes a stable and high-speed gateway server, FTP server, file server, Apache + PHP + MySQL server, and powerful proxy server.

Chapter 1: Install FreeBSD

First, you 'd better have a freebsd installation CD. You can buy it for 10 yuan from the software store, you can also download the first ISO image file of the three installation discs from www.freebsd.org for free and then burn it into a CD. FreeBSD also supports many installation media, such as FTP and NFS, but it is not as safe as the CD. Kernel text. during startup, insert the boot disk and then insert the Kern boot drive as prompted. After normal guidance, we can see the figure 1.

Figure 1

For the sake of simplicity, directly select the first item "Skip Kernel configuration and continue with installation" to ignore the Kernel configuration and continue installation. If you select the second item, the system will enter a simple Kernel configuration interface, there, you can remove devices that are not in your computer, such as SCSI devices and USB devices. The advantage is that the system is streamlined, this reduces the size of the kernel and shortens the time for system startup detection hardware. Figure 2 shows the installation method. We select the "Express" Mode for installation, the main difference between this and the "standard" mode is that after the file is copied, you are not required to set network, user, and other information immediately, so it is an option for impatient people, the purpose of this mode is not to allow the installation system to set the network card, because the network card needs to be followed by a separate "/etc/rc. conf.

Figure 2

Figure 3

Figure 4

Figure 3 shows the fdisk hard disk partition editor provided by FreeBSD. Since my hard disk is an empty disk, only unused partitions named "UNUSED" are displayed, if there is a DoS or NTFS partition on the hard disk, you can see it here. If there is no free space on the hard disk, please use the partition tool such as pqmagic to divide a piece of unused space in advance. With a "UNUSED" partition of a certain size, you can select the "UNUSED" partition and press the "c" key to create a freebsd partition on the partition. FreeBSD calls it "slice ", then we can see the figure 4. Press the "Q" key to save and proceed to the next step.

Figure 5

Figure 5 shows whether to install the system Boot manager. If your computer has an operating system, select the first option to install "Boot manager ", the system will install the Lilo program to the MBR (Master Boot Record) of the hard disk, and start lilo to boot the first operating system to boot the hard disk. Because this hard disk only needs this system, so do not install the system Boot manager, so select the mode "standard", this will add the FreeBSD boot module to the hard disk MBR.

Figure 6

Next, we will divide the FreeBSD file system interface on the "slice" We just created. for users who are not familiar with Linux and UNIX, we recommend that FreeBSD automatically create these file systems, simply press the "A" key to enable FreeBSD to automatically divide space. 6.

Figure 7

In the subsequent installation mode, select "minimal" to minimize the installation mode, as shown in Figure 7. In this way, only the 143 packages required by the system are installed, saving hard disk space and installation time, in fact, the minimal installation already contains many services, which are applicable to FTP, telnet, Sendmail, and nic drivers. After confirmation, the system will prompt you that the data will be lost. After confirmation, the installation media page will appear. Select "CD/DVD" to start the installation and copy process immediately after the optical drive is installed, depending on the speed and installation time of the computer, the installation will be completed in 8 minutes on the PC with the CPU P100, and the installation will end after the installation is restarted.

Chapter 2: Configure as a gateway Server

A gateway Server is a computer that connects an external internet network and an internal home network. It is usually inserted with two NICs, one of which is set as an external Nic and connected to the ISP. Generally, there is a fixed IP address, for example, "202.115.65.225". The other part is set as the internal network card, and the IP address is set as the virtual address. It uses "192.168.0.1" and connects to the hub in the house, make the server a member of the LAN in the home. For other computers in the home, you only need to set the IP address to "192.168.0. * "," * "indicates a number ranging from 2 to. Do not set the IP addresses of the two computers to the same. Otherwise, they will not be able to use them. Set the subnet mask to 255.255.255.0 and the gateway to 192.168.0.1. The following content describes how to use FreeBSD to configure the server as a gateway server that allows all clients to access the Internet at the same time.

First, there must be two NICs on the Computer Host. In this example, there are two rtl8029 chip PCI NICs. FreeBSD requires firewall support to implement the gateway function. Unfortunately, the kernel does not configure firewall support by default. Therefore, you must reconfigure and compile the kernel. The kernel source code directory is under/usr/src/sys/i386. It is not installed at minimal installation, so it must be installed first.

Step 1: Install the kernel source code

Start FreeBSD and Log On As A root user. The following commands starting with "#" are executed on the computer. The input commands must be case sensitive. Run

#/STAND/sysinstall

After the command is executed, the screen shown in Figure 8 is displayed. Select "Index" and press the Space key. on the following page, select "distributions, adding" and "src" with the Space key ", select "sys" on the last page, and then add the FreeBSD installation disc, use the "tab" key to switch to the "OK" button and press enter to copy the kernel source code to the corresponding directory.

Figure 8

 

# Cd/usr/src/sys/i386/CONF/* now you can enter the directory where the kernel source code configuration file generic is located */

# Ee generic/* use the EE editor to edit the generic file */

Add the following content

Options ipfirewall

Options ipfirewall_default_to_accept

Options ipfirewall_verbose

Options ipdivert

Then Press ESC + press enter to save and exit.

# Config generic/* use the modified configuration file to configure the kernel */

# Cd.../compile/generic

# Make depend all install/* re-compile the kernel */

The next step is a long kernel compilation process. After an hour or so on the computer is executed, the system returns to the "#" command prompt mode, which marks the successful configuration, run the "reboot" command to restart the computer.

# Reboot

Step 2: configure the network

Since we didn't configure the NIC when installing FreeBSD, the job after restarting the computer is to configure the NIC first, log On As the Administrator "root" and run the "ifconfig" command to check the detected Nic status.

# Ifconfig

The following results are displayed on the screen:

Ed0: Flags = 8843 <up, broadcast, running, simplex, multicast> MTU 1500

Inet6 fe80: 5054: abff: fe1e: 8895% ed0 prefixlen 64 scopeid 0x1

Ether 52: 54: AB: 1E: 88: 95

ED1: Flags = 8843 <up, broadcast, running, simplex, multicast> MTU 1500

Inet6 fe80: 2e0: 4cff: fe80: 132c % ED1 prefixlen 64 scopeid 0x2

Ether 00: E0: 4C: 80: 13: 2C

Lp0: Flags = 8810 <pointopoint, simplex, multicast> MTU 1500

Lo0: Flags = 8049 <up, loopback, running, multicast> MTU 16384

Inet6: 1 prefixlen 128

Inet6 fe80: 1% lo0 prefixlen 64 scopeid 0x4

Inet 127.0.0.1 netmask 0xff000000

Ppp0: Flags = 8010 <pointopoint, multicast> MTU 1500

Sl0: Flags = c010 <pointopoint, link2, multicast> MTU 552

Faith0: Flags = 8002 <broadcast, multicast> MTU 1500

Check that the two NICs on the top are yours. The two rtl8029 are marked with ed0 and ED1.

Next, modify the configuration file "/etc/rc. conf" to set the NIC parameters.

# Ee/etc/rc. conf

Add the following content:

Ifconfig_ed0 = "Inet 202.115.65.225 netmask 255.255.252.0"

Ifconfig_ed1 = "Inet 192.168.0.1 netmask 255.255.0.0"

Defaultrouter = "202.115.65.65"

The first line sets the ed0 Nic to connect to the Internet. The IP address is 202.115.65.225 and the subnet mask is 255.255.252.0. The specific IP address and subnet mask (netmask) need to be modified as needed; the second line sets ED1 as the Intranet Nic, IP as the virtual address 192.168.0.1, and subnet mask as 255.255.255.0. This is a class C network, and the third line sets the IP address of the gateway connected to the Internet, you can obtain this information from your ISP.

Add content in/etc/rc. conf

Gateway_enable = "yes"

Firewall_enable = "yes"

Firewall_type = "simple"

Firewall_quiet = "yes"

Tcp_extensions = "yes"

Natd_interface = "ed0"

Natd_enable = "yes"

These things mainly involve setting the firewall type, enabling the system to start the firewall, supporting network address translation (NAT), and telling the system to perform address translation through "ed0.

Then Press ESC + press enter to save and exit.

To resolve the domain name, we need to add the Domain Name Server address in/etc/resolv. conf.

# Ee/etc/resolv. conf

Add

Nameserver 202.115.64.33 # This is the master Domain Name Server of Southwest China Jiao Tong University.

Nameserver 202.116.64.34 # This is an auxiliary Domain Name Server of Southwest China Jiaotong University.

Step 3: Modify the/etc/rc. Firewall file so that all computers can freely access and exit through the firewall.

# Cd/etc/

# Ee RC. Firewall

Press Ctrl + u to enter the end of the file and append the following lines:

/Sbin/ipfw-f flush

/Sbin/ipfw add divert natd all from any to any via ed0

/Sbin/ipfw add pass all from any to any

Then Press ESC + press enter to save and exit. Is that easy? The first line is to clear all the above firewall rules, which is also the reason why these lines are added to the file; the second line is to tell the server that all data packets are forwarded from the ed0 Nic through address translation and Nat. ed0 is an external Nic connected to the Internet. The third line is to set the firewall to allow all users to access the network.

If you want to check whether the settings are correct, Run "# sh/etc/rc. Firewall" to check whether the following output exists.

Flushed all rules.

00500 divert 8668 IP from any to any via ed0

00600 allow IP from any to any

Step 4: configure the client

Restart your server. For other clients in the home, you only need to set the IP address to "192.168.0. * ", set the subnet mask to" 255.255.255.0 ", set the DNS provided by the ISP to you, and set the gateway to" 192.168.0.1 ", so that the whole family's computer can access the Internet through this server, one such server consumes less energy and has good stability, and almost never crashes. If the situation is not so smooth and the server cannot access the Internet, first, you can use the ping command on the server to test the gateway. If the gateway fails, run the ARP-ad command to solve the problem, this command is used to delete the ing table between the physical address and IP address of the NIC that is incorrect in the server cache.

Next, you can use the telnet service to remotely manage the server. to start the service, you need to edit "/etc/inetd. in the conf file, remove the "#" comment in front of "Telnet". After restarting, the server will start the service. However, in order to remotely log on, you also need to use the "adduser" command to create a new user for login, which is assumed to be "zhp ". The reason for the Creation is that the "root" user is denied remote login for security reasons on the server, to obtain administrator permissions at the remote end, log on to the remote end and run the "Su" command and administrator password to obtain administrator permissions. However, this normal user must belong to the "Wheel" Management Group, the user can be added to the "Wheel" Management Group at the beginning of creation.

If only a few computers need to share the Internet with this computer, do not buy a hub. You only need to have a one-to-two network adapter, as shown in figure 9, in theory, you can access one more client every time you add a Adapter. One such adapter costs about 3 RMB in the Computer City, which is much more economical than buying a hub. When connecting, note that the network cable between the ENI ED1 and the first one to two is not a common network cable, but a network cable directly connected to two computers. The internal connection is crossed, other network cables are common network cables. The advantage of this connection is to save a hub, but the disadvantage is that each client cannot access each other. However, we will introduce a solution to this problem later, that is, use Samba to convert the FreeBSD server into a file server that no client can access. In this way, it can serve as an intermediary for everyone, and the problem will be solved for more than half.

Figure 9

Chapter 3: Configure as a file server

I just introduced that the network connected through the above clock is not using hub, so each client cannot access each other as the network neighbor, but every client can access the server, therefore, it would be much easier to configure the FreeBSD server as a Windows network neighbor. You can copy the shared items to the server for sharing. The software that implements this function is Samba.

The main function of Samba is to allow Windows users to share files and printers on Unix/Linux servers in the form of network neighbors. The software usage and LAN Management (LanManager) the Protocol is compatible with SMB (or CIFS) protocols, the supported client operating systems include DOS, Win95/98/Me, winnt/2000, Macintosh, OS/2, and Unix/Linux, it also comes with a tool that allows users to configure servers in Web mode-SWAT (Samba Web administration tool), meaning Samba Web-based management tools. Next, let's take a look at how to access the "/Public" Directory of FreeBSD from a Windows client on the same LAN.

First, use a Windows client. To upload this package to the FreeBSD server, we usually use the FTP server. The FTP service, like telnet, is a service that FreeBSD requires minimal installation. To enable it, you only need. in Conf, remove the annotator "#" before "ftp", and then run the "killall-hup 'inetd'" command to re-read and execute the configuration file, after the processing, the FTP client can log on to the server and use the account of any user except root. If you log on as a "zhp" user, FTP will automatically switch to the user's own directory-"/home/zhp/" directory because "zhp" is the owner of the directory, therefore, you have the highest permission for this folder. You can also upload files and then upload the downloaded package to this directory.

We recommend that you install Samba remotely using the Telnet software (netterm software. Log On with the "zhp" user and switch to the Administrator mode with the su command. Enter the administrator password to gain control of the system. The installation procedure is as follows:

# Cd/home/zhp/* This directory is the directory of the File Uploaded by FTP just now */

# Tar-zxvf samba-2.2.8.tar.gz/* unzip the package to the same directory */

The file name here is very long. You can press the "tab" key after hitting several letters at the beginning of the file name. The system shell will automatically fill in the remaining file names.

# Cd samba-2.2.8/soure/* enter the Samba source code directory */

#./Configure/* configure Samba by default */

#./Make/* compile the connection */

#/Make install/* Copy and install Samba. The default installation directory is/usr/local/samba */

# Ee/etc/services/* use the EE editor to modify the services file */

Add "SWAT 901/tcp" to the file and save the disk and exit. It is used to determine the listening port started by SWAT. The default port is port 901, which can be changed to another value.

# Ee/etc/inetd. conf/* use the EE editor to modify the inetd. conf file */

Add "SWAT stream tcp Nowait root/usr/local/samba/bin/Swat" to the file and save the disk and exit, it automatically loads swat at startup in inetd mode.

# Reboot/* restart the server */

After the server is restarted, the SWAT service has been started. Now you can configure the Samba server with IE of any Windows client that can connect to the server. In the IE Address Bar, enter http: // 202.115.65.225: 901/a login box is displayed. Enter "root" and "Root Password" to go to the 10 page.

Figure 10

In the simplest configuration method, we only need to modify the settings in glogals and shares. We can click glogals to configure relevant parameters, as shown in Figure 11, here, the NetBIOS Name of the server is set to "BSD", the Working Group is "IBD", and the security level is "share ", if the security level is set to "user", you need to enter the account on FreeBSD when accessing the file.

Figure 11

Next, configure the shared directory and run the "mkdir/Public" command to create the "/public/" directory, to direct "public" to the "/Public" directory, you must create a share named "public", as shown in Figure 12.

Figure 12

Click "creat share" to create a public share. Configure the share property as shown in Figure 13. PATH is the path, which is "/public/", and read only is set to "no". This Directory allows file upload, modification, and deletion operations, if you set geuest OK to "yes", the client can access it anonymously. Of course, considering the security factors, this configuration is not scientific, but it is very convenient for home users.

Figure 13

SWAT only visually modifies the samba configuration file "/usr/local/samba/lib/samba. conf ", this file can also be modified manually. For details about how to modify it, refer to the relevant literature. To start samba, follow these steps:

# Cd/usr/local/samba/bin/* enter the samba execution file directory */

#./Smbd-D/* Start smbd in daemon mode. Its function is to use SMB protocol to communicate with the client */

#./Nmbd-D/* Start nmbd in daemon mode, and its function resolves NetBIOS name */

At this time, we can see our files in the network neighbor of the Windows client, as shown in figure 14.

Figure 14

 

Chapter 4: Configure as a Web Server

Currently, the most popular Web server is not apache, but without third-party software, it only supports static Web page display, however, after installing PHP support and MySQL database services, it can run almost all ready-made programs, including excellent forums and message boards. You can even build your own software download site. Of course, it is also interesting to create a personal homepage to show yourself so that all of your friends can gather here.

Let's look at how to implement it. As mentioned above, "sanjianke"-Apache, PHP, and MySQL are the products of three software companies. Each software has many installation parameters, and the specific installation methods are also diverse, I have chosen a simple method to explain it to you.

Step 1: download the software package

The three software are free of charge. You can use the client to download them on their official website. The website is as follows:

Apache http://www..apache.org/

PHP http://www.php.net/

MySQL http://www.mysql.com/

The downloaded package is first compressed into a tarfile and then packaged into a GZ file. tar.gz is the extension, and then all of them are uploaded to the "/home/zhp" directory using FTP. Here "zhp" is the user created earlier. Use telnet to remotely obtain administrator privileges and run the "Tar-zxvf release software package .tar.gz" command to unbind the three packages. In this example, the following three commands are executed.

# Tar-zxvf apache_1.3.24.tar.gz

# Tar-zxvf mysql-max-3.23.49-unknown-freebsdelf4.4-i386.tar.gz

# Tar-zxvf php-4.1.2.tar.gz

After the three software packages are unbundled, three directories are generated, which may vary depending on the software version. In this example:

Apache_1.3.24; mysql-max-3.23.49-unknown-freebsdelf4.4-i386; php-4.1.2

The following operations take these directory names as examples to continue installation and configuration.

# Cd/home/zhp/apache_1.3.24/* go to the Apache installation directory */

#./Configure/* pre-configure Apache */

# CD ../php-4.1.2/* enter the PHP installation directory */

# Mkdir/usr/local/PHP/* Create a PHP installation directory */

#./Configure-Prefix =/usr/local/PHP/-- With-mysql -- With-Apache = ../apache_1.3.24 -- enable-track-vars

/* Generate the configuration file, specify the installation path, and support MySQL to inform Apache of the Installation File Location */

# Make/* compile */

# Make install/* install and copy the file to/usr/local/PHP */

# CD ../apache_1.3.24

# Mkdir/usr/local/www/* Create an Apache installation directory */

#./Configure -- prefix =/usr/local/WWW -- activate-module = src/modules/PhP4/libphp4.a/* libphp4.a does not exist now, and the system will create */

# Make/* compile */

# Make install/* install and copy the file to/usr/local/WWW */

# CD ../php-4.1.2

# Cp PHP. ini-Dist/usr/local/lib/PHP. INI/* copy the PHP configuration file to the system directory */

# Cd/usr/local/www/CONF/* go to the Apache configuration file directory */

# Ee httpd. conf/* modify the configuration file httpd. conf */

Add addtype application/X-httpd-PHP. php to this file and save the disk and exit.

# Cd/home/zhp/mysql-max-3.23.49-unknown-freebsdelf4.4-i386

# Mkdir/usr/local/MySQL/* Create a MySQL installation directory */

#./Configure-Prefix =/usr/local/MySQL/* configure MySQL */

# Make/* If the memory size is small, add the -- with-low-memory parameter */

# Make install/* copy the file to the/usr/local/MySQL directory */

Next, use/STAND/sysinstall to add a MySQL user group and a MySQL user, and then continue to execute the command

# Scripts/mysql_install_db/* create a special database "MySQL", which manages User Permissions */

# Chown-r root/usr/local/MySQL

# Chown-r MySQL/usr/local/MySQL/var/* these three lines change the directory permissions and permissions */

# Chgrp-r MySQL/usr/local/MySQL

#/Usr/local/MySQL/bin/safe_mysqld -- user = MySQL &/* Start the MySQL server */

#/Usr/local/www/bin/apachectl start/* Start the Apache server */

After all the configurations are completed, you can use ftp to upload the HTML/PHP webpage to your "/home/zhp/public_html/" directory, enter the http: // 192.168.0.1/zhp/$ webpage file in the IE Address Bar. PHP can check the effect. If you think MySQL database management is inconvenient, you can also download a software named "phpMyAdmin" for online management, you only need to extract the software and upload it to the Web server, and then modify "config. inc. the parameter "$ cfgpmaabsoluteuri" in the PHP file is the URL address of the phpMyAdmin upload directory. The execution file is "index. PHP ".

After the configuration is successful, the page shown in Figure 15 is displayed. This example is set to "$ cfgpmaabsoluteuri = 'HTTP: // 202.115.65.225 /~ ".

Chapter 5 configure as a proxy server

CERNET users often encounter a situation where they cannot directly access websites outside China. Many people know that they can access websites outside China as long as they can find an overseas proxy server; in other cases, the opposite is true. For example, important servers in some enterprises and schools can only be accessed through internal IP addresses, and all external IP addresses are rejected, if the company staff urgently need documents within the company or the students in the school urgently need to query the bibliography lending situations in their library, but they are not in the company or within the school, how can they use the networks around them to obtain the information they want? In this case, you still have to turn to the proxy server. Squid is an excellent agent server software running on Linux and UNIX platforms. For example, if an external network accesses an internal network through a proxy server, the proxy server must have an internal IP address of an enterprise or school. After the squid is successfully installed and configured, for a computer with an external IP address, you only need to set the HTTP Proxy Server of Internet Explorer to the IP address of the server and the specified port, and then you can use the IP address of the proxy server to freely access the internal web server. Install and configure the squid server as follows:

First to begin.

# Tar-zxvf squid-2.4.STABLE7-src.tar.gz/* extract package */

# Cd squid-2.4.STABLE7-src/* enter the extract directory */

#./Configure -- prefix =/usr/local/squid/* configure the installation directory */

# Make/* compile the connection */

# Make install/* install and copy */

# Ee/usr/local/squid/etc/squid. CONF/* Modify/usr/local/squid/etc/squid. conf file */

Use the SEARCH Command Ctrl + Y in the EE editor to search for "http_port 3128" and find the "# http_port 3128" string, remove the "#" in the preceding comment and change "3128" to the proxy server port. If it is 8080, change it to "http_port 8080 "; search for "ACL all SRC" and find the string "ACL all SRC 0.0.0.0/0.0.0.0". Change it to "ACL all SRC 0.0.0.0-255.255.255.255.255/255.255.255.255 ", the purpose of modification is to make the source host address unlimited; finally, find "http_access deny all ", after you change the string to "http_access allow all", you can use the proxy server from any address. This step ends even if you save the disk and exit.

Create a user to run squid, because squid does not allow the root user to run for security reasons. Assume that the user name is "squid ".

# Adduser squid/* Add User "squid "*/

# Cd/usr/local/squid/* enter the installation directory */

# Chown squid */* set the ownership of all files in this directory to user squid */

# Exit/* log out of the root administrator */

After you log on with squid, the "$" prompt appears.

$/Usr/local/squid/bin/squid-z/* Create cache directory */

$/Usr/local/squid/bin/squid/* Start the squid server */

Next, you can set the HTTP Proxy Server IP address to the IP address of this server in the client's IE browser, as shown in the preceding 80, 16 port. After confirming, enter a website you cannot enter to see if it has changed.

Chapter 6 receiving

Now we have successfully configured our old machine with powerful gateway servers, FTP servers, file servers, Apache + PHP + MySQL servers, and proxy servers, however, once we restart the computer, some services cannot be started automatically, so we must also make a function similar to autoexec in DOS. files are automatically batch processed in the same way as BAT. This file is not stored in the root directory like DOS and the system specifies a special directory-"/usr/local/etc/rc. d ". If you cannot find this directory, you can create it by yourself. Now we create a text file start under this directory. sh, the file name can be any.

Write the following content

/Usr/local/Apache/bin/apachectl start

# Start the Apache server

/Usr/local/MySQL/bin/safemysqld &

# Start the MySQL server

/Usr/local/samba/smbd-d

/Usr/local/samba/nmbd-d

# Start the Samba server

/Usr/local/squid/bin/squid

# Start the squid Server

Then we must make the file executable:

# Chmod + x/usr/local/etc/rc. d/start. sh/* grant start. Sh execution permission */

After such sorting, it may have been a long time for you to see that the computer you have already eliminated has become a server with multiple roles. In fact, FreeBSD can provide more services than above. As a network operating system, FreeBSD can play a key role in an environment ranging from a LAN to the Internet, however, the mail service, News Service, DNS service, DHCP and other functions are not very useful for LAN users, so we will not introduce them. If you are interested, you can refer to the Help file provided by FreeBSD to install the CD.

Some problems may inevitably occur during the configuration process. As long as you think carefully about the causes of these obstacles, it is not difficult to solve them. For example, after I unplug the optical drive, FreeBSD often pauses for several minutes at the startup of an ATA device before starting it, it may be because FreeBSD is looking for this non-existing ide device, then, in the bios, change the value of "onboard PCI" from the default "both" to "primary" in "chipset feature setup" and cancel the second ide interface, the results immediately solved this problem and hoped that everyone could use their own wisdom to solve some configuration problems.

Bibliography

Qi information, 2000.9, FreeBSD & windows integrated networking practices, China Railway Publishing House

E benm.; urbanmichael, Tai manb.; tiemannbrian, 2002, FreeBSD technology insider, Mechanical Industry Press

Zhong Jinping, shoujiayan, 2001, PHP + MySQL network development technology, people's post and telecommunications Publishing House

BEI Si; bainesdominic, 2000.10, Samba technology insider, Mechanical Industry Press

Cutting ldmark; almeidajeff, 2001, Apache system management guide, Tsinghua University Press
Questions will answer your questions about FreeBSD.

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.