22.5. ¥Ö¥ê¥Ã¥¸

¸¶ºî: Steve Peterson.

22.5.1. ¤Ï¤¸¤á¤Ë

IP ¥µ¥Ö¥Í¥Ã¥È¤òºîÀ®¤·¤Æ¡¢ ¤½¤ì¤é¤Î¥»¥°¥á¥ó¥È¤ò¥ë¡¼¥¿¤ò»È¤Ã¤ÆÀܳ¤¹¤ë¤³¤È¤Ê¤·¤Ë¡¢ (Ethernet ¥»¥°¥á¥ó¥È¤Î¤è¤¦¤Ê) °ì¤Ä¤ÎʪÍý¥Í¥Ã¥È¥ï¡¼¥¯¤òÆó¤Ä¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥»¥°¥á¥ó¥È¤Ëʬ³ä¤¹¤ë¤³¤È¤Ï¤È¤Æ¤âÍ­¸ú¤Ê¾ì¹ç¤¬¤¢¤ê¤Þ¤¹¡£ ¤³¤ÎÊýË¡¤ÇÆó¤Ä¤Î¥Í¥Ã¥È¥ï¡¼¥¯¤ò·Ò¤°¥Ç¥Ð¥¤¥¹¤Ï “¥Ö¥ê¥Ã¥¸” ¤È¸Æ¤Ð¤ì¤Þ¤¹¡£ Æó¤Ä¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥¤¥ó¥¿¥Õ¥§¡¼¥¹¥«¡¼¥É¤ò»ý¤Ä FreeBSD ¥·¥¹¥Æ¥à¤Ï¡¢¥Ö¥ê¥Ã¥¸¤È¤·¤ÆÆ°ºî¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

¥Ö¥ê¥Ã¥¸¤Ï¡¢³Æ¥Í¥Ã¥È¥ï¡¼¥¯¥¤¥ó¥¿¥Õ¥§¥¤¥¹¤Ë·Ò¤¬¤ë¥Ç¥Ð¥¤¥¹¤Î MAC ÁؤΥ¢¥É¥ì¥¹ (Ethernet ¥¢¥É¥ì¥¹) ¤òµ­²±¤¹¤ë¤³¤È¤Ë¤è¤êÆ°ºî¤·¤Þ¤¹¡£ ¥Ö¥ê¥Ã¥¸¤Ï¥È¥é¥Õ¥£¥Ã¥¯¤ÎÁ÷¿®¸µ¤È¼õ¿®À褬°Û¤Ê¤Ã¤¿¥Í¥Ã¥È¥ï¡¼¥¯¾å¤Ë¤¢¤ë¾ì¹ç¤Ë¤Î¤ß¥È¥é¥Õ¥£¥Ã¥¯¤òžÁ÷¤·¤Þ¤¹¡£

¿¤¯¤ÎÅÀ¤Ç¡¢¥Ö¥ê¥Ã¥¸¤Ï¥Ý¡¼¥È¿ô¤Î¾¯¤Ê¤¤ Ethernet ¥¹¥¤¥Ã¥Á¤Î¤è¤¦¤Ê¤â¤Î¤È¤¤¤¨¤Þ¤¹¡£

22.5.2. ¥Ö¥ê¥Ã¥¸¤¬¤Õ¤µ¤ï¤·¤¤¾õ¶·

º£Æü¥Ö¥ê¥Ã¥¸¤¬³èÌö¤¹¤ë¾ìÌ̤ÏÂ礭¤¯Ê¬¤±¤ÆÆó¤Ä¤¢¤ê¤Þ¤¹¡£

22.5.2.1. ¥È¥é¥Õ¥£¥Ã¥¯¤Î·ã¤·¤¤¥»¥°¥á¥ó¥È

¤Ò¤È¤Ä¤Ï¡¢ ʪÍý¥Í¥Ã¥È¥ï¡¼¥¯¥»¥°¥á¥ó¥È¤¬¥È¥é¥Õ¥£¥Ã¥¯²á¾ê¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤¬¡¢ ¤Ê¤ó¤é¤«¤ÎÍýͳ¤Ë¤è¤ê¥Í¥Ã¥È¥ï¡¼¥¯¤ò¥µ¥Ö¥Í¥Ã¥È¤Ëʬ¤±¡¢ ¥ë¡¼¥¿¤ÇÀܳ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¾ì¹ç¤Ç¤¹¡£

ÊÔ½¸ÉôÌç¤ÈÀ½ºîÉôÌ礬¤ª¤Ê¤¸¥µ¥Ö¥Í¥Ã¥È¤ËƱµï¤·¤Æ¤¤¤ë¿·Ê¹¼Ò¤òÎã¤Ë¹Í¤¨¤Æ¤ß¤Þ¤·¤ç¤¦¡£ ÊÔ½¸ÉôÌç¤Î¥æ¡¼¥¶¤Ï¥Õ¥¡¥¤¥ë¥µ¡¼¥Ð¤È¤·¤ÆÁ´°÷¥µ¡¼¥Ð A ¤òÍøÍѤ·¡¢ À½ºîÉôÌç¤Î¥æ¡¼¥¶¤Ï¥µ¡¼¥Ð B ¤òÍøÍѤ·¤Þ¤¹¡£ ¤¹¤Ù¤Æ¤Î¥æ¡¼¥¶¤òÀܳ¤¹¤ë¤Î¤Ë¤Ï Ethernet ¤¬»È¤ï¤ì¤Æ¤ª¤ê¡¢ ¹âÉé²Ù¤È¤Ê¤Ã¤¿¥Í¥Ã¥È¥ï¡¼¥¯¤ÏÃÙ¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡£

¤â¤·ÊÔ½¸ÉôÌç¤Î¥æ¡¼¥¶¤ò°ì¤Ä¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥»¥°¥á¥ó¥È¤ËʬΥ¤¹¤ë¤³¤È¤¬¤Ç¤­¡¢ À½ºîÉôÌç¤Î¥æ¡¼¥¶¤âƱÍͤˤǤ­¤ë¤Î¤Ê¤é¡¢ Æó¤Ä¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥»¥°¥á¥ó¥È¤ò¥Ö¥ê¥Ã¥¸¤Ç·Ò¤°¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ ¥Ö¥ê¥Ã¥¸¤Î “È¿ÂД ¦¤Ø¸þ¤«¤¦¥Í¥Ã¥È¥ï¡¼¥¯¥È¥é¥Õ¥£¥Ã¥¯¤À¤±¤¬Å¾Á÷¤µ¤ì¡¢ ³Æ¥Í¥Ã¥È¥ï¡¼¥¯¥»¥°¥á¥ó¥È¤Îº®»¨¤Ï´ËϤµ¤ì¤Þ¤¹¡£

22.5.2.2. ¥Ñ¥±¥Ã¥È¥Õ¥£¥ë¥¿/ÂÓ°èÀ©¸æÍÑ¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ë

¤â¤¦¤Ò¤È¤Ä¤Ï¥Í¥Ã¥È¥ï¡¼¥¯¥¢¥É¥ì¥¹ÊÑ´¹ (NAT) ¤ò»È¤ï¤º¤Ë¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ëµ¡Ç½¤òÍøÍѤ·¤¿¤¤¾ì¹ç¤Ç¤¹¡£

¤³¤³¤Ç¤Ï DSL ¤â¤·¤¯¤Ï ISDN ¤Ç ISP ¤ËÀܳ¤·¤Æ¤¤¤ë¾®¤µ¤Ê²ñ¼Ò¤òÎã¤Ë¤È¤Ã¤Æ¤ß¤Þ¤·¤ç¤¦¡£ ¤³¤Î²ñ¼Ò¤Ï ISP ¤«¤é¥°¥í¡¼¥Ð¥ë IP ¥¢¥É¥ì¥¹¤ò 13 ¸Ä³ä¤êÅö¤Æ¤é¤ì¤Æ¤ª¤ê¡¢¥Í¥Ã¥È¥ï¡¼¥¯¾å¤Ë¤Ï 10 Âæ¤Î PC ¤¬Â¸ºß¤·¤Þ¤¹¡£ ¤³¤Î¤è¤¦¤Ê¾õ¶·¤Ç¤Ï¡¢¥µ¥Ö¥Í¥Ã¥È²½¤Ë¤Þ¤Ä¤ï¤ëÌäÂ꤫¤é¡¢ ¥ë¡¼¥¿¤òÍѤ¤¤¿¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ë¤òÍøÍѤ¹¤ë¤³¤È¤Ïº¤Æñ¤Ç¤¹¡£

¥Ö¥ê¥Ã¥¸¤òÍѤ¤¤¿¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ë¤Ê¤é¡¢ IP ¥¢¥É¥ì¥¹¤ÎÌäÂê¤òµ¤¤Ë¤¹¤ë¤³¤È̵¤¯¡¢ DSL/ISDN ¥ë¡¼¥¿¤Î²¼Î®Â¦¤ËÃÖ¤¯¤è¤¦¤ËÀßÄê¤Ç¤­¤Þ¤¹¡£

22.5.3. ¥Ö¥ê¥Ã¥¸¤òÀßÄꤹ¤ë

22.5.3.1. ¥Í¥Ã¥È¥ï¡¼¥¯¥¤¥ó¥¿¥Õ¥§¡¼¥¹¥«¡¼¥É¤ÎÁªÂò

¥Ö¥ê¥Ã¥¸¤òÍøÍѤ¹¤ë¤Ë¤Ï¾¯¤Ê¤¯¤È¤â 2 Ëç¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥«¡¼¥É¤¬É¬ÍפǤ¹¡£ »ÄÇ°¤Ê¤³¤È¤Ë FreeBSD 4.0 ¤Ç¤Ï¤¹¤Ù¤Æ¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥¤¥ó¥¿¥Õ¥§¡¼¥¹¥«¡¼¥É¤¬¥Ö¥ê¥Ã¥¸µ¡Ç½¤ËÂбþ¤·¤Æ¤¤¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£ ¥«¡¼¥É¤ËÂбþ¤·¤Æ¤¤¤ë¤«¤É¤¦¤«¤Ë¤Ä¤¤¤Æ¤Ï bridge(4) ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£

°Ê²¼¤Ë¿Ê¤àÁ°¤Ë¡¢ ÆóËç¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥«¡¼¥É¤ò¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¥Æ¥¹¥È¤·¤Æ¤¯¤À¤µ¤¤¡£

22.5.3.2. ¥«¡¼¥Í¥ë¥³¥ó¥Õ¥£¥°¥ì¡¼¥·¥ç¥ó¤ÎÊѹ¹

¥«¡¼¥Í¥ë¤Ç¥Ö¥ê¥Ã¥¸µ¡Ç½¤òÍ­¸ú¤Ë¤¹¤ë¤Ë¤Ï

options BRIDGE

¤È¤¤¤¦¹Ô¤ò¥«¡¼¥Í¥ë¥³¥ó¥Õ¥£¥°¥ì¡¼¥·¥ç¥ó¥Õ¥¡¥¤¥ë¤ËÄɲä·¤Æ ¥«¡¼¥Í¥ë¤òºÆ¹½ÃÛ¤·¤Æ¤¯¤À¤µ¤¤¡£

22.5.3.3. ¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ëÂбþ

¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ë¤È¤·¤Æ¥Ö¥ê¥Ã¥¸¤òÍøÍѤ·¤è¤¦¤È¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï IPFIREWALL ¥ª¥×¥·¥ç¥ó¤â»ØÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ ¥Ö¥ê¥Ã¥¸¤ò¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ë¤È¤·¤ÆÀßÄꤹ¤ëºÝ¤Î°ìÈÌŪ¤Ê¾ðÊó¤Ë´Ø¤·¤Æ¤Ï¡¢ 項15.7 ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£

IP °Ê³°¤Î¥Ñ¥±¥Ã¥È (ARP ¤Ê¤É) ¤¬¥Ö¥ê¥Ã¥¸¤òÄ̲᤹¤ë¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ë¤Ï¡¢ ¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ëÍÑ¥ª¥×¥·¥ç¥ó¤òÀßÄꤷ¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ ¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï IPFIREWALL_DEFAULT_TO_ACCEPT ¤Ç¤¹¡£¤³¤ÎÊѹ¹¤Ë¤è¤ê¡¢ ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ë¤¬¤¹¤Ù¤Æ¤Î¥Ñ¥±¥Ã¥È¤ò¼õ¤±Æþ¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ ¤³¤ÎÀßÄê¤ò¹Ô¤¦Á°¤Ë¡¢ ¤³¤ÎÊѹ¹¤¬¼«Ê¬¤Î¥ë¡¼¥ë¥»¥Ã¥È¤Ë¤É¤Î¤è¤¦¤Ê±Æ¶Á¤ò¤ª¤è¤Ü¤¹¤«¤òÇÄ°®¤·¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£

22.5.3.4. ÂÓ°èÀ©¸æµ¡Ç½

¥Ö¥ê¥Ã¥¸¤ÇÂÓ°èÀ©¸æµ¡Ç½¤òÍøÍѤ·¤¿¤¤¾ì¹ç¡¢ ¥«¡¼¥Í¥ë¥³¥ó¥Õ¥£¥°¥ì¡¼¥·¥ç¥ó¤Ç DUMMYNET ¥ª¥×¥·¥ç¥ó¤ò²Ã¤¨¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ ¾Ü¤·¤¤¾ðÊó¤Ë´Ø¤·¤Æ¤Ï dummynet(4) ¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£

22.5.4. ¥Ö¥ê¥Ã¥¸¤òÍ­¸ú¤Ë¤¹¤ë

¥Ö¥ê¥Ã¥¸¤òÍ­¸ú¤Ë¤¹¤ë¤Ë¤Ï¡¢ /etc/sysctl.conf ¤Ë°Ê²¼¤Î¹Ô¤ò²Ã¤¨¤Æ¤¯¤À¤µ¤¤¡£

net.link.ether.bridge=1

»ØÄꤷ¤¿¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ç¥Ö¥ê¥Ã¥¸¤ò²Äǽ¤Ë¤¹¤ë¤Ë¤Ï°Ê²¼¤ò²Ã¤¨¤Æ¤¯¤À¤µ¤¤¡£

net.link.ether.bridge_cfg=if1,if2

(if1 ¤ª¤è¤Ó if2 ¤ÏÆó¤Ä¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Î̾Á°¤ËÃÖ¤­´¹¤¨¤Æ¤¯¤À¤µ¤¤)¡£ ¥Ö¥ê¥Ã¥¸¤ò·Ðͳ¤·¤¿¥Ñ¥±¥Ã¥È¤ò ipfw(8) ¤Ç¥Õ¥£¥ë¥¿¤·¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢ °Ê²¼¤Î¹Ô¤âÉÕ¤±²Ã¤¨¤ëɬÍפ¬¤¢¤ê¤Þ¤¹

net.link.ether.bridge_ipfw=1

FreeBSD 5.2-RELEASE °Ê¹ß¤Ç¤Ï¡¢¤«¤ï¤ê¤Ë°Ê²¼¤Î¹Ô¤ò»ÈÍѤ·¤Æ¤¯¤À¤µ¤¤¡£

net.link.ether.bridge.enable=1
 net.link.ether.bridge.config=if1,if2
 net.link.ether.bridge.ipfw=1

22.5.5. ¤½¤Î¾¤Î¾ðÊó

¥Í¥Ã¥È¥ï¡¼¥¯¤«¤é¥Ö¥ê¥Ã¥¸¤Ë telnet(1) ¤·¤¿¤¤¾ì¹ç¡¢ ¥Í¥Ã¥È¥ï¡¼¥¯¥«¡¼¥É¤Î°ì¤Ä¤Ë IP ¥¢¥É¥ì¥¹¤ò³ä¤êÅö¤Æ¤ë¤Î¤¬Àµ¤·¤¤¤Ç¤¹¡£ °ìÈÌŪ¤Ë¡¢Î¾Êý¤Î¥«¡¼¥É¤Ë IP ¥¢¥É¥ì¥¹¤ò³ä¤êÅö¤Æ¤ë¤Î¤Ï¤è¤¤¹Í¤¨¤Ç¤Ï¤Ê¤¤¤È¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

¥Í¥Ã¥È¥ï¡¼¥¯Æâ¤ËÊ£¿ô¤Î¥Ö¥ê¥Ã¥¸¤òÀßÃÖ¤¹¤ë¾ì¹ç¡¢ Ǥ°Õ¤Î¥ï¡¼¥¯¥¹¥Æ¡¼¥·¥ç¥ó´Ö¤Ç°ì¤Ä°Ê¾å¤Î·ÐÏ©¤ò»ý¤Ä¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£ µ»½ÑŪ¤Ë¤Ï¡¢ ¤³¤ì¤Ï¥¹¥Ñ¥Ë¥ó¥°¥Ä¥ê¡¼¤Î¥ê¥ó¥¯À©¸æ¤Ï¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¡¢ ¤È¤¤¤¦¤³¤È¤ò°ÕÌ£¤·¤Þ¤¹¡£

¥Ö¥ê¥Ã¥¸¤Ï¡¢ping(8) ¤Ë¤«¤«¤ë»þ´Ö¤òÃ٤餻¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£Æäˡ¢ °ìÊý¤Î¥»¥°¥á¥ó¥È¤«¤é¤â¤¦°ìÊý¤Ø¤Î¥È¥é¥Õ¥£¥Ã¥¯¤Ç¤½¤¦¤Ê¤ê¤Þ¤¹¡£

ËÜʸ½ñ¡¢¤ª¤è¤Ó¾¤Îʸ½ñ¤Ï ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/ ¤«¤é¥À¥¦¥ó¥í¡¼¥É¤Ç¤­¤Þ¤¹¡£

FreeBSD ¤Ë´Ø¤¹¤ë¼ÁÌ䤬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢¥É¥­¥å¥á¥ó¥È ¤òÆɤó¤À¾å¤Ç <questions@FreeBSD.org> ¤Þ¤Ç (±Ñ¸ì¤Ç) Ï¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£
ËÜʸ½ñ¤Ë´Ø¤¹¤ë¼ÁÌä¤Ë¤Ä¤¤¤Æ¤Ï¡¢<doc@FreeBSD.org> ¤Þ¤ÇÅŻҥ᡼¥ë¤ò (±Ñ¸ì¤Ç) Á÷¤Ã¤Æ¤¯¤À¤µ¤¤¡£