ÔõÑùÔÚLinuxÉÏÉèÖÃÍøÂç½Ó¿Ú
ÔõÑùÔÚlinuxÉÏÉèÖÃÍøÂç½Ó¿Ú
ÍøÂç½Ó¿ÚÊÇÅÌËã»úϵͳÖеÄÒ»¸öÖ÷Òª×é³É²¿·Ö£¬ËüÈÏÕæÅþÁ¬ÅÌËã»úÓëÍøÂçÖ®¼äµÄͨѶ¡£ÔÚLinuxϵͳÖÐÉèÖÃÍøÂç½Ó¿ÚÊǷǾ³£¼ûµÄʹÃü£¬±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlinuxÉÏÉèÖÃÍøÂç½Ó¿ÚµÄÒªÁ죬²¢¸½´ø´úÂëʾÀý¡£
¼ì²éÍøÂç½Ó¿ÚµÄ״̬
ÔÚ×îÏÈÉèÖÃÍøÂç½Ó¿Ú֮ǰ£¬Ê×ÏÈÐèÒª¼ì²éÄ¿½ñϵͳÖеÄÍøÂç½Ó¿Ú״̬¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´Éó²éÄ¿½ñϵͳÖеÄÍøÂç½Ó¿ÚÐÅÏ¢£º
$ ifconfig
µÇ¼ºó¸´ÖÆ
Õâ¸öÏÂÁÏÔʾĿ½ñϵͳÖÐËùÓеÄÍøÂç½Ó¿Ú¼°ÆäÏà¹ØÐÅÏ¢£¬ÀýÈç½Ó¿ÚÃû³Æ¡¢IPµØµã¡¢×ÓÍøÑÚÂëµÈ¡£Æ¾Ö¤ÐèÒªÕÒµ½ÄãÏëÒªÉèÖõÄÍøÂç½Ó¿Ú¡£
ÉèÖÃÍøÂç½Ó¿Ú
ÔÚLinuxÖУ¬¿ÉÒÔʹÓÃifconfigÏÂÁîÀ´ÔÝʱÉèÖÃÒ»¸öÍøÂç½Ó¿Ú¡£ÒÔÏÂÊÇÒ»¸ö³£¼ûµÄʾÀý£¬¸ÃÏÂÁÉèÖÃÒ»¸öÃûΪeth0µÄ½Ó¿Ú£¬ÉèÖÃIPµØµãΪ192.168.0.1£¬×ÓÍøÑÚÂëΪ255.255.255.0£º
$ ifconfig eth0 192.168.0.1 netmask 255.255.255.0
µÇ¼ºó¸´ÖÆ
´ËÏÂÁîÉèÖÃÁ˽ӿڵÄIPµØµãºÍ×ÓÍøÑÚÂë¡£ÈôÊÇûÓÐÖ¸¶¨×ÓÍøÑÚÂ룬ÔòĬÈÏʹÓÃ255.255.255.0¡£
ÉèÖÃĬÈÏÍø¹Ø
ÈôÊÇÐèÒª½«Ìض¨µÄÍøÂç½Ó¿Ú×÷ΪĬÈÏÍø¹Ø£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¾ÙÐÐÉèÖãº
$ route add default gw 192.168.0.254
µÇ¼ºó¸´ÖÆ
ÉÏÊöÏÂÁ½«ÉèÖÃĬÈÏÍø¹ØΪ192.168.0.254¡£ÕâÊÇÒ»¸ö³£¼ûµÄÉèÖã¬ÓÃÓÚÖ¸¶¨Òª·¢ËÍËùÓзÇÍâµØÁ÷Á¿µÄÍø¹ØµØµã¡£
DNSЧÀÍÆ÷
ÔÚÉèÖÃÍøÂç½Ó¿Úʱ£¬»¹ÐèҪ˼Á¿DNSЧÀÍÆ÷µÄÉèÖã¬ÒÔ±ãÅÌËã»ú¿ÉÒÔͨ¹ýÓòÃûÆÊÎöÀ´»á¼û»¥ÁªÍø¡£ÔÚLinuxϵͳÖУ¬¿ÉÒÔͨ¹ýÐÞ¸Ä/etc/resolv.confÎļþÀ´ÉèÖÃDNSЧÀÍÆ÷¡£
¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî·¿ª¸ÃÎļþ£º
$ sudo vi /etc/resolv.conf
µÇ¼ºó¸´ÖÆ
ÔÚ·¿ªµÄ±à¼Æ÷ÖУ¬Ìí¼ÓÒÔÏÂÐÐÀ´ÉèÖÃDNSЧÀÍÆ÷£º
nameserver 8.8.8.8 nameserver 8.8.4.4
µÇ¼ºó¸´ÖÆ
ÉÏÊöʾÀý½«ÉèÖÃÁ½¸öGoogleµÄ¹«¹²DNSЧÀÍÆ÷×÷ΪϵͳµÄDNSЧÀÍÆ÷¡£¿ÉÒÔƾ֤ÐèÒªÌí¼ÓÆäËûDNSЧÀÍÆ÷¡£
ÓÀÊÀÉèÖÃÍøÂç½Ó¿Ú
ÒÔÉÏʾÀýÖеÄÉèÖÃÊÇÔÝʱµÄ£¬ÔÚϵͳÖØÐÂÆô¶¯ºó»áɥʧ¡£ÈôÊÇÏ£ÍûÔÚϵͳÆô¶¯Ê±±£´æÕâЩÉèÖã¬ÔòÐèÒª½«ËüÃÇÌí¼Óµ½ÍøÂçÉèÖÃÎļþÖС£
ÔÚ´ó´ó¶¼Linux¿¯ÐаæÖУ¬ÍøÂç½Ó¿ÚµÄÉèÖÃÎļþλÓÚ/etc/network/interfaces¡£Ê¹ÓÃÒÔÏÂÏÂÁî·¿ª¸ÃÎļþ¾ÙÐб༣º
$ sudo vi /etc/network/interfaces
µÇ¼ºó¸´ÖÆ
ÔÚÎļþĩβÌí¼ÓÒÔÏÂÄÚÈÝ£º
auto eth0 iface eth0 inet static address 192.168.0.1 netmask 255.255.255.0 gateway 192.168.0.254 dns-nameservers 8.8.8.8 8.8.4.4
µÇ¼ºó¸´ÖÆ
ÉÏÊöʾÀý½«ÉèÖÃeth0½Ó¿ÚµÄIPµØµã¡¢×ÓÍøÑÚÂ롢ĬÈÏÍø¹ØºÍDNSЧÀÍÆ÷¡£¿ÉÒÔƾ֤ÏÖÕæÏàÐξÙÐÐÐ޸ġ£ÉúÑÄÎļþºó£¬ÖØÆôϵͳÒÔʹÉèÖÃÉúЧ¡£
×ܽá
±¾ÎÄÏÈÈÝÁËÔÚLinuxϵͳÉÏÉèÖÃÍøÂç½Ó¿ÚµÄÒªÁ죬²¢ÌṩÁËÏà¹ØµÄ´úÂëʾÀý¡£ÉèÖÃÍøÂç½Ó¿ÚÊÇLinuxϵͳÖÎÀíÖеij£¼ûʹÃü£¬ÕÆÎÕÕâЩ»ù±¾²Ù×÷¹ØÓÚÍøÂçÉèÖúÍÅþÁ¬ÖÁ¹ØÖ÷Òª¡£Ï£Íû¶ÁÕßͨ¹ý±¾ÎĵÄÖ¸µ¼Äܹ»¸üºÃµØÉèÖúÍÖÎÀíLinuxϵͳÖеÄÍøÂç½Ó¿Ú¡£
ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖÃÍøÂç½Ó¿ÚµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡