鈴木@葛飾区です。

> ipfwを利用して、特定IP以外からのssh(22/tcp)アクセスは
> 違うポート(2222/tcp)に転送したいと考えています。
> 
> 特定IPから22/tcpで接続した場合は普通にsshに接続されるが、
> それ以外からの22/tcp接続は、kippo(2222/tcp)へ接続させたいと考えています。
> 
> そこで、ipfwの設定ファイルに下記の記載をしてみました。
> 
> add 1001 fwd 127.0.0.1,2222 log tcp from not <特定IP> to me 22
> 
> 接続テストをしたところ、2222に接続せず、そのまま22/tcpのsshに
> 接続されました。

ipfwの fwd ではリモートに転送する場合ポート番号の変更は行われません(無
視されます)。
(man ipfwのfwdに関する記述の抜粋です)
  If ipaddr is not a local address, then the port number (if speci-
  fied) is ignored, and the packet will be forwarded to the remote
  address, using the route as found in the local routing table for
  that IP.

リモートポートの変更を行うためにはパケットの中身を書き換えないとダメな
のでipfw単独では対応していないのだと思います。
試していませんので分かりませんが、natdを使ってのポート変換を行うか、
ipfwではなくpfとかならできるのかも知れません。
---
すずき
_______________________________________________
freebsd-users-jp@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-users-jp
To unsubscribe, send any mail to "freebsd-users-jp-unsubscr...@freebsd.org"

メールによる返信