VlanManagerãã©ã®ããã«æ©èœãããããã¯ãŒã¯ã¹ã±ãŒã©ããªãã£ãšãŠãŒã¶ãŒåé¢ãæäŸããããæè¿èª¬æããŸãã ã ãããããããŸã§ã¯ãç°ãªããŠãŒã¶ãŒã«å±ããåºå®IPãããã¯ãŒã¯ã«ã€ããŠã®ã¿èª¬æããŠããŸããã ããã©ã«ãã§ã¯ãåºå®IPã¢ãã¬ã¹ãã€ã³ã¹ã¿ã³ã¹ã«å²ãåœãŠãããŸããããããã¯ãŒã¯å€éšïŒãŸãã¯ä»ã®ããŒã¿ã»ã³ã¿ãŒïŒããã€ã³ã¹ã¿ã³ã¹ãããã«å©çšã§ããããšãä¿èšŒãããã®ã§ã¯ãããŸããã 次ã®ã·ããªãªãæ³åããŠãã ããã
1ã€ã®wwwãµãŒããŒãããŒã¿ããŒã¹ãµãŒããŒãããã³ãããã¯ãŒã¯ã¢ãã¬ã¹å€æïŒNATïŒãšãã©ãã£ãã¯ãã£ã«ã¿ãªã³ã°ãå®è¡ãããã¡ã€ã¢ãŠã©ãŒã«ãåããå°ããªWebãµã€ããå®è¡ããŸãã éåžžã次ã®èšå®ãé©çšããŸãã
-ãã¹ãŠã®ãµãŒããŒã¯ããã©ã€ããŒãïŒã«ãŒãã£ã³ã°äžå¯ïŒãããã¯ãŒã¯ç¯å²å ã®ãããã¯ãŒã¯å ã§éä¿¡ããŸãïŒããšãã°ã192.168.0.0 / 24ïŒã
-wwwãµãŒããŒã衚瀺ããã1ã€ã®ãããªãã¯ã«ãŒãã£ã³ã°å¯èœãªIPç¯å²ããããŸãã
次ã®ããšãè¡ããŸãã
-ãã¡ã€ã¢ãŠã©ãŒã«ã«ãããªãã¯IPã¢ãã¬ã¹ãå²ãåœãŠãŸãã
-ãã¡ã€ã¢ãŠã©ãŒã«ã§NATã«ãŒã«ãäœæããŠããã©ãã£ãã¯ããããªãã¯IPã¢ãã¬ã¹ããwwwãµãŒããŒã®ãã©ã€ããŒãIPã¢ãã¬ã¹ã«ã«ãŒãã£ã³ã°ããŸãã
OpenStackã®åºå®IPã¢ãã¬ã¹ã¯ãäžèšã®äŸã®192.168.0.0/24ãããã¯ãŒã¯ç¯å²ãšåãããã«æ©èœããŸãã åãOpenStackã¯ã©ã¹ã¿ãŒå ã®ã€ã³ã¹ã¿ã³ã¹éã®çžäºäœçšã®ã¿ãä¿èšŒããŸãã ãã ããOpenStackã¯ããããŒãã£ã³ã°IPããšåŒã°ããIPã¢ãã¬ã¹ã®å¥ã®ããŒã«ãå°å ¥ããŸãã ãããŒãã£ã³ã°IPã¢ãã¬ã¹ã¯ãã€ã³ã¿ãŒããããµãŒãã¹ãããã€ããŒïŒäžèšã®ãã¡ã€ã¢ãŠã©ãŒã«ã«é©åãããã®ïŒããè³Œå ¥ãããããªãã¯ã«ã«ãŒãã£ã³ã°å¯èœãªIPã¢ãã¬ã¹ã§ãã ãŠãŒã¶ãŒã¯IPã¢ãã¬ã¹ãã€ã³ã¹ã¿ã³ã¹ã«å²ãåœãŠãå€éšãããã¯ãŒã¯ããã¢ã¯ã»ã¹ã§ããããã«ããããšãã§ããŸãã
ãããŒãã£ã³ã°IPãšåºå®IPã®éã
ããã©ã«ãã§ã¯ããããŒãã£ã³ã°IPã¢ãã¬ã¹ã¯ä»®æ³ãã·ã³ã«å²ãåœãŠãããŸããã ã¯ã©ãŠããŠãŒã¶ãŒã¯ãOpenStack管çè ãèšå®ããããŒã«ããæ瀺çã«ãååŸãããä»®æ³ãã·ã³ã«å²ãåœãŠãå¿ èŠããããŸãã ãŠãŒã¶ãŒãããŒã«ãããããŒãã£ã³ã°IPã¢ãã¬ã¹ãååŸãããšããã«ããã®ãææè ãã«ãªããŸãïŒã€ãŸãããã€ã§ãä»®æ³ãã·ã³ããIPã¢ãã¬ã¹ãåãé¢ããŠå¥ã®ä»®æ³ãã·ã³ã«æ¥ç¶ã§ããŸãïŒã äœããã®çç±ã§ä»®æ³ãã·ã³ãååšããªããªã£ãå ŽåããŠãŒã¶ãŒã¯ãããŒãã£ã³ã°IPã¢ãã¬ã¹ã倱ãããšã¯ãããŸããããŠãŒã¶ãŒã¯ãããå¥ã®ã€ã³ã¹ã¿ã³ã¹ã«å²ãåœãŠãããšãã§ããŸãã æ®å¿µãªãããè€æ°ã®ä»®æ³ãã·ã³éã§åäžã®ãããŒãã£ã³ã°IPã¢ãã¬ã¹ãå ±æããŠãAmazon EC2ã®ãšã©ã¹ãã£ãã¯ããŒããã©ã³ã·ã³ã°ãªã©ã®ããŒããã©ã³ã·ã³ã°ãè¡ãããšã¯çŸåšäžå¯èœã§ãã
äžæ¹ãåºå®IPã¢ãã¬ã¹ã¯ãVMã®èµ·åæã«nova-networkã³ã³ããŒãã³ãã«ãã£ãŠåçã«å²ãåœãŠãããŸãã OpenStackã«ç¹å®ã®åºå®IPã¢ãã¬ã¹ãä»®æ³ãã·ã³ã«å²ãåœãŠãããã«æ瀺ããæ¹æ³ã¯ãããŸããã ãããã£ãŠãã¹ãããã·ã§ãããã埩å ãããåŸãä»®æ³ãã·ã³ã誀ã£ãŠã·ã£ããããŠã³ããæ°ããã€ã³ã¹ã¿ã³ã¹ã«æ°ããåºå®IPã¢ãã¬ã¹ãèªã¿èŸŒãŸããç¶æ³ã«é¥ãããšããããŸãã
ã·ã¹ãã 管çè ã¯ããããŒãã£ã³ã°IPã¢ãã¬ã¹ã®è€æ°ã®ããŒã«ãæ§æã§ããŸãã ãã ããåºå®IPããŒã«ãšã¯ç°ãªãããããŒãã£ã³ã°IPããŒã«ãç¹å®ã®ãŠãŒã¶ãŒã«å²ãåœãŠãããšã¯ã§ããŸããã åãŠãŒã¶ãŒã¯ããããŒãã£ã³ã°IPã¢ãã¬ã¹ã®ããŒã«ãããããŒãã£ã³ã°IPã¢ãã¬ã¹ããååŸãã§ããŸãã ãããããããŒãã£ã³ã°IPã®è€æ°ã®ããŒã«ãäœæããäž»ãªåæ©ã¯ãåããŒã«ããã®ã€ã³ã¿ãŒãããã¢ã¯ã»ã¹ãããã€ããŒã«ãµãŒãã¹ãæäŸããããšã§ãã ãããã£ãŠããµãã©ã€ã€ã®1ã€ãæ éããŠããæ¥ç¶ã§ããããšãä¿èšŒã§ããŸãã
èŠçŽãããšããããŒãã£ã³ã°IPã®åºæ¬çãªæ©èœã¯æ¬¡ã®ãšããã§ãã
-ãããŒãã£ã³ã°IPã¢ãã¬ã¹ã¯ãããã©ã«ãã§ã¯ä»®æ³ãã·ã³ã«èªåçã«å²ãåœãŠãããŸããïŒæåã§ã€ã³ã¹ã¿ã³ã¹ã«å²ãåœãŠãå¿ èŠããããŸãïŒã
-ä»®æ³ãã·ã³ãååšããªããªã£ãå ŽåããŠãŒã¶ãŒã¯å¥ã®ã€ã³ã¹ã¿ã³ã¹ã«å²ãåœãŠãããšã«ããããããŒãã£ã³ã°IPã¢ãã¬ã¹ãåå©çšã§ããŸãã
-ãŠãŒã¶ãŒã¯ãã¯ã©ãŠã管çè ã«ãã£ãŠå®çŸ©ãããããŸããŸãªããŒã«ãããããŒãã£ã³ã°IPã¢ãã¬ã¹ãååŸããŠãããŸããŸãªã€ã³ã¿ãŒããããµãŒãã¹ãããã€ããŒãŸãã¯å€éšãããã¯ãŒã¯ããä»®æ³ãã·ã³ã«æ¥ç¶ããæ©èœãæäŸã§ããŸãã
ãããŒãã£ã³ã°IP âå éšãŸãã¯å€éšã®ã¯ã©ãŠã
ãããŒãã£ã³ã°IPã¢ãã¬ã¹ã®ããããªãã¯ã¢ãã€ã©ããªãã£ãã¯çžå¯ŸçãªæŠå¿µã§ãã ãããªãã¯ã¯ã©ãŠãã®å Žåãã€ã³ã¿ãŒããããããããªãã¯ã«ã¢ã¯ã»ã¹å¯èœãªIPã¢ãã¬ã¹ã®ããŒã«ãšããŠããããŒãã£ã³ã°IPã¢ãã¬ã¹ã®ããŒã«ãå®çŸ©ããããšãã§ããŸãã 次ã«ãã¯ã©ã€ã¢ã³ãã¯ããããä»®æ³ãã·ã³ã«å²ãåœãŠãŠãèªå® ãŸãã¯è·å Žã®ã³ã³ãã¥ãŒã¿ãŒããSSHçµç±ã§ã¢ã¯ã»ã¹ã§ããŸãã
ããŒã¿ã»ã³ã¿ãŒã§äŒæ¥ã¯ã©ãŠããå®è¡ããŠããå ŽåããããŒãã£ã³ã°IPã¢ãã¬ã¹ã®ããŒã«ã¯ãããŒã¿ã»ã³ã¿ãŒã®æ®ãããOpenStackã€ã³ã¹ã¿ã³ã¹ãžã®ã¢ã¯ã»ã¹ãæäŸããä»»æã®ç¯å²ã®IPã¢ãã¬ã¹ã«ããããšãã§ããŸãã
ããŒã¿ã»ã³ã¿ãŒã®ãã©ãã£ãã¯ã«å¯ŸããŠã次ã®ç¯å²ãå®çŸ©ã§ããŸãïŒ10.0.0.0/16ã
OpenStackå ã§ã¯ã次ã®ç¯å²ã®åºå®IPã¢ãã¬ã¹ãäœæã§ããŸãïŒ192.168.0.0/16ããŠãŒã¶ãŒãµããããã«åå²ã
ããŒã¿ã»ã³ã¿ãŒå šäœããOpenStackã€ã³ã¹ã¿ã³ã¹ã«ã¢ã¯ã»ã¹ã§ããããã«ããã«ã¯ããããŒãã£ã³ã°IPã¢ãã¬ã¹ã®ããŒã«ã10.0.0.0/8ãµããããïŒããšãã°10.0.0.0/16ïŒãšããŠå®çŸ©ãããŠãŒã¶ãŒãããããIPã¢ãã¬ã¹ãååŸã§ããããã«OpenStackã«ç»é²ããŸãã
ãããŒãã£ã³ã°IPã䜿çšãã
åã«è¿°ã¹ãããã«ãã·ã¹ãã 管çè ã¯æåã«ãããŒãã£ã³ã°IPã®ããŒã«ãOpenStackã«ç»é²ããŸãã
nova-manage floating create --ip_range=PUBLICLY_ROUTABLE_IP_RANGE --pool POOL_NAME
ãããã£ãŠããããªãã¯ããŒã«ã¯ãŠãŒã¶ãŒã䜿çšã§ããããã«ãªããŸãã
çŸåšããŠãŒã¶ãŒã¯æ¬¡ã®æé ã«åŸããŸãã
-ã€ã³ã¹ã¿ã³ã¹ã®ããŠã³ããŒãïŒ
+ -------------------------------------- + --------- + -------- + -------------------------------- +
| ID | åå| ã¹ããŒã¿ã¹| ãããã¯ãŒã¯|
+ -------------------------------------- + --------- + -------- + -------------------------------- +
| 79935433-241a-4268-8aea-5570d74fcf42 | inst1 | ã¢ã¯ãã£ã| ãã©ã€ããŒã= 10.0.0.4 |
+ -------------------------------------- + --------- + -------- + -------------------------------- +
-ãããŒãã£ã³ã°IPã¢ãã¬ã¹ã®å©çšå¯èœãªããŒã«ãäžèŠ§è¡šç€ºããŸãã
nova floating-ip-pool-list
+ ------ +
| åå|
+ ------ +
| ãã|
| ãã¹ã|
+ ------ +
-ããŒã«ãpubãããïŒãŸãã¯ãå¿ èŠã«å¿ããŠããŒã«ãtestãããïŒãããŒãã£ã³ã°IPã¢ãã¬ã¹ãååŸããŸãã
nova floating-ip-createãã
+ --------------- + ------------- + ---------- + ------ +
| IP | ã€ã³ã¹ã¿ã³ã¹ID | åºå®IP | ããŒã«|
+ --------------- + ------------- + ---------- + ------ +
| 172.24.4.225 | ãªã| ãªã| ãã|
+ --------------- + ------------- + ---------- + ------ +
-ãããŒãã£ã³ã°IPã¢ãã¬ã¹ãã€ã³ã¹ã¿ã³ã¹ã«å²ãåœãŠãŸãïŒ
nova add-floating-ip 79935433-241a-4268-8aea-5570d74fcf42 172.24.4.225
ïŒæåã®åŒæ°ã¯ã€ã³ã¹ã¿ã³ã¹ã®uuidã§ã2çªç®ã¯æµ®åIPã¢ãã¬ã¹èªäœã§ãïŒ
-ãã¹ãŠã®èšå®ãæ£ããããšã確èªããŸãã
novaãããŒãã£ã³ã°IPãªã¹ã
+ -------------- + ---------------------------------- ---- + ---------- + ------ +
| IP | ã€ã³ã¹ã¿ã³ã¹ID | åºå®IP | ããŒã«|
+ -------------- + ---------------------------------- ---- + ---------- + ------ +
| 172.24.4.225 | 79935433-241a-4268-8aea-5570d74fcf42 | 10.0.0.4 | ãã|
+ -------------- + ---------------------------------- ---- + ---------- + ------ +
ããã§ãã€ã³ã¹ã¿ã³ã¹ã¯ãããŒãã£ã³ã°IPã¢ãã¬ã¹ã«ãã£ãŠOpenStackã¯ã©ã¹ã¿ãŒã®å€éšããèŠããã¯ãã§ãã
ãããŒãã£ã³ã°IPã®ä»çµã¿
ãããŒãã£ã³ã°IPãè¿œå ããåŸãã€ã³ã¹ã¿ã³ã¹å ã§äœãèµ·ãããŸããïŒ æ£è§£ã¯äœããããŸããã SSHçµç±ã§æ¥ç¶ãããããã¯ãŒã¯æ§æãèŠããšãåºå®ã®åºå®IPã¢ãã¬ã¹ãæã€ãããã¯ãŒã¯ã€ã³ã¿ãŒãã§ã€ã¹ã1ã€ããããšãããããŸãã
ãã¹ãŠã®æ§æã¯ã³ã³ãã¥ãŒãã£ã³ã°ããŒãã§å®è¡ãããŸãã ãããŒãã£ã³ã°IPã¢ãã¬ã¹ã«é¢é£ãããã¹ãŠã®äœæ¥ã¯ãnova-networkãµãŒãã¹ã«ãã£ãŠå®è¡ãããŸãããããã¯ãŒã¯ã¢ãã¬ã¹å€æïŒNATïŒã¯ãã€ã³ã¹ã¿ã³ã¹ã®åºå®IPã¢ãã¬ã¹ãšãããŒãã£ã³ã°IPã¢ãã¬ã¹ã®éã§ç·šæãããŸãã ãã㧠NATãã©ãåããã«é¢ãã説æãèŠã€ããããšãã§ããŸã ã
次ã®ãã£ãŒããã芧ãã ããã
ãã®ã¹ããŒã ã¯ããããã¯ãŒã¯ã¢ãŒãã§æ§æããã1ã€ã®ã³ã³ãã¥ãŒãã£ã³ã°ããŒããšãåºå®IPãããã¯ãŒã¯ã®æ§æã«äœ¿çšãããããŒããšVlanManagerã衚瀺ããŸãã ã³ã³ãã¥ãŒãã£ã³ã°ããŒãã«ã¯2ã€ã®ãããã¯ãŒã¯ã€ã³ã¿ãŒãã§ã€ã¹ãè£ åãããŠããŸããeth0ã€ã³ã¿ãŒãã§ã€ã¹ã¯åºå®IP / VLANã®ãã©ãã£ãã¯ã«å²ãåœãŠãããeth1ã¯ã³ã³ãã¥ãŒãã£ã³ã°ããŒããå€éšãããã¯ãŒã¯ã«æ¥ç¶ãããã€ã³ã¿ãŒãã§ã€ã¹ã§ãã ãããŒãã£ã³ã°IPããããŸãã ïŒVlanManagerãåºå®IPãããã¯ãŒã¯ãæ§æããæ¹æ³ã«ã€ããŠã¯ã åã®èšäºãåç §ããŠãã ãã ïŒ
ã¢ãã¬ã¹ãeth0ã€ã³ã¿ãŒãã§ã€ã¹ïŒåºå®/ãã©ã€ããŒãïŒã§æ§æãããŠããªãéãeth1ã€ã³ã¿ãŒãã§ã€ã¹ã«ã¯ãèšç®ããŒãïŒ91.207.15.105ïŒã®ããã©ã«ãã²ãŒããŠã§ã€ã§ããIPã¢ãã¬ã¹ãå²ãåœãŠãããŠããããšã«æ³šæããŠãã ããã
ãŠãŒã¶ãŒããããŒãã£ã³ã°IPã¢ãã¬ã¹ïŒ91.207.16.144ïŒãVM_1ã«å²ãåœãŠããšã次ã®2ã€ã®ããšãèµ·ãããŸãã
-ãããŒãã£ã³ã°IPã¢ãã¬ã¹ã¯ãeth1ã€ã³ã¿ãŒãã§ã€ã¹ã®ã»ã«ã³ããªã¢ãã¬ã¹ãšããŠæ§æãããŸããããã¯ããip addr show eth1ãã³ãã³ãã®åºåã§ã次ã®æé ãå«ãŸããŸãã
inet 91.207.15.105/24ã¹ã³ãŒãã°ããŒãã«eth1ïŒãã©ã€ããªeth1 ip
inet 91.207.16.144/32ã¹ã³ãŒãã°ããŒãã«eth1ïŒVM_1ã®ãããŒãã£ã³ã°IP
-ãããŒãã£ã³ã°IPã¢ãã¬ã¹ã®NATã«ãŒã«ã»ããã¯ãiptablesããŒãã«ã§æ§æãããŸãã 以äžã¯ãèšç®ããŒãã®natããŒãã«ã®ãã¹ãŠã®é¢é£ãšã³ããªã§ãïŒiptables âS -t natã³ãã³ããé€ããLinuxã§iptablesã䜿çšããŠNATãæ§æããæ¹æ³ã®è©³çŽ°ã«ã€ããŠã¯ã ãã¡ããåç §ããŠãã ãã ïŒã
ïŒãã®ã«ãŒã«ã¯ãèšç®ããŒãããçºä¿¡ããããã±ãããä¿èšŒããŸã
ïŒã€ã³ã¹ã¿ã³ã¹ãååšããå Žæã¯ããããŒãã£ã³ã°IPãä»ããŠã€ã³ã¹ã¿ã³ã¹ã«å°éããŸãã
-A nova-network-OUTPUT -d 91.207.16.144/32 -j DNAT --to-destination 10.0.0.3
ïŒãããŒãã£ã³ã°IPãžã®ãã¹ãŠã®å€éšãã©ãã£ãã¯ãä¿èšŒ
ïŒã¯ã€ã³ã¹ã¿ã³ã¹ã®åºå®IPã«åããããŸã
-A nova-network-PREROUTING -d 91.207.16.144/32 -j DNAT --to-destination 10.0.0.3
ïŒã€ã³ã¹ã¿ã³ã¹ããçºä¿¡ããããã¹ãŠã®ãã©ãã£ãã¯ã¯ããããŒãã£ã³ã°IPã«SNATãããŸã
-A nova-network-float-snat -s 10.0.0.3/32 -j SNAT --to-source 91.207.16.144
äžè¬ã«ãnova-networkã¯ãNATããŒãã«ã§äºåå®çŸ©ãããŠãããã§ãŒã³ã«è¿œå ã®ãã§ãŒã³ãè¿œå ããŸãã ãããŒãã£ã³ã°IPã¢ãã¬ã¹ã«ãããã©ãã£ãã¯ã«é¢é£ãããã§ãŒã³ã®é åºã以äžã«ç€ºããŸãïŒäžèšã®èŠåã䜿çšïŒã
ãã§ãŒã³åºå-ãã§ãŒã³nova-network-OUTPUT-ã«ãŒã«ïŒ-d 91.207.16.144/32 -j DNAT --to-destination 10.0.0.3
ãã§ãŒã³PREROUTING-ãã§ãŒã³nova-network-PREROUTING-ã«ãŒã«ïŒ-d 91.207.16.144/32 -j DNAT --to-destination 10.0.0.3
ãã§ãŒã³POSTROUTING-ãã§ãŒã³nova-postrouting-bottom-ãã§ãŒã³nova-network-snat-ãã§ãŒã³nova-network-float-snat-ã«ãŒã«ïŒ-s 10.0.0.3/32 -j SNAT --to-source 91.207.16.144
-ã«ãŒã«ãèšå®ããã³ãŒãã¯ãé¢æ°ã®nova / network / linux_net.pyã«ãããŸãã
def floating_forward_rulesïŒfloating_ipãfixed_ipïŒïŒ
return [ïŒ 'PREROUTING'ã '-dïŒ s -j DNAT --toïŒ s'ïŒ ïŒfloating_ipãfixed_ipïŒïŒã
ïŒ 'OUTPUT'ã '-dïŒ s -j DNAT --toïŒ s'ïŒ ïŒfloating_ipãfixed_ipïŒïŒã
ïŒãfloat-snatãã
'-sïŒ s -j SNAT --toïŒ s'ïŒ ïŒfixed_ipãfloating_ipïŒïŒ]
ãã£ãŒãã«æ»ããŸãã ãŠãŒã¶ãŒãå€éšãããã¯ãŒã¯ããIPã¢ãã¬ã¹ã§ä»®æ³ãã·ã³ã«ã¢ã¯ã»ã¹ããå ŽåïŒããšãã°ããping 91.20.16.144ãïŒïŒ
ãã©ãã£ãã¯ã¯ãèšç®ããŒãã®ãããªãã¯ã€ã³ã¿ãŒãã§ã€ã¹ïŒeth1ïŒã«å°éããŸãã nova-network-PREROUTINGã§ã¯ããã±ããã®å®å IPã¢ãã¬ã¹ã91.207.16.144ãã10.0.0.3ã«å€æŽããDNATãå®è¡ãããŸãã
-ã³ã³ãã¥ãŒãã£ã³ã°ããŒãã¯ã«ãŒãã£ã³ã°ããŒãã«ã«ã¢ã¯ã»ã¹ãããããã¯ãŒã¯10.0.0.0ãbr100ã€ã³ã¿ãŒãã§ã€ã¹ã§å©çšå¯èœã§ããããšã確èªããŸãïŒã³ã³ãã¥ãŒãã£ã³ã°ããŒãã®ãip route showããé€ãïŒã
10.0.0.0/24 dev br100
ãã®ããã«ããŠããã±ãããbr100ã€ã³ã¿ãŒãã§ã€ã¹ã«éä¿¡ãããã±ããã¯ä»®æ³ãã·ã³ã«å°éããŸãã
ä»®æ³ãã·ã³ãå€éšã«ãã±ãããéä¿¡ããå ŽåïŒããšãã°ããping 8.8.8.8ãïŒïŒ
-å®å ã¢ãã¬ã¹ã¯ä»®æ³ãã·ã³ã®ããŒã«ã«ãããã¯ãŒã¯ã«ãªãããããã±ããã¯IPã¢ãã¬ã¹10.0.0.1ã§ä»®æ³ãã·ã³ã®ããã©ã«ãã²ãŒããŠã§ã€ã«éä¿¡ãããŸãïŒã³ã³ãã¥ãŒãã£ã³ã°ããŒãã®ããã€ã¹ã¢ãã¬ã¹ã¯ãbr100ãã§ãïŒã
-ã³ã³ãã¥ãŒãã£ã³ã°ããŒãã¯ã«ãŒãã£ã³ã°ããŒãã«ããã§ãã¯ããçŽæ¥æ¥ç¶ããããããã¯ãŒã¯äžã«8.8.8.8ã¢ãã¬ã¹ããªãããšãæ€åºããããããã±ãããããã©ã«ãã²ãŒããŠã§ã€ïŒãã®å Žåã¯eth1ã®ãã©ã€ããªã¢ãã¬ã¹-91.207.15.105ïŒã«è»¢éããŸãã
-ãã±ããã¯POSTROUTINGãã§ãŒã³ã«åé¡ããããnova-network-float-snatããã§ãŒã³ã«éä¿¡ãããããã§å ã®IPã¢ãã¬ã¹ããããŒãã£ã³ã°IPã¢ãã¬ã¹ïŒ91.207.16.144ïŒã«æžãæããããŸãã
å®å šäžã®æ³šæ
OpenStackã䜿çšããå Žåãã·ã¹ãã 管çè ã¯iptablesããŒãã«ã®ãã«ã³ã³ãããŒã«ãnovaãµãŒãã¹ã«å§ä»»ããŸãã ã«ã¹ã¿ã ã«ãŒã«ã®ã»ããã¯éåžžã«è€éã§ãå€éšã®å¹²æžã«ãã£ãŠç°¡åã«ç ŽãããŸãã ããã«ãnova-networkããŒã¢ã³ãåèµ·åããããã³ã«ãOpenStackã«é¢é£ä»ããããiptablesããŒãã«ãã§ãŒã³ã®ãã¹ãŠã®ã«ãŒã«ãé©çšãããŸãã iptablesããŒãã«ã®åäœãäœããã®æ¹æ³ã§å€æŽããå¿ èŠãããå Žåã¯ãé©åãªå Žælinux_net.pyã®ã³ãŒããå€æŽããããšã§å®è¡ã§ããŸãïŒNATã«ãŒã«ã®å Žåããããã¯floating_forward_rulesã«ãªããŸãïŒã
ãŸããnova-networkã¯ããŒãã«ã远跡ããŸããã ãããã£ãŠãOpenStackã«é¢é£ä»ãããããã§ãŒã³ããã«ãŒã«ãæåã§åé€ããå Žåã次ã«nova-networkãèµ·åãããšãã«ã«ãŒã«ã¯åŸ©å ãããŸããã
ãããã£ãŠãã·ã¹ãã 管çè ã¯ã³ã³ãã¥ãŒãã£ã³ã°ããŒããžã®äžèŠãªã¢ã¯ã»ã¹ã誀ã£ãŠç°¡åã«éãããšãã§ããŸãã nova-networkã¯eth1ã«ã»ã«ã³ããªãšããŠãããŒãã£ã³ã°IPã¢ãã¬ã¹ãé 眮ããä»®æ³ãã·ã³ã®åºå®IPã¢ãã¬ã¹ã«ãã©ãã£ãã¯ãèªå°ããDNATã«ãŒã«ãèšå®ããããšãæãåºããŠãã ããã
-A nova-network-PREROUTING -d 91.207.16.144/32 -j DNAT --to-destination 10.0.0.3
ãããã£ãŠã91.207.16.144ã«åãããããã¹ãŠã®ãã©ãã£ãã¯ã¯ãã¢ãã¬ã¹10.0.0.3ã«å°éããŸãã
ããã§ãã·ã¹ãã 管çè ã次ã®ããã«å ¥åããŠãå€éã«ãããã¯ãŒã¯ã«æ¥ç¶ããåé¡ã解決ãã誀ã£ãŠãã¹ãŠã®NATã«ãŒã«ãåé€ãããšããŸãã
iptables âF ât nat
äžèšã®NATã«ãŒã«ã¯åé€ãããŸããããã»ã«ã³ããªIPã¢ãã¬ã¹91.207.16.144ã¯ãŸã eth1ã«å²ãåœãŠãããŠããŸãã ãããã£ãŠãå€éšããã¢ãã¬ã¹91.207.16.144ã«ã¢ã¯ã»ã¹ã§ããŸãããä»®æ³ãã·ã³ã«ã¢ã¯ã»ã¹ãã代ããã«ãèšç®ããŒãèªäœã«ã¢ã¯ã»ã¹ã§ããŸãïŒåé€ãããããå®å IPã¢ãã¬ã¹ã¯DNATã«ãŒã«ã«åŸã£ãŠå€æãããªããªããŸããïŒãã¹ãŠã®NATã«ãŒã«ïŒã ãã®ã»ãã¥ãªãã£ããŒã«ã¯ãã«ãŒã«ãåäœæããnova-networkããã»ã¹ã®æ¬¡ã®åèµ·åãŸã§éããããŸããã
ãããŒãã£ã³ã°IPãæ§æãã
nova.confãµãŒãã¹ã«ã¯ããããŒãã£ã³ã°IPã¢ãã¬ã¹ã®åäœã«åœ±é¿ãããã©ã°ããããŸãã
ïŒãããŒãã£ã³ã°IPãæ¥ç¶ãããŠããã€ã³ã¿ãŒãã§ãŒã¹
ïŒã»ã«ã³ããªã¢ãã¬ã¹ãšããŠ
public_interface = "eth1"
ïŒããã©ã«ãã§ãããŒãã£ã³ã°IPãååŸãããããŒã«
default_floating_pool = "pub"
ïŒçæããããã¹ãŠã®ã€ã³ã¹ã¿ã³ã¹ã«èªåçã«ãããŒãã£ã³ã°IPãè¿œå ã§ããŸã
auto_assign_floating_ip = false
æŠèŠã³ã¡ã³ã
ã€ã³ã¿ãŒãããããçŽæ¥ä»®æ³ãã·ã³ãžã®ã¢ã¯ã»ã¹ãæäŸããããšã«å ããŠããããŒãã£ã³ã°IPã¡ã«ããºã ã¯ã¯ã©ãŠããŠãŒã¶ãŒã«ããçšåºŠã®æè»æ§ãäžããŸãã ãããŒãã£ã³ã°IPã¢ãã¬ã¹ããããã¯ã¢ãããããåŸãææè ãå€æŽã§ããŸããã€ãŸããå€åºå ã§ããŸããŸãªä»®æ³ãã·ã³ã«å²ãåœãŠãŠåå²ãåœãŠããããšãã§ããŸããããã«ãããæ°ããã³ãŒããšã·ã¹ãã ã¢ããããŒãã®ãªãªãŒã¹ãå€§å¹ ã«å®¹æã«ãªããŸãã åºæ¬çãªã¡ã«ããºã ïŒiptablesïŒã¯éåžžã«è€éã§ãããOpenStackã«ãã£ãŠç£èŠãããªããããã·ã¹ãã 管çè ã«ãšã£ãŠãããã¯æœåšçãªã»ãã¥ãªãã£ãªã¹ã¯ããããããŸãã ãããã£ãŠããã¡ã€ã¢ãŠã©ãŒã«ããªã·ãŒãå€æŽã§ããã®ã¯OpenStackãœãããŠã§ã¢ã®ã¿ã§ãããæåã§å€æŽããªãããšãéèŠã§ãã
è±èªã®ãªãªãžãã«èšäº