1

I have a server for testing,I have installed on it OmniOS,because can emulate linux(lx branded zones) and Solaris(works perfect with kvm-qemu). I can run all on 192.168.0.0/24 network,but I prefer to do something like this: A server with 2 nics: bge0 and bge1,bge0 has 192.168.0.30 ip,and bge1 with 10.2.0.1. The vm(zones and kvm-qemu) run on 10.2.0.1 network. So I make a firewall like this using 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

With one lx zone(10.2.0.3) works perfect. I can reach it with ssh from 192.168.0.0/24 network clients. My question is..if I want two or more machines,is possible to redirect ssh to different machine?

For example

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

Which rule for this?Thanks

p.s With solaris11.4 which use pf instead of ipfilter(removed) all works fine with this simple 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)
0

A workaround which work. In this case i can reach the dns server and can ssh to machines with ip 10.2.0.2 ,10.2.0.3, 10.2.0.4...

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.