解决方案要用到服务有 ppp0 , dhcp ,iptables ,squid (其中dhcp和squid可选择不装)
最终实现目标: 服务器redhat用adsl拨号上网,下面局域网的其他机器通过服务器的iptables服务上网,并且基本上网服务都不受影响。如果你的客户端比较多的话,可以选择安装squid服务,使客户端访问网页速度快一点。当然如果你觉的你懒的去配置客户端的tcp/ip设置,那你可以启动dhcp服务。
服务器: redhat9.0 3com905b x 2 中兴的zxdsl831 北京网通adsl线路(非包月)
ip地址分配:
redhat服务器:
eth0: 192.168.0.1 255.255.255.0 其他网关,dns等都不要配置(如图),
此网卡用于连接局域网其他机器
adsl1.jpg" target=_blank title=开新窗口浏览图片>adsl1.jpg" border=0 onload="javascript:if(this.width>screen.width-333)this.width=screen.width-333">
eht1: 192.168.1.2 255.255.255.0其他网关,dns等都不要配置(如图),
此网卡用于adsl拨号用,注意大家千万不要设置成192.168.1.1,因为我的中兴的adsl有个默认的配置地址就是192.168.1.1
adsl2.jpg" target=_blank title=开新窗口浏览图片>adsl2.jpg" border=0 onload="javascript:if(this.width>screen.width-333)this.width=screen.width-333">
以上我们服务器的两块网卡都是静态设置,而不是大家常说的adsl网卡要设置成dhcp获取地址。
客户端的ip地址设置我们这里选择dhcp获取。如果你要静态设置,那你可以设置成
192.168.0.2-192.168.0.254之间的ip地址,子网掩码都是255.255.255.0,网关都指向192.168.0.1,dns指向192.168.0.1或者其他你知道的isp的dns地址
好服务器的网卡基本配置完成,现在我们来配置adsl连接,网上有很多人说redhat的自adsl有问题,可我配置却没有任何问题。我是直接用命令adsl-setup来配置
输入:adsl-setup 进入配置对话
welcome to the adsl client setup. first, i will run some checks on
your system to make sure the pppoe client is installed properly...
the following dsl config was found on your system:
device: name:
ppp0 dslppp0
please enter the device if you want to configure the present dsl config
(default ppp0) or enter 'n' if you want to create a new one: 建立的拨号连接名字,默认就行
login name
enter your login name (default ): 输入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 ethx, where 'x' is a number.
(default eth1): adsl设备所绑定的网卡,我们这里是eht1
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 dynamic dns addresses',
enter 'server' (all lower-case) here. 注意这里我们不要填写任何dns地址,后面我们会配置adsl自动从isp中获取dns地址
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:
password
please enter your password: 输入adsl账号的密码
please re-enter your password: 密码验证
userctrl
please enter 'yes' (two letters, lower-case.) if you want to allow
normal user to start or stop dsl connection (default yes): 默认就行