Bonjour à tous,
J'ai besoin d'utiliser IPFW plutôt que tout autre firewall car j'utilise des jails vnet et c'est pour l'instant le seul qui soit compatible. Mais ça fait deux semaines que je me bats avec la doc, les rares tutos, et les exemples dans /etc/rc.firewall, et plusieurs mois que j'apprends sur les réseaux. J'ai besoin d'aide svp . Je suis un peut perdu aussi en regard de ce qui relève de natd ou de ipfw. Je suis perdu aussi sur les routes.
J'ai un hôte FreeBSD avec une seule interface matérielle em0, et 2 jails en zfs. On ne s'intéressera ici qu'à la 2ème qui a une configuration plus simple. Dans l'hôte, j'ai créé trois bridges avec des sous réseaux différents pour 3 jails. J'ai suivi le quick start de zjail ici. La jail02 est associée à vswitch2.
Je voudrais juste pouvoir dans un premier temps exécuter un host google.fr depuis jail02 avec succès.
Voici les différentes configurations. Pour l'hôte :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 root@host:/root # cat /etc/rc.conf | sed -e 's/#.*//;/^\s*$/d' zfs_enable=YES hostname="host.mondomaine.com" ifconfig_em0="inet 192.168.99.66 netmask 0xffffff00" defaultrouter="192.168.99.1" sshd_enable="YES" pf_enable="NO" moused_enable="YES" dumpdev="AUTO" font8x8="iso-8x8" font8x14="iso-8x14" font8x16="iso-8x16" scrnmap="iso-8859-1_to_cp437" keymap="fr.iso.acc" ipv6_activate_all_interfaces="YES" ipv6_ifconfig_em0_alias0="inet6 xx:xx:xx:xx::99:66 prefixlen 64" ipv6_ifconfig_em0_alias1="inet6 fe80::99:66 prefixlen 64" ipv6_defaultrouter="fe80:2095:a4ff:fe97:bedb" ezjail_enable="NO" openntpd_enable="YES" openntpd_flags="-s" inetd_enable="NO" rpc_bind_enable="NO" sendmail_enable="NO" syslogd_enable="YES" syslogd_flags="-s -b 127.0.0.1" gateway_enable="YES" cloned_interfaces="bridge0 bridge1 bridge2" ifconfig_bridge0_name="vswitch0" ifconfig_bridge1_name="vswitch1" ifconfig_bridge2_name="vswitch2" ifconfig_vswitch0="inet 10.5.100.254 netmask 255.255.255.0 up" ifconfig_vswitch1="inet 10.6.100.254 netmask 255.255.255.0 up" ifconfig_vswitch2="inet 10.7.100.254 netmask 255.255.255.0 up" gateway_enable="YES" firewall_enable="YES" firewall_type="OPEN" natd_enable="YES" natd_interface="em0"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 root@host:/root # ifconfig | sed -e 's/#.*//;/^\s*$/d' em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC> ether 02:5a:4b:3c:2d:1e inet 192.168.99.66 netmask 0xffffff00 broadcast 192.168.99.255 inet6 fe80::5a:4bff:fe3c:2d1e%em0 prefixlen 64 scopeid 0x1 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> media: Ethernet autoselect (1000baseT <full-duplex>) status: active ipfw0: flags=8801<UP,SIMPLEX,MULTICAST> metric 0 mtu 65536 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6> inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 inet 127.0.0.1 netmask 0xff000000 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> vswitch0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 ether 02:93:99:a5:4c:00 inet 10.5.100.254 netmask 0xffffff00 broadcast 10.5.100.255 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200 root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0 member: vnet0-2 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 8 priority 128 path cost 2000 member: vnet0-1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP> ifmaxaddr 0 port 7 priority 128 path cost 2000 vswitch1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 ether 02:93:99:a5:4c:01 inet 10.6.100.254 netmask 0xffffff00 broadcast 10.6.100.255 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200 root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0 vswitch2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 ether 02:93:99:a5:4c:02 inet 10.7.100.254 netmask 0xffffff00 broadcast 10.7.100.255 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200 root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0 vnet0-1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500 description: Attached to Jail: jail01 options=8<VLAN_MTU> ether 02:1a:17:00:07:0a inet6 fe80::1a:17ff:fe00:70a%vnet0-1 prefixlen 64 scopeid 0x7 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>) status: active vnet0-2: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500 description: Attached to Jail: jail02 options=8<VLAN_MTU> ether 02:16:53:00:08:0a inet6 fe80::16:53ff:fe00:80a%vnet0-2 prefixlen 64 scopeid 0x8 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>) status: activePour la jail02 :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 root@host:/root # zjail list all +---------------------------------------------------------------------------------------------------------------------------+ | Id Name Hostname IPv4/6 Quota Free Size Clone Boot BP Status | +---------------------------------------------------------------------------------------------------------------------------+ | 1 jail01 jail01.local 192.168.99.11 6G 1.02G 1008K yes on 99 Up | | 2 jail02 jail02.local 10.7.100.2 6G 1.02G 692K yes on 99 Up | | -- base - - none 1.02G 369M no - - down | +---------------------------------------------------------------------------------------------------------------------------+
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 root@jail02:/root # ifconfig lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6> inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 inet 127.0.0.1 netmask 0xff000000 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> vnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=8<VLAN_MTU> ether 02:16:53:00:09:0b inet 10.7.100.2 netmask 0xffffff00 broadcast 10.7.100.255 inet6 fe80::16:53ff:fe00:90b%vnet0 prefixlen 64 scopeid 0x2 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>) status: active
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 root@jail02:/root # cat /etc/rc.conf | sed -e 's/#.*//;/^\s*$/d' defaultrouter="10.7.100.254" pf_enable="NO" rpcbind_enable="NO" cron_flags="$cron_flags -J 15" syslogd_flags="-ss" sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO"A terme, voici ce que je veux faire :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 root@host:/root # zjail show jail02 id : 2 name : jail02 ip : 10.7.100.2 hostname : jail02.local hostuuid : eb7faa4c-b22b-11e2-b9a5-025a4b3c2d1e quota : 6G available : 1.02G used : 704K boot : on notes : none mountpoint : /zjails/jds/local/jail02 devfs_ruleset : devfsrules_jail exec_start : /bin/sh /etc/rc exec_stop : /bin/sh /etc/rc.shutdown mount_enable : YES devfs_enable : YES procfs_enable : YES fdescfs_enable : YES flags : -l -U root cpuset : 0,1,2 fib : 0 compression : off compressratio : 1.00x dedup : off clone : yes seclevel : 2 priority : 99 last_started : 01.05.2013@08:55:39 last_shutdown : - defaultroute : 0.0.0.0 vnet_if : vnet0 netmask : 24 vnet0_sw : vswitch2 vnet1_sw : - vnet2_sw : - vnet : on jzfs : on
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 Web --- Router ---- em0 Host vswitch0 ------------- zjail00 (Mongrel2 server) | |------- zjail01 (Brubeck web python framework) | |------- zjail02 (Mongo DB) | |vswitch1 ------------- zjail10 (Mongrel2 server) |------- zjail11 (Special Application) |------- zjail12 (Mongo DB)
Partager