linux下PPPOE拨号共享上网
来源:互联网 发布:大数据研究方法有哪些 编辑:程序博客网 时间:2024/06/10 14:05
1、 网卡配置。
两块网卡,eth0为拨号网卡,IP:192.168.1.1(其他的地址也可);eth1为内网网卡,IP:192.168.0.1。掩码均为255.255.255.0。 局域网网段为192.168.0.0。
注意:此处两块网卡均不能设网关。
2、 PPPoE软件的升级与安装
1) 在 http://www.roaringpenguin.com/pppoe/#download 下载
2) 安装rp-pppoe。以root身份执行
rpm –Uvh rp-pppoe-3.5-1.i386.rpm
3、 修改/etc/ sysctl.conf
将其中的
net.ipv4.ip_forward = 0
改为
net.ipv4.ip_forward = 1
4、 去除ipchains模块,只选择iptables方法如下:
1)setup
2)选择system service
3)去除ipchains
4)选中iptables
5)重启机器
5、 PPPoE客户端配置
在rp-pppoe-3.5-1.i386.rpm安装完毕后,接下来就可进行PPPoE客户端配置了。过程如下。
#/usr/sbin/adsl-setup
>>> Enter your PPPoE user name: ——此处输入拨号帐号的用户名
>>>Enter the Ethernet interface connected to the ADSL modem For Solaris,this is likely to be something like /dev/hme0. For Linux, it will beethn, where n is a number. (default eth0): ——输eth0
>>> Enter the demand value (default no): ——输no
>>> Enter the DNS information here: ——输210.52.149.2(视当地运营商的DNS服务器IP而定)
>>> Please enter your PPPoE password: ——输网通用户口令
>>> Choose a type of firewall (0-2): ——输0
>>> Accept these settings and adjust configuration files (y/n)? ——输y
6、 启动拨号连接
/usr/sbin/adsl-start
成功连接后,屏幕显示Connected。
此时这台linux已可以上网浏览了。
7、 IP伪装
为了使局域网中的其他机器能通过Linux服务器共享上网,至少须执行下面的命令:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
完成后,在192.168.0.0网段(网关为192.168.0.1)的PC机就可透过Linux上网了!
8、 开机自启动
为了使Linux服务器能够自动拨号,执行下面步骤。
1)chkconfig --add adsl
2)setup
3)选择system services
4)选中ADSL
5)OK退出
6)打开/etc/rc.d/rc.local,在该文件的末尾添上下面语句
echo "[OK]"
echo "Drop ICMP form anywhere"
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
echo "[OK]"
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
说明:前面四句用于关闭ICMP,防止别人Ping。
9、 至此,一切OK,一个简单的拨号建成了。重启机器后,发现linux的internet共享连接已经一切就绪了,好妙!!!
两块网卡,eth0为拨号网卡,IP:192.168.1.1(其他的地址也可);eth1为内网网卡,IP:192.168.0.1。掩码均为255.255.255.0。 局域网网段为192.168.0.0。
注意:此处两块网卡均不能设网关。
2、 PPPoE软件的升级与安装
1) 在 http://www.roaringpenguin.com/pppoe/#download 下载
2) 安装rp-pppoe。以root身份执行
rpm –Uvh rp-pppoe-3.5-1.i386.rpm
3、 修改/etc/ sysctl.conf
将其中的
net.ipv4.ip_forward = 0
改为
net.ipv4.ip_forward = 1
4、 去除ipchains模块,只选择iptables方法如下:
1)setup
2)选择system service
3)去除ipchains
4)选中iptables
5)重启机器
5、 PPPoE客户端配置
在rp-pppoe-3.5-1.i386.rpm安装完毕后,接下来就可进行PPPoE客户端配置了。过程如下。
#/usr/sbin/adsl-setup
>>> Enter your PPPoE user name: ——此处输入拨号帐号的用户名
>>>Enter the Ethernet interface connected to the ADSL modem For Solaris,this is likely to be something like /dev/hme0. For Linux, it will beethn, where n is a number. (default eth0): ——输eth0
>>> Enter the demand value (default no): ——输no
>>> Enter the DNS information here: ——输210.52.149.2(视当地运营商的DNS服务器IP而定)
>>> Please enter your PPPoE password: ——输网通用户口令
>>> Choose a type of firewall (0-2): ——输0
>>> Accept these settings and adjust configuration files (y/n)? ——输y
6、 启动拨号连接
/usr/sbin/adsl-start
成功连接后,屏幕显示Connected。
此时这台linux已可以上网浏览了。
7、 IP伪装
为了使局域网中的其他机器能通过Linux服务器共享上网,至少须执行下面的命令:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
完成后,在192.168.0.0网段(网关为192.168.0.1)的PC机就可透过Linux上网了!
8、 开机自启动
为了使Linux服务器能够自动拨号,执行下面步骤。
1)chkconfig --add adsl
2)setup
3)选择system services
4)选中ADSL
5)OK退出
6)打开/etc/rc.d/rc.local,在该文件的末尾添上下面语句
echo "[OK]"
echo "Drop ICMP form anywhere"
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
echo "[OK]"
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
说明:前面四句用于关闭ICMP,防止别人Ping。
9、 至此,一切OK,一个简单的拨号建成了。重启机器后,发现linux的internet共享连接已经一切就绪了,好妙!!!
为了建立更安全的拨号连接,请再设置各种安全机制,具体可参看本站iptables实战记录及NAT HowTo 简体中文版。
作者Blog:http://blog.csdn.net/lidaibin/
- linux下PPPOE拨号共享上网
- linux下PPPOE拨号共享上网
- Linux系统下PPPOE拨号共享上网方法
- LINUX下的PPPOE拨号
- Linux下实现双网卡共享上网 ADSL拨号程序
- 在linux下安装pppoe拨号软件并通过ADSL上网.
- PPPoE下的路由共享上网
- ubantu pppoe 拨号 宽带上网
- uclinux 下PPPoE 拨号
- ubuntu下pppoe拨号
- linux 学习:ubuntu下PPPoE上网
- Linux下用Qt做的Pppoe拨号软件
- linux下 pppoe通过直接设置配置文件方式进行拨号
- Debian 下 PPPOE拨号设置
- PPPOE拨号下MTU设置
- 主机PPPOE拨号VMWARE虚拟机在三种模式下上网
- 主机PPPOE拨号VMWARE虚拟机在三种模式下上网
- Linux pppoe拨号 路由配置
- Windows CE 内存管理
- 关闭linux的防火墙
- 增加反向链接的8个最实用技巧
- 云计算--IT新战场
- makelist for MMS on ubuntu
- linux下PPPOE拨号共享上网
- 世界级安全技术专家力作——《Linux防火墙》
- 如何升级Carbide C++的GCCE Tool Chain
- GridView 用CSS隐藏列
- 日常小知识
- 能不能反复问五个“为什么” 摘自TPS
- VB 延时
- psad, fwknop, 和fwsnort等著名开源安全软件的开发者谈Linux防火墙
- 简化工作的利器