在使用动态vps服务器的时候发现一枚已经写好的自动配置拨号的shell脚本,分享一下,免去手动配置的烦恼,代码如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#! /bin/sh PATH= /usr/lib64/qt-3 .3 /bin : /usr/local/sbin : /usr/local/bin : /sbin : /bin : /usr/sbin : /usr/bin : /root/bin Log= /var/log/pppoe .log sed -i '/^GATEWAY/d' /etc/sysconfig/network-scripts/ifcfg-eth0 sed -i '/^DNS1/d' /etc/sysconfig/network-scripts/ifcfg-eth0 sed -i '/^DNS2/d' /etc/sysconfig/network-scripts/ifcfg-eth0 echo "del ifcfg-eth0 Gateway ...... Success" > $Log echo "del ifcfg-eth0 DNS1 ...... Success" >> $Log echo "del ifcfg-eth0 DNS2 ...... Success" >> $Log read -p "请输入ADSL帐号:" id read -p "请输入ADSL密码:" ps sed -i 's/root/' $ id '/g' /etc/ppp/chap-secrets sed -i 's/12345/' $ ps '/g' /etc/ppp/chap-secrets echo "MOdify chap-secrets ...... Success" >>$Log sed -i 's/root/' $ id '/g' /etc/ppp/pap-secrets sed -i 's/12345/' $ ps '/g' /etc/ppp/pap-secrets echo "Modify pap-secrets ......Success" >>$Log sed -i 's/root/' $ id '/g' /etc/sysconfig/network-scripts/ifcfg-ppp0 echo "Modify ifcfg-ppp0 ......Success" >>$Log echo nameserver 114.114.114.114 >> /etc/resolv .conf echo nameserver 8.8.8.8 >> /etc/resolv .conf systemctl restart network.service cat $Log exit |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:https://www.92ez.com/?action=show&id=23449