Linux下adsl拔号与共享上网

时间:2007-06-25 12:56:06   来源:  作者:  点击:次  出处:技术无忧
关键字:ADSL 拔号 共享上网


The firewall choices are:
0 - NONE: This script will not set any firewall rules.  You are responsible
          for ensuring the security of your machine.  You are STRONGLY
          recommended to use some kind of firewall rules.
1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
                for a LAN
Choose a type of firewall (0-2):
Please enter a number from 0 to 2
The firewall choices are:
0 - NONE: This script will not set any firewall rules.  You are responsible
          for ensuring the security of your machine.  You are STRONGLY
          recommended to use some kind of firewall rules.
1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
                for a LAN
Choose a type of firewall (0-2): 0

Start this connection at boot time

Do you want to start this connection at boot time?
Please enter no or yes (default no):

** Summary of what you entered **

Ethernet Interface: eth0
User name:          xyn0699647
Activate-on-demand: No
DNS:                Do not adjust
Firewalling:        NONE
User Control:       yes
Accept these settings and adjust configuration files (y/n)? y
Adjusting /etc/sysconfig/network-scripts/ifcfg-ppp0
Adjusting /etc/ppp/chap-secrets and /etc/ppp/pap-secrets
  (But first backing it up to /etc/ppp/chap-secrets.bak)
  (But first backing it up to /etc/ppp/pap-secrets.bak)


Congratulations, it should be all set up!

Type '/sbin/ifup ppp0' to bring up your xDSL link and '/sbin/ifdown ppp0'
to bring it down.
Type '/sbin/adsl-status /etc/sysconfig/network-scripts/ifcfg-ppp0'
to see the link status.
1.3拔号连接与断开
    输入 '/sbin/ifup ppp0' 进行拔号连接戓'/sbin/ifdown ppp0'断开拔号连接。
    至此,如果一切正常,你就可以正常网上冲浪!
2、共享上网
    通过上面的设置,你只能自己上网,要想其它电脑共享linux的连接上网,需要作如下的设置。

LINUX网络设置:
内网IP:192.168.0.1
子网掩码:255.255.255.0
网关:192.168.0.1
DNS:根据各地的网络服务商不同,云南昆明的是 202.98.160.68

注:要使设置生效,请先停止网卡,然后再激活。

其它的机器的设置只要保证与linux机器在一个网段并且网关设置为192.168.0.1就可以了,如:
192.168.0.2
255.255.255.0
192.168.0.1
DNS和主机一样。

用你喜欢的编辑器(如vi,gedit等)打开LINUX主机的/etc/rc.d/rc.local
在最后补上如下内容:
echo "1" > /proc/sys/net/ipv4/ip_forward
/sbin/ modprobe ip_nat_ftp
/sbin/ modprobe ip_conntrack
/sbin/ modprobe ip_conntrack_ftp
/sbin/ modprobe ip_conntrack_irc
/sbin/iptables -t nat -A POSTROUTING -o ppp0 -s 192.168.0.1/24 -j MASQUERADE

运行一下rc.local
    /etc/rc.d/rc.local
重新拔号,这样linux下的共享连接就设置OK了!

技术无忧.com


文章评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面

300x250广告位招租