linux adsl 拨号自动配置脚本的方法
程序员文章站
2022-06-20 19:33:59
在使用动态vps服务器的时候发现一枚已经写好的自动配置拨号的shell脚本,分享一下,免去手动配置的烦恼,代码如下
#! /bin/sh
path=/usr/l...
在使用动态vps服务器的时候发现一枚已经写好的自动配置拨号的shell脚本,分享一下,免去手动配置的烦恼,代码如下
#! /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
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。