服务器 频道

Linux下配置ADSL拨号及简单网关服务

  【IT168 服务器学院】系统:网关(redhat AS3.0 u2),客户机(win2000)
  环境:两台机器,一台机器做网关,有两块网卡,另一台机器做客户机,一块网卡,ADSL拨号设备一套
  
  设置客户机的IP为192.168.0.2,网关设置为做拨号服务的那台192.168.0.1,掩码:255.255.255.0,DNS服务器地址为202.106.0.20 202.106.46.151,这是北京网通对外的DNS地址,自己可以查一下
  
  设置拨号网关机器的第一块网卡eth0
  IP:192.168.0.1
  掩码:255.255.255.0
  DNS:202.106.0.20
  GETWAY不用设置了
  第二块网卡eth1不用设置
  
  下面在系统上安装好rp-pppoe-3.5-4拨号软件
  
  安装完软件包后,必须配置pppoe的配置文件/etc/ppp/pppoe.conf,从而让ADSL拨号时
  
  使用配置文件中的用户名、密码等参数。我们不必手工改动这个文件,可以使用
  adsl-setup这个工具进行配置:
  
  #/usr/sbin/adsl-setup
  
  当出现
  >>> Enter your PPPoE user name :
  输入ADSL帐号的用户名
  
  当出现
  >>> Enter the Ethernet interface connected to the ADSL modem
  For Solaris, this is likely to be something like /dev/hme0.
  For Linux, it will be ethn, where ''n'' is a number.
  (default eth0):
  输入 eth1 ,这是ADSL相连的网卡的名字(因为我这里使用eth1作为拨号的网卡名)
  
  当出现
  >>> Enter the demand value (default no):
  输入 no
  
  当出现
  >>> Enter the DNS information here:
  输入 server ,这表示使用ADSL拨号自动获得的DNS服务器IP地址
  
  当出现
  >>> Please enter your PPPoE password:
  输入ADSL帐号的密码
  
  当出现
  >>> Choose a type of firewall (0-2):
  输入 0 ,不使用防火墙
  
  当出现
  >>> Accept these settings and adjust configuration files (y/n)?
  如果输入的信息正确,输入 y ,完成配置,否则,输入 n 重新输入。
  此时安装成功
  
  但是还要做一些修改,否则还是不能使用的
  
  1.修改/etc/sysconfig/network-scripts/ifcfg-eth0 ifcfg-eth1将里面GETWAY的那一行删除掉
  
  (如果不做这一行,在网关上PING外部机器都无法PING通的,很多人遇到过这问题)
  2.将以下内容添加进/etc/rc.local
  引用:
  
  echo 0 > /proc/sys/net/ipv4/ip_froward
  iptables -t filter -F
  iptables -t nat -F
  iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
  echo 1 > /proc/sys/net/ipv4/ip_froward  
  
  重新启动机器
  执行#adsl-start 进行拨号
  #adsl-stop停止拨号
  #adsl-status查看当前状态
  
  以下是我执行adsl-status后显示的命令
  
  引用:
  
  [root@localhost /]# adsl-status
  Note: You have enabled demand-connection; adsl-status may be inaccurate.
  adsl-status: Link is up and running on interface ppp0
  ppp0 Link encap:Point-to-Point Protocol
  inet addr:61.149.169.94 P-t-P:61.149.169.93 Mask:255.255.255.255
  UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
  RX packets:2038 errors:0 dropped:0 overruns:0 frame:0
  TX packets:2066 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:3
  RX bytes:931286 (909.4 Kb) TX bytes:203700 (198.9 Kb)
  
  这时候通过客户机和网关访问外部网络都没有问题了
0
相关文章