PPTPD搭建

1、检查服务器是否支持PPTP服务
[root@centos1 ~]# modprobe ppp-compress-18 && echo ok
ok
以上命令执行出来显示是“OK”的话,继续往下进行!
[root@centos1 ~]# cat /dev/net/tun
cat: /dev/net/tun: 文件描述符处于错误状态
以上命令执行出来显示报错的话,继续往下进行!

以上两条命令执行都通过,才能安装PPTP。

2、安装PPTP
[root@centos1 ~]# yum install ppp \输出的内容太多,我就不复制出来了
[root@centos1 ~]# rpm -i http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm
[root@centos1 ~]# yum -y install pptpd
3、更改配置文件
找到“locapip”和“remoteip”这两个配置项,更改为你期望的IP段值。localip表示服务器的IP,remoteip表示分配给客户端的IP地址,可以设置为区间。这里我们使用pptp默认的配置:
localip 192.168.1.106
remoteip 192.168.1.20-200
编辑/etc/ppp/options.pptpd文件,添加DNS,一般只需要更改ms-dns就可以
ms-dns 8.8.8.8
ms-dns 8.8.4.4
二、PPTP的账号、密码配置
1、添加账号
需要编辑/etc/ppp/chap-secrets文件
[root@centos1 ~]# vim /etc/ppp/chap-secrets

Secrets for authentication using CHAP

clientserversecretIP addresses

machenximachenxi

client //用户账号,需要用双引号包含
server //代表自动识别当前服务器主机名,也可以手动配置
secret //用户密码,需要用双引号包含
IP address //代表自动分配可用的IP地址,可根据需要指定IP地址

除了上面编辑文件,还可以用命令来创建用
[root@centos1 ~]# vpnuser add jackware jackware
[root@centos1 ~]# cat /etc/ppp/chap-secrets \多了一个jackware的账号

Secrets for authentication using CHAP

clientserversecretIP addresses

machenximachenxi
jackwarejackware
[root@centos1 ~]# vpnuser del jackware
[root@centos1 ~]# cat /etc/ppp/chap-secrets \jackware的账号删除掉了

Secrets for authentication using CHAP

clientserversecretIP addresses

machenximachenxi

PPTPD配置ok,重启服务
[root@centos1 ~]# service pptpd restart
Shutting down pptpd: [确定]
Starting pptpd: [确定]
Warning: a pptpd restart does not terminate existing
connections, so new connections may be assigned the same IP
address and cause unexpected results. Use restart-kill to
destroy existing connections during a restart.
接下来到Windows机器上面做下验证吧。

这个时候ifconfig看一看网卡信息,是不是多出了一个ppp0的接口
[root@centos1 ppp]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:B5:3C:1C
inet addr:192.168.1.106 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:feb5:3c1c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8242 errors:0 dropped:0 overruns:0 frame:0
TX packets:5920 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8299985 (7.9 MiB) TX bytes:650125 (634.8 KiB)

eth1 Link encap:Ethernet HWaddr 00:0C:29:B5:3C:26
inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::20c:29ff:feb5:3c26/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:28 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6832 (6.6 KiB) TX bytes:3198 (3.1 KiB)

ppp0 Link encap:Point-to-Point Protocol
inet addr:192.168.1.106 P-t-P:192.168.1.20 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1396 Metric:1
RX packets:81 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:7108 (6.9 KiB) TX bytes:4874 (4.7 KiB)

简单配置DHCP
1、安装DHCPD服务
yum -y install dhcp
2、配置/etc/dhcp.conf
#

DHCP Server Configuration file.

see /usr/share/doc/dhcp*/dhcpd.conf.sample

see ‘man 5 dhcpd.conf’

#
ddns-update-style interim;
ignore client-updates;

subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.10 10.0.0.244;
option domain-name-servers ns.example.org;
option domain-name “machenxi.com”;
option routers 10.0.0.1;
option subnet-mask 255.255.255.0;
default-lease-time 600;
max-lease-time 7200;
host myhost {
}
}
3、编辑/etc/init.d/dhcpd将用户、用户组更改为root
user=root
group=root
4、重启dhcp
service dhcpd restart

原创文章,作者:machenxi,如若转载,请注明出处:http://www.178linux.com/77803

(7)
machenximachenxi
上一篇 2017-06-09
下一篇 2017-06-09

相关推荐

  • Linux计划任务和进程

    一、进程管理 1.进程简介 一个程序对应多个进程;一个进程对应一个程序。 2.进程状态的查看与控制 查看进程状态 w 查看个别用户的进程 eg: w userName list-info JCPU: PCPU: WAHT: from: IDLE: 用户空闲时间 load average: ps -aux -a: 显示所有用户的进程 -u:显示用户名和启动时间…

    2017-09-09
  • KVM部署及简单使用

    KVM特点 KVM必须在具备Intel VT或AMD-V功能的x86平台上运行。KVM包含一个为处理器提供底层虚拟化,可加载的核心模块kvm.ko(kvm-intel.ko或kvm-AMD.ko)。使用一个经过修改的QEMU(qemu-kvm),作为虚拟机上层控制和界面。 由于KVM仅是一个简单的虚拟化模块,所以它的内存管理没有自我实现,需借助于Linux内…

    Linux干货 2016-02-14
  • xen虚拟机实时迁移

    前言:  xen虚拟机提供了一种类似于heartbeat高可用方案,在保证也不中断的业务情况下实现虚拟机迁移技术。在保证虚拟机上的服务正常的情况下将运行中的Domain迁移到其他机器上,实现xen虚拟机的高可用。 一、实验准备:  (1)各个测试机之间时间要同步  (2)node3提供iscsi网络共享存储  (4)n…

    Linux干货 2015-08-27
  • 马哥网络班21期,第三周作业

    1、列出当前系统上所有已经登录的用户的用户名,注意:同一个用户登录多次,则只显示一次即可。     who | cut -d " " -f1 | sort -u     who:查看当前系统所有用户的会话     cut:剪切命令       cut…

    Linux干货 2016-07-26
  • Linux下inode理解及软、硬链接初探

    1、Inode是什么? 要理解inode,要从文件储存说起。 文件由元数据和数据构成。 文件储存在硬盘上,最小的存储单位叫做“扇区(Sector)”。每个扇区存储512字节。操作系统读取硬盘时,不会一个扇区一个扇区地读取,这样非常低效;而是一次性连续读取多个扇区,即一次性读取一个“块(block)”。“块”由多个扇区组成,常见的大小有1K、2K、4K等,其中…

    Linux干货 2016-07-29
  • 马哥Linux第二周学习笔记

    文件管理,用户管理,权限管理

    Linux干货 2017-12-23