linux自动拨号脚本 linux adsl 拨号自动配置脚本的方法
KBdancer 人气:0想了解linux adsl 拨号自动配置脚本的方法的相关内容吗,KBdancer在本文为您仔细讲解linux自动拨号脚本的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:linux自动拨号脚本,linux,adsl拨号,下面大家一起来学习吧。
在使用动态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
加载全部内容