使用Vmware虚拟机Linux配置固定IP地址教程
1銆佺偣鍑荤紪杈-铏氭嫙缃戠粶缂栬緫鍣
2銆佺偣鍑绘洿鏀硅缃佷慨鏀硅櫄鎷熺綉缁滈厤缃櫒骞剁‘璁や繚瀛橈紙瑙佸浘锛
3銆佹墦寮璁剧疆鈥滅綉缁滃拰Internet鈥濓紝鐐瑰嚮鈥滄洿鏀归傞厤鍣ㄩ夐」鈥濓紝鐐瑰嚮閫傞厤鍣╒Mnet8锛屼慨鏀笽P鍜孌NS鐩稿叧閰嶇疆
4銆佽繘鍏ヨ櫄鎷熸満锛岃缃浐瀹欼P鍦板潃
root鐢ㄦ埛鐧诲綍铏氭嫙鏈猴紝杈撳叆鍛戒护锛
vi /etc/sysconfig/network-scripts/ifcfg-eth0
鎸夊涓嬩慨鏀归厤缃紝闇瑕佹敼涓涓嬪浘涓湀鍑虹殑閰嶇疆閮ㄥ垎
IPADDR锛氶渶瑕佽缃殑铏氭嫙鏈哄浐瀹欼P銆傚彲鎸夊浘璁剧疆锛堟IP灏辨槸缁欒櫄鎷熸満璁剧疆鐨勫浐瀹欼P锛屽皢鏉SH绛夋搷浣滈兘鍙互閫氳繃杩欎釜IP杩炴帴鍒拌櫄鎷熸満锛夈
NETMASK銆丟ATEWAY鎸夊浘璁剧疆鍗冲彲銆
HWADDR锛氳櫄鎷熸満MAC鍦板潃锛堝繀椤讳慨鏀癸級銆傝櫄鎷熸満璁剧疆涓彲鏌ョ湅锛
5銆閲嶅惎铏氭嫙鏈
6銆佸埌姝ゅ凡鍏ㄩ儴閰嶇疆瀹屾垚锛
杈撳叆鍛戒护锛屾煡鐪嬪浐瀹欼P鏄惁璁剧疆鎴愬姛
鈥嬧嬧嬧嬧嬧嬧媔p addr
鍥哄畾IP涓洪厤缃殑192.168.188.100锛屼慨鏀规垚鍔熴
ping涓涓嬶紝澶у姛鍛婃垚銆
7銆佸鏋滄墽琛屽懡浠ら亣鍒颁互涓嬮棶棰
ping baidu.com
杩斿洖锛歱ing: baidu.com: Name or service not known
瑙e喅鏂规硶鏄慨鏀硅櫄鎷熸満DNS锛屾寜浠ヤ笅鎿嶄綔杩涜
鎵ц鍛戒护锛屼慨鏀笵NS閰嶇疆鏂囦欢锛
vi /etc/resolv.conf
娣诲姞浠ヤ笅鍐呭骞朵繚瀛
nameserver 8.8.8.8
鎵ц鍛戒护閲嶅惎缃戠粶锛岄棶棰樿В鍐
service network restart
2銆佺偣鍑绘洿鏀硅缃佷慨鏀硅櫄鎷熺綉缁滈厤缃櫒骞剁‘璁や繚瀛橈紙瑙佸浘锛
3銆佹墦寮璁剧疆鈥滅綉缁滃拰Internet鈥濓紝鐐瑰嚮鈥滄洿鏀归傞厤鍣ㄩ夐」鈥濓紝鐐瑰嚮閫傞厤鍣╒Mnet8锛屼慨鏀笽P鍜孌NS鐩稿叧閰嶇疆
4銆佽繘鍏ヨ櫄鎷熸満锛岃缃浐瀹欼P鍦板潃
root鐢ㄦ埛鐧诲綍铏氭嫙鏈猴紝杈撳叆鍛戒护锛
vi /etc/sysconfig/network-scripts/ifcfg-eth0
鎸夊涓嬩慨鏀归厤缃紝闇瑕佹敼涓涓嬪浘涓湀鍑虹殑閰嶇疆閮ㄥ垎
- DEVICE=eth0
- BOOTPROTO=static
- HWADDR=00:0C:29:ec:28:03
- IPV6INIT=yes
- NM_CONTROLLED=yes
- ONBOOT=yes
- TYPE=Ethernet
- UUID=7a47775a-8bca-4daf-80b4-965da12756a8
- IPADDR=192.168.188.100
- NETMASK=255.255.255.0
-
- GATEWAY=192.168.188.1
IPADDR锛氶渶瑕佽缃殑铏氭嫙鏈哄浐瀹欼P銆傚彲鎸夊浘璁剧疆锛堟IP灏辨槸缁欒櫄鎷熸満璁剧疆鐨勫浐瀹欼P锛屽皢鏉SH绛夋搷浣滈兘鍙互閫氳繃杩欎釜IP杩炴帴鍒拌櫄鎷熸満锛夈
NETMASK銆丟ATEWAY鎸夊浘璁剧疆鍗冲彲銆
HWADDR锛氳櫄鎷熸満MAC鍦板潃锛堝繀椤讳慨鏀癸級銆傝櫄鎷熸満璁剧疆涓彲鏌ョ湅锛
5銆閲嶅惎铏氭嫙鏈
6銆佸埌姝ゅ凡鍏ㄩ儴閰嶇疆瀹屾垚锛
杈撳叆鍛戒护锛屾煡鐪嬪浐瀹欼P鏄惁璁剧疆鎴愬姛
鈥嬧嬧嬧嬧嬧嬧媔p addr
鍥哄畾IP涓洪厤缃殑192.168.188.100锛屼慨鏀规垚鍔熴
ping涓涓嬶紝澶у姛鍛婃垚銆
7銆佸鏋滄墽琛屽懡浠ら亣鍒颁互涓嬮棶棰
ping baidu.com
杩斿洖锛歱ing: baidu.com: Name or service not known
瑙e喅鏂规硶鏄慨鏀硅櫄鎷熸満DNS锛屾寜浠ヤ笅鎿嶄綔杩涜
鎵ц鍛戒护锛屼慨鏀笵NS閰嶇疆鏂囦欢锛
vi /etc/resolv.conf
娣诲姞浠ヤ笅鍐呭骞朵繚瀛
nameserver 8.8.8.8
鎵ц鍛戒护閲嶅惎缃戠粶锛岄棶棰樿В鍐
service network restart