# ezjail - host with Public IP



## FryShadow (Oct 20, 2009)

Hi all 

I already setup 3 webserver from ezjail in my local network with aliases address as per below :


```
ifconfig_rl0="inet 192.168.1.106  netmask 255.255.255.0"
ifconfig_rl0_alias0="inet 192.168.1.108 netmask 255.255.255.0" #httpd1
ifconfig_rl0_alias1="inet 192.168.1.109 netmask 255.255.255.0" #httpd2
ifconfig_rl0_alias2="inet 192.168.1.110 netmask 255.255.255.0" #httpd3
ifconfig_rl0_alias3="inet 192.168.1.111 netmask 255.255.255.0" #mysql server
```


```
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=8<VLAN_MTU>
	ether 00:60:67:70:d6:f3
	inet 192.168.1.106 netmask 0xffffff00 broadcast 192.168.1.255
	inet 192.168.1.108 netmask 0xffffff00 broadcast 192.168.1.255
	inet 192.168.1.109 netmask 0xffffff00 broadcast 192.168.1.255
	inet 192.168.1.110 netmask 0xffffff00 broadcast 192.168.1.255
	inet 192.168.1.111 netmask 0xffffff00 broadcast 192.168.1.255
	media: Ethernet autoselect (100baseTX <full-duplex>)
	status: active
```

And I also configure address pool for my PF 


```
webserver="{192.168.1.108, 192.168.1.109, 192.168.1.110}"
rdr on $ext_if proto tcp from any to any port 80 -> $webserver round-robin sticky-address
```

The question is, I'm planning to put my server at the Data Center and configure my interface with public IP, is it possible PF will load balancing to my jail web server with private IP ?

Thanks for helping


----------



## dennylin93 (Oct 24, 2009)

It should work as long as the configuration is correct.


----------



## FryShadow (Oct 24, 2009)

dennylin93 said:
			
		

> It should work as long as the configuration is correct.



thanks denny 

If I set my interface (rl0) with public IP how about the rest of my jails ? I planning to put a private IP for my jails


----------



## FryShadow (Dec 23, 2009)

I found this article stated that I can use the 2nd NIC which not required to connect to LAN. 

let say I have bge0 for my ext_if and bge1 for my int_if



```
bge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
	ether 00:24:8c:2a:8b:f1
	inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255
	inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
	inet 192.168.1.3 netmask 0xffffff00 broadcast 192.168.1.255
	inet 192.168.1.4 netmask 0xffffff00 broadcast 192.168.1.255
	inet 192.168.1.5 netmask 0xffffff00 broadcast 192.168.1.255
	media: Ethernet autoselect (none)
	status: no carrier

bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
	ether 00:24:8c:2a:89:03
	inet 115.10.10.10 netmask 0xffffffc0 broadcast 115.10.10.1
	media: Ethernet autoselect (1000baseTX <full-duplex>)
	status: active
```

I have to create the alias interface 1st before creating the jails, if not then your jails will not working.

I used NATing for ext_if so that int_if (jails) can communicate to outside.So far it works  even the bge1 is not connected to LAN 

p/s : anyone done any mysql replication using jails ?

jail r0x~


----------



## vivek (Dec 23, 2009)

Everything works inside jail including mysql replication (master to slave or NBD cluster etc).


----------



## FryShadow (Dec 23, 2009)

Thanks vivek


----------

