I have 3 physical interfaces (msk0, sk0, xl0) in one FreeBSD 8.1-box which is used as my gateway with PF-NAT.
The thing I want is to isolate one of my jails to xl0. My ISP gives me 5 dynamic public IP's.
I've tried seting up multiple routes with setfib without success and I think the problem lies with the ISP giving me the same gateway on every physical interface I try with dhcp.
Is that a problem?
uname -a:
ifconfig:
setfib 0 netstat -rn:
setfib 1 netstat -rn
pf.conf
The thing I want is to isolate one of my jails to xl0. My ISP gives me 5 dynamic public IP's.
I've tried seting up multiple routes with setfib without success and I think the problem lies with the ISP giving me the same gateway on every physical interface I try with dhcp.
Is that a problem?
uname -a:
Code:
FreeBSD xxx.xxx.xxx 8.1-RELEASE-p2 FreeBSD 8.1-RELEASE-p2 #0: Thu Jan 20 17:57:48 UTC 2011 root@xxx.xxx.xxx:/usr/src/sys/amd64/compile/lain amd64
Code:
msk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=c011a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4,VLAN_HWTSO,LINKSTATE>
ether X:X:X:X:X
inet 10.0.1.1 netmask 0xffffff00 broadcast 10.0.1.255
inet 10.0.1.10 netmask 0xffffffff broadcast 10.0.1.10
inet 10.0.1.20 netmask 0xffffffff broadcast 10.0.1.20
inet 10.0.1.30 netmask 0xffffffff broadcast 10.0.1.30
media: Ethernet autoselect (100baseTX <full-duplex,flag0,flag1>)
status: active
xl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=80009<RXCSUM,VLAN_MTU,LINKSTATE>
ether X:X:X:X:X
inet A.229.66.183 netmask 0xfffff000 broadcast A.229.79.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
sk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=8000b<RXCSUM,TXCSUM,VLAN_MTU,LINKSTATE>
ether X:X:X:X:X
inet A.229.70.4 netmask 0xfffff000 broadcast A.229.79.255
media: Ethernet autoselect (100baseTX <full-duplex,flag0,flag1>)
status: active
setfib 0 netstat -rn:
Code:
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default A.229.64.1 UGS 0 1941879 sk0
10.0.1.0/24 link#1 U 26 4392385 msk0
10.0.1.1 link#1 UHS 0 0 lo0
10.0.1.10 link#1 UHS 0 0 lo0 =>
10.0.1.10/32 link#1 U 0 0 msk0
10.0.1.20 link#1 UHS 0 0 lo0 =>
10.0.1.20/32 link#1 U 0 0 msk0
10.0.1.30 link#1 UHS 0 33 lo0 =>
10.0.1.30/32 link#1 U 0 0 msk0
A.229.64.0/20 link#3 U 0 0 sk0
A.229.66.183 link#2 UHS 0 3 lo0
A.229.70.4 link#3 UHS 0 16 lo0
127.0.0.1 link#4 UH 0 4828 lo0
setfib 1 netstat -rn
Code:
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default A.229.64.1 UGS 0 165 xl0
10.0.1.0/24 link#1 U 0 0 msk0
10.0.1.10/32 link#1 U 0 0 msk0
10.0.1.20/32 link#1 U 0 0 msk0
10.0.1.30/32 link#1 U 0 0 msk0
A.229.64.0/20 link#3 U 0 1 sk0
127.0.0.1 link#4 UH 0 0 lo0
pf.conf
Code:
# macros
ext_if="sk0"
int_if="msk0"
# options
set loginterface none
set block-policy drop
set state-policy if-bound
set debug none
set skip on lo0
scrub in
# Usual NAT
nat on $ext_if from !($ext_if) -> ($ext_if:0)
rdr on $ext_if proto tcp from any to ($ext_if) port smtp -> 10.0.1.1 port smtp
# filter rules
block in
pass out quick
pass in quick proto tcp from any to any port 25
pass in quick on $int_if
pass in quick on xl0 \
reply-to ( xl0 A.229.64.1 ) \
proto tcp from any to any port { 8010 } \
keep state ( floating )