?? linux 下的 ppp over ethernet + ip masquerade 共享(轉).txt
字號:
作者:SunADM
日期:00-6-21 下午 10:16:38
發信人: jarry (jarry), 信區: ADSL
標 題: Linux 下的 PPP Over ethernet + IP Masquerade 共享
發信站: BBS 一網情深站 (Sun Jan 9 06:15:32 2000), 轉信
WinPPPOET 在 NT 下面真的是太不穩定了。HAdA
MS proxy 的 Winsock Proxy client 當然只能在 Windows 下面用..
HOoOoO 搞得我的 Linux 都上不了網。
廢話少講啦..... M$ 的牢騷也不發了。
OK
你先要有一臺裝了 Linux 的 Server (我用我的 Sony notebook 做 Server)
下載 Linux Kernel 2.2.13 (Stable from ftp://ftp.openunix.org/pub/linux/kernel)
那里只有 bzip2 壓縮格式的 Kernel .
下載了之后
#bzip -d kernel-2.2.13.tar.bz2
#tar -xvf kernel-2.2.13.tar
再下載 http://www.davin.ottawa.on.ca/pppoe/pppoed0.42.tgz
然后 #tar -zxvf pppoed0.42.tgz
注意:把上面兩個解壓到 /usr/src 里比較好點。
然后patch kernel
cd /usr/src/linux
cat /usr/src/pppoed-0.42/2213-pppox | patch -b -p1
make menuconfig
加入支持 IP masquerade (不會的話自己看IP masquerade HOWTO)
先 make kernel
make
make modules
make modules_install
make install
OK Kernel make 好了。
cd /usr/src/pppoed-0.42
make realclean
make dev
make depend
make
make install
cd /etc/ppp
設置 ppp
---- /etc/ppp/options --------------------
lock
local
nocrtscts
noauth
#be careful with mtu/mru if you are masquareding.
# Look at Kal Lin's page at http://www.cs.toronto.edu/~kal/hse/resource.html
mru 1490
mtu 1490
#please make sure you have noaccomp for now
noaccomp
#the construct below is needed by sympatico
name "userid@sympatico.ca"
#you might want to change defaultroute if you have more
#than one pppoe session
defaultroute
hide-password
sync
#it might be a good idea to uncoment the debug below
#debug
#kdebug 7
#if you use the -R option to make it persistent
#then uncomment the next two lines below
#lcp-echo-interval 240
#lcp-echo-failure 3
#nodetach
------ END /etc/ppp/options ------------
---- start /etc/ppp/pap-secrets --------------------
# Secrets for authentication using PAP
# client server secret IP addresses
szjarry@169b.gd * my_passwrod
---- END /etc/ppp/pap-secrets --------------------
設置好了就重新啟動 (如果你要用 IP masquerade 就要設置好,以后設置也可)
啟動之后以root的身份進入
/usr/sbin/pppoed
如果設置正常,幾秒鐘之后你的 ppp0 就OK了。
如果你不能連上,請 tail /usr/var/messages
看看里面的錯誤,以中國電信(GD)的 ADSL PPPOE 的問題。
大多錯誤還是 User ready used 錯誤,如果是這樣,請關掉 modem.
等幾分鐘再試。
如果可以連上,怎樣設置 IP masquerade 就是你自己看HOWTO了。
xixi
如果你是Linux新手我只提示一下 ipchains 的問題。
還有 /etc/sysconfig/network 文件里的FORWARD_IPV4 應該為 true
FORWARD_IPV4=true
還有在 /etc/rc.d/rc.local 里把 IP masquerade 的 modules 在啟動的時候加載入。
# modules 載入
/sbin/depmod -a
/sbin/modprobe ip_masq_ftp
/sbin/modprobe ip_masq_raudio
/sbin/modprobe ip_masq_irc
/sbin/modprobe ip_masq_quake
/sbin/modprobe ip_masq_mfw
/sbin/modprobe ip_masq_user
/sbin/modprobe ip_masq_portfw
/sbin/modprobe ip_cuseeme
/sbin/modprobe ip_masq_vdolive
/sbin/modprobe ipip
# enable ip forward 功能
echo "1" > /proc/sys/net/ipv4/ip_forwarding
# ipchains 防火墻的 rules,假想我的內部IP 為 192.168.1.0 - 255
ipchains -P forward DENY
ipchains -A forward -s 192.168.1.0/255.255.255.0 -j MASQ
###############大功告成,親個嘴兒#############
OK 現在是設置的你的 win$$$dows 機器如何通過 ip masquerade 上網。
點:開始>設置>控制面板>網絡>TCP/IP - ethernet 網卡
設置 IP 為 192.168.1.xxx netmask 為 255.255.255.0
要設置DNS 可以設置為 172.21.95.2
重要:網關必需設置成你的 linux Server 的 IP (有 adsl + pppoed 那部)
重啟window$: 連接一個網站試試。行了吧。
###############大功告成,親個嘴兒#############
有問題嗎? email 給我:
jarry@szonline.net (NO Spam please)
或 icq: 2922888
oicq: 10203
電話? NONO 不能說..
my homepage: http://202.103.190.31
(C)opyright BY Jarry.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -