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.www58058.com/77803

(7)
machenximachenxi
上一篇 2017-06-09 21:15
下一篇 2017-06-09 23:52

相關推薦

  • 基礎指令的使用篇3 Linux版

    / /boot /bin /sbin /lib.modules /lib64 /etc/redhat-release /etc/centos-release /home/zczx /mnt /media /misc /proc/meminfo /proc/cpuinfo /proc/partition /sya /opt /tmp /usr/local/ /…

    Linux干貨 2016-08-04
  • Linux腳本基礎練習

    馬哥教育網絡班+ 第7周課堂練習 Linux腳本基礎練習 練習: 1、創建一個10G分區,并格式為ext4文件系統; (1)要求其block大小為2048,預留空間百分比為2,卷標為MYDATA,默認掛載屬性包含acl (2)掛載至/data/mydata目錄 要求掛載時禁止程序自動運行,且不更新文件的訪問時間戳 第一步,在虛擬機中掛載一塊20G的新硬盤 &…

    Linux干貨 2016-11-09
  • 馬哥教育網絡班20期+第6周練習博客

    請詳細總結vim編輯器的使用并完成以下練習題 1、復制/etc/rc.d/rc.sysinit文件至/tmp目錄,將/tmp/rc.sysinit文件中的以至少一個空白字符開頭的行的行首加#; [root@bogon ~]# cp /etc/rc.d/rc.sysinit  /tmp/rc.sysinit […

    Linux干貨 2016-07-22
  • 深入了解磁盤結構

    一、     linux中常見的磁盤:   無論什么操作系統,歸根還是要落實與磁盤上的,對于磁盤的管理也是linux管理必備的一項技能。在linux中“一切皆文件”的思想貫徹整個linux的學習中,包括像是磁盤等的硬件也是在linux的/dev/目錄下類似于文件形式的存放,常見的SATA口USB優盤或是SCS…

    Linux干貨 2016-08-29
  • iptables初探

    iptables 簡述 基礎知識 命令使用 簡述 iptables是什么?netfilter又是什么? iptables是位于用戶控件的一個防火墻規則控制管理工具。netfilter是位于內核中的真正的防火墻,由五個鉤子函數(hooks)而組成。 iptables的作用是什么? 用來添加,刪除,管理netfilter規則。 netfilter的作用是什么? …

    2016-05-31
  • 關于大型網站技術演進的思考(一):存儲的瓶頸(1)

    原文出處: 夏天的森林  前不久公司請來了位互聯網界的技術大牛跟我們做了一次大型網站架構的培訓,兩天12個小時信息量非常大,知識的廣度和難度也非常大,培訓完后我很難完整理出全部聽到的知識,今天我換了個思路是回味這次培訓,這個思路就是通過本人目前的經驗和技術水平來思考下大型網站技術演進的過程。 首先我們要思考一個問題,什么樣的網站才是大型網…

    Linux干貨 2015-02-26
欧美性久久久久