Install DHCP, pppoe, PPTP, L2TP, and DNS server in ubutu

Source: Internet
Author: User

1. Install DHCP server

Build a udhcpd server in Ubuntu 1. Check whether the udhcpd server is installed: dpkg-L | grep udhcpd
If the udhcpd server is not installed, we can use apt-Get install udhcpd to install the udhcpd server. 2. edit/etc/default/udhcpd enable udhcp.
3. Edit the/etc/udhcpd. conf file: Vim/etc/udhcpd. conf.
Start 192.168.43.30 # define the start address of the address pool
End 192.168.43.100 # define the end address of the address pool
Interface eth0 # DHCP server interface responding to the DHCP protocol
Opt DNS 8.8.8.8 219.239.26.42 # define the DNS server address
Option subnet limit 255.0
Opt router 192.168.43.1 # This address is the IP address of the DHCP server responding to the DHCP protocol interface
Option DNS 124.207.160.106 # Up to three DNS servers can be set
Option Domain Local
Option lease 86400 # lease time, in seconds
Static_lease 00: 60: 08: 11: Ce: 4E 192.168.43.100 # statically bound Mac and IP addresses
Static_lease 00: 60: 08: 11: Ce: 38 192.168.43.110
Generally, after the udhcpd server is installed, the main configuration file is generated under/etc. If not, you can create a file named udhcpd. conf under/etc.
4. Set the IP address of eth0: ifconfig eth2 192.168.43.1 netmask 255.255.255.0 up
5. Enable the udhcpd Server:
Service udhcpd stop
Service udhcpd start
If the system does not support service, use LS-A in the/etc/init. d path to check whether the udhcpd keyword exists.
6. Check whether the udhcpd service is started properly: PS aux | grep udhcpd Note:During installation, I found that service udhcpd start is OK, but I never found that udhcpd is in the process. Finally, whereis udhcpd: I found that udhcpd runs directly under/Urs/sbin/udhcpd: udhcpd can work normally if it finds the DHCP server.
7. test whether the udhcpd service function is normal:
WINXP client: ipconfig/release
Ipconfig/Renew
Linux client: dhclient eth0
Assume that the eth0 port of the Linux client is connected to the eth0 port of the udhcpd server. 2. Install pppoe server.

This article introducesUbuntuBuild on SystemPppoe ServerThis section only describes the basic installation and settings. For more information, see relevant information.

#####
Environment:
System: Ubuntu 10.04 Desktop
Package: pppoe

#####
1. Install the required software package.

You can install pppoe in Ubuntu Software Center, and use the command apt-Get install pppoe in Shell (the source code of this package isRP-pppoeIt was originally a pppoe dial-up client under linxu, but it also contains the pppoe server function. Other software packages (such as lib6c and PPP) may be installed based on dependencies ).

2. Configure the pppoe server.

1) Create the pppoe server configuration file/etc/PPP/pppoe-server-Options
Several common parameters in this file are described as follows. Because I have never used other parameters or even do not know whether there are other parameters that can be configured, please search for other information for more parameters.
In fact, the content of this configuration file is required by PPP when pppoe server is started. The content of this file is automatically passed to the pppd process through the Pty parameter when pppoe server is started.
Require-Pap, set the pppoe server to accept the PAP authentication method
Require-chap: sets the pppoe server to accept CHAP authentication.
LoginIf this parameter is set, the account and password used for authentication must exist in the Ubuntu system, in other words, the same user information must be added to the system and/etc/PPP/chap-secrets or/etc/PPP/PAP-secrets. Comment out this parameter in my own server.
LCP-Echo-interval, set the LCP echo interval (seconds ).
LCP-Echo-failure: How long (in seconds) the LCP echo request and LCP echo reply will be disconnected (I have not tested this parameter ).
MS-DNS: Specifies the DNS allocated by the pppoe server to the client.
For example:
Require-Chap
# Login
LCP-Echo-interval 10
LCP-Echo-failure 20
MS-DNS 10.0.0.138

MS-DNS 8.8.8.8
2) Add pppoe connection account information
Open the/etc/PPP/chap-secrets file and add a user according to the description file. It is best to set the second field to *. Otherwise, you must enter the correct server name when connecting to pppoe (the default value is the host name, or you can use the-C parameter when running pppoe-server ). The first field is the user name, the third field is the password, and the last field specifies the allowed IP address range (directly set ).
For Pap authentication, add user information to/etc/PPP/PAP-secrets.
3) Start pppoe Server
After pppoe server is installed and configured, it will not automatically go to/etc/init. d/directory to generate the corresponding management script, which needs to be manually started from shell. For related usage, see the pppoe-server help document (man pppoe-server). The main parameters are as follows:
-I: Specifies the interface for pppoe server.
-L: Specifies the IP address of the server in the PPP connection.
-R: Specifies the start value of the IP address allocated to the client in the PPP connection.
-N: specifies the maximum number of IP addresses that can be allocated to the client in a PPP connection. The starting value is specified by-R.
-O: Specifies the location of the pppoe-server configuration file. The default value is/etc/PPP/pppoe-server-Options. If other files are configured, you can use this parameter to specify the location, you do not need to add this parameter.

#####
Run:
Start:Pppoe-server-I eth0-l 100.0.0.1-r 100.0.0.100-N 20
Stop:Killall pppoe-Server
Restart:Refer to stop and start

 

3. Install PPTP Server

1. It is very convenient to install pptpd using apt in Ubuntu. It is automatically started after installation;
$ Sudo apt-Get install pptpd

2. Modify/etc/pptpd. conf and assign an internal IP address;
Localip 192.168.0.1
Remoteip 192.168.0.234-238,192.168 .0.245

3. Modify/etc/PPP/chap-secrets and create a VPN user and password;
Username pptpd password *
NOTE: If * is changed to a fixed internal IP address, the user will be assigned to the fixed address to ensure that the user can create only one VPN connection.

4. Modify/etc/PPP/pptpd-options and support automatic DNS allocation to prevent DNS hijacking;
MS-DNS 8.8.8.8
MS-DNS 8.8.4.4
Note: Google open DNS is used above, and other services can be used.

 

5. Modify the/etc/PPP/pptpd-options authentication method. Note that it is generally required to use require chap.

5. Modify/etc/sysctl. conf and support IP forwarding;
Net. ipv4.ip _ forward = 1
Note: Use the following command to take effect:
$ Sudo sysctl-P

6. Modify iptables to support forwarding;
$ Sudo/sbin/iptables-T Nat-A postrouting-s 192.168.0.0/24-O eth0-J Masquerade
Note: No VPs, not tested.

7. Restart the VPN service;
$ Sudo/etc/init. d/pptpd restart

 

4. Install L2TP Server

 

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.