web-dev-qa-db-ja.com

ipfilter:すべてのゾーンでsshをリダイレクトすることは可能ですか?

Linux(lxブランドゾーン)とSolaris(kvm-qemuで完全に動作する)をエミュレートできるため、テスト用のサーバーがあり、OmniOSをインストールしました。私はすべて192.168.0.0/24ネットワークで実行できますが、次のようなことを好みます。2つのNICを持つサーバー:bge0とbge1、bge0には192.168.0.30 ipがあり、bge1には10.2.0.1があります。 vm(zonesおよびkvm-qemu)は10.2.0.1ネットワークで実行されます。だから私はipfilterを使ってこのようなファイアウォールを作ります

ipf.conf

# block and quick everything by default but pass on lo0
block in log on bge0 all
pass in quick on bge1 all
pass in quick on lo0 all

# These rules will allow connections initiated from
# this Host along with the return connection
pass out quick proto icmp all keep state
pass out quick proto tcp all keep state
pass out quick proto udp all keep state

# Allow SecureShell incoming connections on 22 port 
pass in quick proto tcp from any to any port = 22 flags S keep state keep frags

ipnat.conf
map bge0 10.2.0.0/24 -> 0/32 portmap tcp/udp auto
map bge0 10.2.0.0/24 -> 0/32
rdr bge0 10.2.0.0/24 -> 10.2.0.3

1つのlxゾーン(10.2.0.3)で完璧に動作します。 192.168.0.0/24ネットワーククライアントからsshでアクセスできます。私の質問は..2つ以上のマシンが必要な場合、sshを別のマシンにリダイレクトすることは可能ですか?

例えば

machine1-------->ssh------->lxzone1
machine1-------->ssh------->lxzone2

これにはどのルールがありますか?

p.s ipfilter(removed)の代わりにpfを使用するsolaris11.4では、この単純なpf.confですべて正常に機能します。

# Vars
ext_if="net0"
int_if="net1"
ext_net="192.168.0.0/24"
int_net="10.2.0.0/24"
webports="{443, 80}"

##  make IP reassembly work
set reassemble yes no-df

## ignore loopback traffic
set skip on lo0

# block everything unless told otherwise
# and send TCP-RST/ICMP unreachable
# for every packet which gets blocked
block return in log all
pass out all

# Pass
pass in on $int_if proto tcp from $ext_net to any keep state
pass in on $int_if proto udp from $ext_net to any keep state
pass in on $int_if proto tcp from $int_net to any keep state
pass in on $int_if proto udp from $int_net to any keep state

# accept incoming SSH connections
pass in proto tcp from any to $ext_if port 22

# accept icmp
pass in proto icmp all

## allow all connections initiated from this system,
## including DHCP requests
pass out

#nat
pass out on net0 from $int_net to any nat-to (net0)
1
elbarna

動作する回避策。この場合、私はDNSサーバーに到達でき、IP 10.2.0.2、10.2.0.3、10.2.0.4のマシンにSSH接続できます。

cat ipnat.conf

map bge0 10.2.0.0/24 -> 0/32 portmap tcp/udp auto
map bge0 10.2.0.0/24 -> 0/32
rdr bge0 from any to 10.2.0.3/32 port = 22 -> 10.2.0.3 port 22 tcp
rdr bge0 from any to 10.2.0.2/32 port = 22 -> 10.2.0.2 port 22 tcp
rdr bge0 from any to 10.2.0.2/32 port = 53 -> 10.2.0.2 port 53 tcp
rdr bge0 from any to 10.2.0.2/32 port = 53 -> 10.2.0.2 port 53 udp
rdr bge0 from any to 10.2.0.4/32 port = 22 -> 10.2.0.4 port 22 tcp
rdr bge0 from any to 10.2.0.5/32 port = 22 -> 10.2.0.5 port 22 tcp
rdr bge0 from any to 10.2.0.6/32 port = 22 -> 10.2.0.6 port 22 tcp
0
elbarna