孟德何故爱人妻 發表於 2023-9-29 00:00:00

Ubuntu Server下建立虚拟服务器的方法

<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        我们知道,有很多种,比如Windows Server系列自己就带了服务器,安装配置都非常简单,而今天我要在日志中介绍部署的,是Linux下的Server,基于PPTP协议。Ubuntu系统是基于Debian构造的一版发行版,交流社区非常活跃,而且因为基于Debian,他自己带的包管理器能很好的处理依赖关系,方便我们安装软件。 <br><br>
        其实在Ubuntu下安装Server是非常非常Easy的,一句话就能搞定: <br>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        <p>
                代码如下:</p>
</div>
<div class="msgborder" id="phpcode7" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        sudo apt-get install pptpd </div>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'> </span></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu Server下建立虚拟服务器的方法" alt="Ubuntu Server下建立虚拟服务器的方法" class="alignnone size-full wp-image-1618" src="https://zhuji.jb51.net/uploads/img/202305/af651159d94499ed88ce813c0a9eb006.jpg"><br>
        嘿嘿 这样就搞定了,接下来的是一些配置,我们需要改三个文件,分别为: <br><br>
        /etc/pptpd.conf <br>
        /etc/ppp/pptpd-options <br>
        /etc/ppp/chap-secrets <br><br>
        首先我们使用vi命令对第一个文件进行修改,主要是设置本地ip与拨入用户的ip地址 <br>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        <p>
                代码如下:</p>
</div>
<div class="msgborder" id="phpcode8" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        sudo vi /etc/pptpd.conf </div>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'> </span></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu Server下建立虚拟服务器的方法" alt="Ubuntu Server下建立虚拟服务器的方法" class="alignnone size-full wp-image-1619" src="https://zhuji.jb51.net/uploads/img/202305/3aaf88926637ee599a818b3bb23edfd0.jpg"><br>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        如图,localip是linux主机的ip地址,remoteip是地址池,也就是远程拨进来的计算机所分配到的ip地址。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        之后我们要修改/etc/ppp/pptpd-options,主要是增加dns配置的说明。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu Server下建立虚拟服务器的方法" alt="Ubuntu Server下建立虚拟服务器的方法" class="alignnone size-full wp-image-1620" src="https://zhuji.jb51.net/uploads/img/202305/5ed8e752d96a092b08e7ccbaf0f603e0.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        如图,我们增加了两行(ms-dns开头)</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        最后,我们修改/etc/ppp/chap-secrets,主要是对用户进行配置。</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu Server下建立虚拟服务器的方法" alt="Ubuntu Server下建立虚拟服务器的方法" class="alignnone size-full wp-image-1621" src="https://zhuji.jb51.net/uploads/img/202305/1c616a6f23860662176181502ac8961c.jpg"></p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        按照,用户名(tab)主机名(tab)密码(tab)分配到的ip地址 这样的格式来填写,其中主机名可以用“*”代替,如果不强制指定该用户分配到哪一个ip地址,可以将最后一项也改为“*”</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        最后,我们重启pptpd服务,执行<br>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        <p>
                代码如下:</p>
</div>
<div class="msgborder" id="phpcode9" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        sudo /etc/init.d/pptpd restart </div>
<p>
        <br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>稍等片刻,嘿嘿,从远程建立一个连接,试试看吧。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>PS: </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>如果发现这样无法访问外网了,可以开启ipv4 forward。修改/etc/sysctl.conf,去掉“net.ipv4.ip_forward=1”前的注释号,之后“sudo sysctl -p”应用配置,Ok Enjoy it!</span></p>
頁: [1]
查看完整版本: Ubuntu Server下建立虚拟服务器的方法