linuxÐéÄâ»úÔõôÅþÁ¬ÍøÂç
linux ÐéÄâ»úÍøÂçÅþÁ¬°ì·¨£ºÑ¡ÔñÍøÂçģʽ£¨ÇŽӡ¢nat£©ÉèÖÃÍøÂçÊÊÅäÆ÷ÉèÖà ip µØµã£¨ÇŽӣºdhcp ×Ô¶¯·ÖÅÉ£¬nat£ºÊÖ¶¯Ö¸¶¨£©ÉèÖà dns£¨ÐÞ¸Ä /etc/resolv.conf Îļþ£©²âÊÔÅþÁ¬£¨ping Ö¸¶¨ ip µØµã»òÓòÃû£©
Linux ÐéÄâ»úÔõÑùÅþÁ¬ÍøÂç
ÔÚ Linux ÐéÄâ»úÉÏÅþÁ¬µ½ÍøÂçÊÇÔËÐкÍÖÎÀíÐéÄâ»úµÄÒªº¦°ì·¨Ö®Ò»¡£ÒÔÏÂÊǽ¨ÉèÍøÂçÅþÁ¬µÄ°ì·¨£º
1. Ñ¡ÔñÍøÂçģʽ
Ê×ÏÈ£¬ÄãÐèҪѡÔñÐéÄâ»úµÄÍøÂçģʽ¡£³£¼ûģʽ°üÀ¨£º
ÇŽÓģʽ£ºÐéÄâ»úʹÓÃÓëÖ÷»úÏàͬµÄÍøÂçÊÊÅäÆ÷£¬»ñµÃ×Ô¼ºµÄ IP µØµã²¢Ö±½ÓÓëÆäËûÍøÂç×°±¸Í¨Ñ¶¡£
NAT ģʽ£ºÐéÄâ»úʹÓÃÖ÷»ú×÷ΪÍø¹Ø£¬»ñµÃÒ»¸öÓÉÖ÷»ú·ÖÅɵÄ˽ÓÐ IP µØµã¡£
2. ÉèÖÃÍøÂçÊÊÅäÆ÷
Íê³ÉģʽѡÔñºó£¬ÄãÐèÒªÉèÖÃÐéÄâ»úµÄÍøÂçÊÊÅäÆ÷¡£Õâ¿ÉÒÔͨ¹ýÐéÄâ»úÖÎÀíÆ÷µÄÉèÖýçÃæÀ´Íê³É¡£
ÇŽÓģʽ£ºÎÞÐè¾ÙÐÐÌØÊâÉèÖã¬ÐéÄâ»ú½«×Ô¶¯»ñÈ¡Ö÷»úÍøÂçµÄ IP µØµã¡£
NAT ģʽ£ºÐèÒªÔÚÖ÷»úÉÏÆôÓà IP ת·¢²¢ÎªÐéÄâ»ú·ÖÅÉÒ»¸ö¾²Ì¬ IP µØµã¡£
3. ÉèÖà IP µØµã
ÍøÂçÊÊÅäÆ÷ÉèÖÃÍê³Éºó£¬ÄãÐèҪΪÐéÄâ»úÉèÖÃÒ»¸ö IP µØµã¡£Õâ¿ÉÒÔͨ¹ýÐéÄâ»úÄÚµÄÍøÂçÉèÖþÙÐÐÉèÖãº
ÇŽÓģʽ£ºÍ¨³£ÓÉ DHCP ×Ô¶¯·ÖÅÉ¡£
NAT ģʽ£ºÐèÒªÊÖ¶¯Ö¸¶¨¾²Ì¬ IP µØµã¡£
4. ÉèÖÃ DNS
³ýÁË IP µØµã£¬Ä㻹ÐèÒªÉèÖà DNS ÒÔ±ãÐéÄâ»ú¿ÉÒÔÆÊÎöÓòÃû¡£Õâ¿ÉÒÔͨ¹ýÐÞ¸Ä /etc/resolv.conf ÎļþÀ´Íê³É¡£
5. ²âÊÔÅþÁ¬
ÉèÖÃÍê³Éºó£¬Ê¹Óà ping ÏÂÁî²âÊÔÐéÄâ»úÓëÖ÷»ú»òÆäËûÍøÂç×°±¸µÄÅþÁ¬£º
ping <ip></ip>
µÇ¼ºó¸´ÖÆ
ÈôÊÇ ping ͨ£¬ÔòÍøÂçÅþÁ¬ÒÑÀֳɽ¨Éè¡£
ÆäËûÌáÐÑ£º
ÈôÊÇÅþÁ¬·ºÆðÎÊÌ⣬Çë¼ì²éÐéÄâ»úÖÎÀíÆ÷µÄÍøÂçÉèÖá¢ÍøÂçÊÊÅäÆ÷ÉèÖúͷÀ»ðǽ¹æÔò¡£
¹ØÓڸ߼¶ÍøÂçÐèÇó£¬ÀýÈçÉèÖÃÐéÄâ»úÖ®¼äµÄÍøÂ硢·ÓÉ»ò DHCP ЧÀÍÆ÷£¬¿ÉÄÜÐèÒª¸üÖØ´óµÄÉèÖá£
ÒÔÉϾÍÊÇlinuxÐéÄâ»úÔõôÅþÁ¬ÍøÂçµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡