|
发表于 2003-4-19 17:18:59
|
显示全部楼层
我在这帖只说Mandrake 9.1 ADSL PPPOE 拔号让其它机器共享上网的共享办法。
1.用设置网卡,应该有两张网卡,最好把eth0的网卡接ADSL
设置工具是:
#netconf
把第一张网卡设置成如下的
eth0
IP:192.168.0.1
掩码:255.255.255.0
eth1是:
IP:192.168.0.2
掩码:255.255.255.0
网关不用设置
DNS设置为
202.96.134.133
202.96.168.68
设置过程中,可能会出现错误 netconf会报错,不用理它。这是BUG。
2.我们来设置rp-pppoe。
一些常用命令:
#adsl-setup 设置rp-pppoe
#adsl-start 启动拔号
#adsl-status 查看ADSL状态
#adsl-stop 停止ADSL
初始化rp-pppoe,用下面的办法:
#adsl-setup
Welcome to the Roaring Penguin ADSL client setup. First, I will run
some checks on your system to make sure the PPPoE client is installed
properly...
Looks good! Now, please enter some information:
USER NAME
>>> Enter your PPPoE user name (default XXX): 在这里输入ADSL的用户名
INTERFACE
>>> 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):如果一张网卡就设置写上eth0
Do you want the link to come up on demand, or stay up continuously?
If you want it to come up on demand, enter the idle time in seconds
after which the link should be dropped. If you want the link to
stay up permanently, enter 'no' (two letters, lower-case.)
NOTE: Demand-activated links do not interact well with dynamic IP
addresses. You may have some problems with demand-activated links.
>>> Enter the demand value (default no):不用写什么
DNS
Please enter the IP address of your ISP's primary DNS server.
If your ISP claims that 'the server will provide DNS addresses',
enter 'server' (all lower-case) here.
If you just press enter, I will assume you know what you are
doing and not modify your DNS setup.
>>> Enter the DNS information here:在这里写上202.96.134.133
下一个DNS是202.96.168.68
PASSWORD
>>> Please enter your PPPoE password:输入密码
>>> Please re-enter your PPPoE password:再输入一次
FIREWALLING
Please choose the firewall rules to use. Note that these rules are
very basic. You are strongly encouraged to use a more sophisticated
firewall setup; however, these will provide basic security. If you
are running any servers on your machine, you must choose 'NONE' and
set up firewalling yourself. Otherwise, the firewall rules will deny
access to all standard servers like Web, e-mail, ftp, etc. If you
are using SSH, the rules will block outgoing SSH connections which
allocate a privileged source port.
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):这里添写为2
** Summary of what you entered **
Ethernet Interface: eth0
User name: XXX
Activate-on-demand: No
DNS: Do not adjust
Firewalling: MASQUERADE
>>> Accept these settings and adjust configuration files (y/n)?
弄完后,就按一个y键。
我们用adsl-start来启动pppoe的拔号,如果能成功 。看是否是能上网浏览,如果不能浏览,就是netconf这一步的问题 ,我可以这样说,一定是网卡的设置问题 !!!
3.查看一下网络情况#ifconfig
4.把/etc/rc.d/rc.local文件改名为/etc/rc.d/rc.locaBAK,再建一个rc.local文件。
#cp /etc/rc.d/rc.local /etc/rc.d/rc.localBAK
#touch /etc/rc.d/rc.local
打开文件 /etc/rc.d/rc.local,用gedit或者vi或者kate也一样,只要你会用文本工具,就OK
加上如下的内容:
#share ADSL
touch /var/lock/subsys/local
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o ppp0 -j MASQUERADE
adsl-start
5.要先关掉ADSL的连接,然后再复启一系列服务。
#adsl-stop
# /etc/init.d/xinetd restart
# /etc/init.d/network restart
# adsl-start
最好是重启一下机器,因为Mandrake有在网络方面的设置有BUG。如果您不知道如何解决这些BUG,就得重启机器来测试。
6.windows的机器的设置
IP :192.168.0.X这个X,您可以用3 ,4, 5,6等等。。。每台机器都不能和别的机器和一样的IP。
比如一台可以用192.168.0.3 ;也可以用192.168.0.4 ;更可以用192.168.0.10也行。。。这方面的东西,如果您不知道如何做,还是请您看一下IP的资料。
掩码:255.255.255.0
DNS;
202.96.134.133
202.96.168.68
网关:192.168.0.1
7.OK
如果再不成功呢????要发以下文件的内容:
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/ppp/pppoe.conf
/etc/resolv.conf
/etc/sysconfig/network-scripts/net_cnx_up |
|