[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debian-users:24192] potato での IP Masquerade について



菊地と申します。
slinkを以前使用していて、最近、potatoをcdromを利用して最初から、インストール
しています。
今は、デスクトップのpotatoにIP Masquerade機能を持たせるところで、どうにも、
問題が解決できずにおります。
過去ログもかなり調べて、参考になりそうなものもあり、それを参考にして設定して
みましたが、どうしてもうまくいきません。slinkの時には設定できていましたが、
potatoではかなり、ネットワーク関係の設定の仕方が変わったようで、また、その説
明文章のようなものも、今で、見つけることができていません。
下記に状況を書きますので、何かお気づきのことがありましたら、お教えください。
まず、

MN128--------+------potato(desktop)--------+--------notepc
     172.16.1.1    |      172.16.1.2       192.168.0.1   |     192.168.0.3
                     |                                          |
                     +--windows                           +---desktop
                       172.16.1.3                                192.168.0.2

MN128-SOHO-SL11というダイヤルアップルータの一つのイーサーネットポートに、
potatoのデスクトップがつながっています。インターネットへはmn128から出て行き
ます。
現状では、
MN128とpotato(desktop)間、
potato(desktop)とnotepc間、
ではpingのテストでも問題なく通信ができています。しかし、
notepcとMN128の間ではpingに失敗します。
基本的にslinkでの/etc/init.d/networkはかなり素人的にも、わかり、自分で、本な
どを見て、設定可能だったのですが、potatoでは、まったく状況がかわってしまって
いて、簡単ではないようです。
それでも、過去ログから推測して、
設定ファイルを書きました。

まず、/etc/network/interfacesは下記です。
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
iface lo inet loopback

# The first network card - this entry was created during the Debian
installation
# (network, broadcast and gateway are optional)

iface eth0 inet static
      address 192.168.0.1
      netmask 255.255.255.0
      network 192.168.0.0
      broadcast 192.168.0.255
iface eth1 inet static
      address 172.16.1.2
      netmask 255.255.255.0
      network 172.16.1.0
      broadcast 172.16.1.255
      gateway 172.16.1.1

次は、/etc/Optionsです。
ip_forward=yes
spoofprotect=yes
syncookies=no

次は、この状態起動した時にpotatoでの/bin/netstat -rn の結果です。

debiandesktop:~# /bin/netstat -rn
Kernel IP routing table
Destination   Gateway  Genmask     Flags MSS Window  irtt Iface
192.168.0.0     0.0.0.0    255.255.255.0   U     0       0         0 eth0
172.16.1.0      0.0.0.0     255.255.255.0   U     0      0         0 eth1
0.0.0.0         172.16.1.1    0.0.0.0         UG    0      0         0 eth1

debiandesktop:~#
debiandesktop:~# ping 172.16.1.1
PING 172.16.1.1 (172.16.1.1): 56 data bytes
64 bytes from 172.16.1.1: icmp_seq=0 ttl=63 time=3.7 ms
64 bytes from 172.16.1.1: icmp_seq=1 ttl=63 time=4.1 ms
64 bytes from 172.16.1.1: icmp_seq=2 ttl=63 time=3.7 ms
64 bytes from 172.16.1.1: icmp_seq=3 ttl=63 time=3.4 ms
64 bytes from 172.16.1.1: icmp_seq=4 ttl=63 time=3.5 ms

[1]+  Stopped                 ping 172.16.1.1
debiandesktop:~# ping 192.168.0.3
PING 192.168.0.3 (192.168.0.3): 56 data bytes
64 bytes from 192.168.0.3: icmp_seq=0 ttl=128 time=1.9 ms
64 bytes from 192.168.0.3: icmp_seq=1 ttl=128 time=0.7 ms
64 bytes from 192.168.0.3: icmp_seq=2 ttl=128 time=0.7 ms
64 bytes from 192.168.0.3: icmp_seq=3 ttl=128 time=0.7 ms
64 bytes from 192.168.0.3: icmp_seq=4 ttl=128 time=0.7 ms
64 bytes from 192.168.0.3: icmp_seq=5 ttl=128 time=0.7 ms

[2]+  Stopped                 ping 192.168.0.3
debiandesktop:~#

このような状況です。この状態で、192.168.0.3(notepc)から、172.16.1.1(mn128)
にpingが通りません。
思考錯誤の挙句に実験的に、自分で、簡単なスクリプトを書きました。

#!/bin/sh
#
/sbin/ifconfig eth0 192.168.0.1 broadcast 192.168.0.255 netmask
255.255.255.0
/sbin/ifconfig eth1 172.16.1.2 broadcast 172.16.1.255 netmask 255.255.255.0

#/sbin/route add -net 192.168.0.0 netmask 255.255.255.0 dev eth0
#/sbin/route add -net 172.16.1.0 netmask 255.255.255.0 dev eth1
/sbin/route add default gw 172.16.1.1

echo 1 >/proc/sys/net/ipv4/ip_forward
/sbin/ipchains -P forward DENY
/sbin/ipchains -A forward -s 192.168.0.0/255.255.255.0 -j MASQ

これをpotato起動後実行すると、仮にでも、
192.168.0.3(notepc)からpingで、172.16.1.1(mn128)にpingが通るようになり、実
際に、192.168.0.3(notepc)から、問題なく、HPのブラウジング、メールの送受信等
もできます。

ということは、カーネルの構築には一応問題ないと思われるので、、
/etc/network/interfaces周りの設定ファイルの記述の仕方に問題があるとおもわれ
ます。
お気づきの点がありましたら、コメントをよろしくお願いします。

また、potatoでのネットワーク関係の設定ファイルの書き方の解説文というものが
ネット上のどこかにありませんでしょうか?

よろしくお願いします。