前言
由于去了新地方,公司管住.我的nuc服务器寸步不离我工作的地方,但是没想到要拨号上网…本文借鉴了
CentOS 7 离线拨号(PPPOE)
一.准备安装包拷贝到u盘
链接:https://pan.baidu.com/s/1uR4hln3dzzPYYn8ZxzrVuA
提取码:axp6
二.挂载u盘
# 加载usb模块
modprobe usb-storage
# 查看u盘所有分区
fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
/dev/sdb4 2048 14039 2015920 8e FAT32
// 这里假设U盘是sdb4
# 建立挂载目录
mkdir -p /mnt/usbdisk
# 将u盘目标分区挂载
mount /dev/sdb4 /mnt/usbdisk
# 进入挂载目录将内容拷贝到本地
cp -r /mnt/usbdisk /home/yuanjie
# 卸载u盘
umount /mnt/usbdisk
# 安装拨号工具及其依赖
cd /home/yuanjie
# 安装 --replacepkgs 覆盖安装 有的系统自带打不开命令,因此我们直接全部替换覆盖安装
rpm -ivh --replacepkgs libpcap-1.5.3-9.el7.x86_64.rpm ppp-2.4.5-33.el7.x86_64.rpm net-tools-2.0-0.22.20131004git.el7.x86_64.rpm rp-pppoe-3.11-7.el7.x86_64.rpm
三. 配置拨号工具
// 查看当前以太网卡代号
ip address
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 20:1b:06:3d:22:05 txqueuelen 1000 (Ethernet)
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
// 那么我这的以太网卡代号就是 enp1s0 (等下要用到)
// 开始设置
pppoe-setup
// 输入ISP提供的账户(拨号账号)
Enter your Login Name (default root):sz20012231@163.gd
// 输入以太网卡代号,根据刚刚查到的(enp1s0)
(default eth0):enp1s0
// 配置:若长时间连线,连线会被自动中断(否 no)
Enter the demand value (default no): no
// 配置主DNS服务器(8.8.8.8)
Enter the DNS information here:8.8.8.8
// 配置次DNS服务器(8.8.4.4)
Enter the secondary DNS server address here:8.8.4.4
// 两次输入账户密码以确认(拨号密码)
Please enter your Password:
Please re-enter your Password:
// 配置普通账户是否有网络连接权限(允许 yes)
normal user to start or stop DSL connection (default yes):yes
// 配置防火墙(无限制 0)
Choose a type of firewall (0-2): 0
// 配置是否开机自动拨号连接(开启 yes)
Please enter no or yes (default no):yes
// 确认刚填写的配置信息(确认 y)
Accept these settings and adjust configuration files (y/n)? y
// 开启拨号网络
ifup ppp0
四.自动拨号
上述连接给出了自动拨号脚本 ppp_auto.sh
在脚本目录下执行:./ppp_auto.sh 182910 123456 enp1s0
即可自动配置
第一个参数是账号,第二个是密码,第三个是以太网卡代号