linuxÖеÄnetworkÊÇʲôÒâ˼
linuxÖеÄnetworkÊÇÒ»ÖÖÍøÂçÖÎÀí¹¤¾ßµÄÒâ˼£¬network¿ØÖÆÍøÂç½Ó¿ÚÉèÖÃÐÅÏ¢Ð޸ĺó£¬ÍøÂçЧÀͱØÐèÖØÐÂÆô¶¯£¬À´¼¤»îÍøÂçÐÂÉèÖ㬴ӶøʹµÃÉèÖÃÉúЧ£¬¿ØÖƾ籾ÊÇ¡°/etc/init.d/network¡±Îļþ£¬¿ÉÒÔÔÚ¸ÃÎļþºóÃæ¼ÓÉÏÖ¸¶¨µÄ²ÎÊýÀ´²Ù×÷ÍøÂçЧÀÍ¡£
±¾ÎIJÙ×÷ÇéÐΣºlinux 6.4.3ϵͳ¡¢DELL G3µçÄÔ¡£
linuxÖÐnetworkÊÇÒ»ÖÖÍøÂçÖÎÀí¹¤¾ß
LinuxÏÖÔÚÌṩÁ½ÖÖÍøÂçÖÎÀí¹¤¾ß£¬Ò»ÖÖÊÇnetwork£¬Ò»ÖÖÊÇNetworkManager¡£
network
networkÊÇ¿ØÖÆÍøÂç½Ó¿ÚÉèÖÃÐÅÏ¢Ð޸ĺó£¬ÍøÂçЧÀͱØÐèÖØÐÂÆô¶¯£¬À´¼¤»îÍøÂçÐÂÉèÖ㬴ӶøʹµÃÉèÖÃÉúЧ¡£Õⲿ·Ö²ÙÞÏÞεóÄÑЧÀͶøÑÔºÍÖØÐÂÆô¶¯ÏµÍ³Ê±ÊÇÒ»ÑùµÄ×÷Ó᣿ØÖƾ籾ÊÇ/etc/init.d/networkÕâ¸öÎļþ£¬¿ÉÒÔÓÃÕâ¸öÎļþºóÃæ¼ÓÉÏÏÂÃæµÄ²ÎÊýÀ´²Ù×÷ÍøÂçЧÀÍ¡£
ÀýÈ磺
/etc/init.d/network restart /etc/init.d/network restart
µÇ¼ºó¸´ÖÆ
ͬÑùÒ²¿ÉÒÔÓÃserviceÕâ¸öÏÂÁîÀ´²Ù×÷ÍøÂçЧÀÍÀýÈ磺
service network restart service network restart
µÇ¼ºó¸´ÖÆ
NetworkManager
RHEL6ÐÂÔöÌíµÄÍøÂçÖÎÀí¹¤¾ß£¬¿ÉÓüì²âÍøÂç¡¢×Ô¶¯ÅþÁ¬ÍøÂçµÄ³ÌÐò¡£ÎÞÂÛÊÇÎÞÏßÕÕ¾ÉÓÐÏßÅþÁ¬£¬Ëü¶¼¿ÉÒÔÁîÄúÇáËÉÖÎÀí¡£¹ØÓÚÎÞÏßÍøÂç,ÍøÂçÖÎÀíÆ÷¿ÉÒÔ×Ô¶¯Çл»µ½×î¿É¿¿µÄÎÞÏßÍøÂ硣ʹÓÃÍøÂçÖÎÀíÆ÷µÄ³ÌÐò¿ÉÒÔ×ÔÓÉÇл»ÔÚÏߺÍÀëÏßģʽ¡£ÍøÂçÖÎÀíÆ÷¿ÉÒÔÓÅÏÈÑ¡ÔñÓÐÏßÍøÂç¡£ÍøÂçÖÎÀíÆ÷×î³õÓÉ Redhat ¹«Ë¾¿ª·¢£¬ÏÖÔÚÓÉ GNOME ÖÎÀí¡£
NetworkManager а汾Ôöǿװ±¸ÒÔ¼°ÐÒéµÄÖ§³Ö£¬NetworkManager ×îаæÓÐÒ»¸öȫеÄƯÁÁµÄ¿Í»§¶Ë½çÃænmtui¡£¡±nmtui¡± ÊÇ networkmanager µÄÒ»¸öͼÐλ¯Ç°¶Ë¡£ÔÚûÓÐX Window µÄÇéÐÎÏ¿ÉÒÔÓÃËüÀ´Àû±ãµØÉèÖü°ÖÎÀíÍøÂç¡£Æô¶¯nmtui£º
[root@localhost ~]# nmtui
µÇ¼ºó¸´ÖÆ
Linux²Ù×÷ϵͳÊÇÒ»¸ö¿ªÔ´µÄ¡¢×ÔÓɵIJÙ×÷ϵͳ£¬Ëü¾ßÓм«¸ßµÄÎÞаÐԺͿɶ¨ÖÆÐÔ¡£ÔÚLinuxϵͳÖУ¬network¿ÉÒÔÔÚ²î±ðµÄ²ã¼¶¾ÙÐÐÖÎÀíºÍÉèÖã¬È·±£ÏµÍ³Äܹ»×¼È·µØÅþÁ¬ºÍÓëÆäËûÅÌËã»ú¾ÙÐÐͨѶ¡£
Ê×ÏÈ£¬ÔÚÎïÀí²ã¼¶£¬networkÊÇÖ¸ÅÌËã»úÖ®¼ä¾ÙÐÐͨѶËùʹÓõÄÏÖʵӲ¼þ×°±¸£¬ÈçÍø¿¨¡¢ÍøÏߺÍÎÞÏßÊÊÅäÆ÷¡£ÕâЩӲ¼þ×°±¸ÈÏÕ潫Êý¾Ý´«Êäµ½ÍøÂçÖУ¬²¢Í¨¹ýÎïÀíÅþÁ¬ÊµÏÖ×°±¸Ö®¼äµÄͨѶ¡£
ÔÚÊý¾ÝÁ´Â·²ã¼¶£¬network°üÀ¨ÍøÂç½Ó¿Ú¿¨£¨NIC£©µÄÇý¶¯³ÌÐòºÍÍøÂçÐÒ飨ÈçÒÔÌ«ÍøÐÒ飩µÄʵÏÖ¡£ÔÚÕâÒ»²ã¼¶ÉÏ£¬networkͨ¹ýMACµØµã£¨Ã½Ìå»á¼û¿ØÖƵص㣩½«Êý¾Ý°üÖ±½Ó·¢Ë͵½Ä¿µÄ×°±¸¡£
ÔÚÍøÂç²ã¼¶£¬network°üÀ¨IP£¨Internet Protocol£©µØµãºÍ·ÓÉÐÒéµÄʵÏÖ¡£IPµØµãÊÇÓÃÓÚΨһ±êʶÍøÂçÖеÄ×°±¸µÄµØµã£¬ËüÔÊÐíÊý¾Ýͨ¹ý»¥ÁªÍø´«Ê䵽׼ȷµÄÄ¿µÄ×°±¸¡£Óë´Ëͬʱ£¬Â·ÓÉÐÒéÑ°ÕÒ²¢È·¶¨Ãü¾Ý°üµÄ×î¼Ñ·¾¶£¬È·±£Êý¾Ý°üÄܹ»ÔÚ¶à¸öÍøÂçÖ®¼ä׼ȷµØ´«Êä¡£
ÔÚ´«Êä²ã¼¶£¬network°üÀ¨´«Êä¿ØÖÆÐÒ飨TCP£©ºÍÓû§Êý¾Ý±¨ÐÒ飨UDP£©µÄʵÏÖ¡£TCPÌṩ¿É¿¿µÄ¡¢ÃæÏòÅþÁ¬µÄÊý¾Ý´«ÊäЧÀÍ£¬È·±£Êý¾Ý°üµÄÓÐÐòµÖ´ïºÍ¹ýʧ¼ì²â¡£UDPÔòÌṩÁËÎÞÅþÁ¬µÄ´«ÊäЧÀÍ£¬ÊÊÓÃÓÚʵʱӦÓóÌÐò»òÐèÒª½ÏµÍµÄÑÓ³ÙµÄÇéÐΡ£
×îºó£¬ÔÚÓ¦Óò㼶£¬networkÌṩÁËÖÖÖÖЧÀͺÍÐÒ飬ÈçHTTP¡¢FTP¡¢SMTPºÍSSHµÈ¡£ÕâЩÐÒéÔÊÐíÓû§ÔÚÍøÂçÉϾÙÐÐÎļþ´«Êä¡¢µç×ÓÓʼþ·¢ËͺÍÎüÊÕÒÔ¼°Ô¶³Ì»á¼ûµÈÔ˶¯¡£
À©Õ¹ÖªÊ¶
LinuxÍøÂçÖÎÀí»ù´¡ÖªÊ¶
NetworkManager ×îаæµÄ×î´óÌØÕ÷£º ÏÂÁîÐй¤¾ßÏÂÁһ¸öNetworkManagerµÄÏÂÁîÐнӿڡ£NetworkManagerµÄCLI¹¤¾ßnmcli£¬Ê¹ÓÃnmcliÓû§¿ÉÒÔÅÌÎÊÍøÂçÅþÁ¬µÄ״̬£¬Ò²¿ÉÒÔÓÃÀ´ÖÎÀí¡£Óŵ㣺Ôʼ£»Óï·¨Ïà¶Ô¼òÆÓ£»ÔÚCLIÖÐʹÓÃNetworkManagerºÜÈÝÒ×ÕÆÎÕ¡£
nmcliµÄ»ù±¾ÉèÖÃÑ¡Ïî
nmcli con show #»ñµÃÒ»·ÝUUIDÁбí nmcli dev #Éó²éÍøÂç×°±¸¼°Æä״̬ nmcli r wifi off #¹Ø±ÕWiFi nmcli con show #»ñµÃÒ»·ÝUUIDÁбí nmcli dev #Éó²éÍøÂç×°±¸¼°Æä״̬ nmcli r wifi off #¹Ø±ÕWiFi
µÇ¼ºó¸´ÖÆ
NetworkManagerÊØ»¤Àú³ÌÆô¶¯ºó£¬»á×Ô¶¯ÅþÁ¬µ½ÒѾÉèÖõÄϽµµÍ¬½Ó¡£Óû§ÅþÁ¬»òδÉèÖõÄÅþÁ¬ÐèҪͨ¹ýnmcli»ò×À
ÒÔÉϾÍÊÇlinuxÖеÄnetworkÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡