A. linux自動獲取的IP如何查看
如果是想自動獲取ip需要修改一下配置文件,我懷疑你的配置文件沒有把配置文件設置成回自動獲取ip你要先在命答令行下執行vi /etc/sysconfig/network-scripts/ifcfg-eth0 看看裡面有沒有一個 BOOTPROTO=dhcp 如果不是需要修改或在第二行添加此信息。添加後退出編輯 然後在命令行執行ifdown eth0 ,再ifup eth0 。啟動網口後 你再ifconfig 試試保證就能查在第二行看到你自動獲取的ip解決了別忘採納~
B. linux涓繪満ip鎬庢牱鏌linux涓繪満ip
securecrt涓繪満鍚嶆槸浠涔堬紵
涓繪満鍚嶏紙hostname錛夊~鍐橪inux涓繪満鐨処P鍦板潃鎴栧煙鍚嶇鍙e彿錛坧ort錛夊~鍐橪inux涓繪満榪炴帴鐨勭鍙e彿錛屼竴鑸涓22鐢ㄦ埛鍚嶏紙username錛夊~鍐橪inux
linux涓鍔ㄦ佸垎閰嶢p鍦板潃鐨勫懡浠ゆ槸錛
linux鍔ㄦ佽幏鍙栨垨閲婃斁IP鍦板潃鍛戒護錛歞hclient
dhclient鍛戒護浣跨敤鍔ㄦ佷富鏈洪厤緗鍗忚鍔ㄦ佺殑閰嶇疆緗戠粶鎺ュ彛鐨勭綉緇滃弬鏁般
璇娉
dhclient(閫夐」)(鍙傛暟)
閫夐」
0錛氭寚瀹歞hcp瀹㈡埛絝鐩戝惉鐨勭鍙e彿錛
-d錛氭繪槸浠ュ墠鍙版柟寮忚繍琛岀▼搴忥紱
-q錛氬畨闈欐ā寮忥紝涓嶆墦鍗頒換浣曢敊璇鐨勬彁紺轟俊鎮錛
-r錛氶噴鏀緄p鍦板潃銆
鍙傛暟
緗戠粶鎺ュ彛錛氭搷浣滅殑緗戠粶鎺ュ彛銆
瀹炰緥
dhclient-r#閲婃斁IP
dhclient#鑾峰彇IP
linux閰嶇疆BMCip鍦板潃鍜宒ns錛
涓.閰嶇疆IP鍦板潃
1銆佹壘鍑虹綉鍗″悕縐
緇堢涓婅緭鍏ifconfig錛堟垨鑰卛paddr錛夛紝榪欓噷鐨勭綉鍗″悕鏄痚th0銆
鍙浠ョ湅鍒拌︾粏鐨勭綉鍗′俊鎮錛屽寘鎷緗戝崱綾誨瀷錛堜互澶緗戠綉鍗★級錛岀‖浠跺湴鍧錛孖P鍦板潃錛孖P騫挎挱鍦板潃錛屽瓙緗戞帺鐮佺瓑銆傛垜浠瑕佹敞鎰忎袱涓鍐呭癸紝絎涓錛歩netaddr:xxx.xxx.xxx.xxx錛堣繖鏄疘PV4鍦板潃錛塱net6addr:xxxxxxxxxxxxxxx(榪欐槸IPV6鍦板潃)錛
絎浜屾垜浠瑕佹敞鎰弇ask鍚庨潰鐨勫唴瀹癸細xxx.xxx.xxx.xxx榪欐槸瀛愮綉鎺╃爜銆
2銆佽繘鍏ラ厤緗鐩褰曪紝鎵懼嚭瀵瑰簲緗戝崱閰嶇疆鏂囦歡
cd/etc/sysconfig/network-scripts/
ls
鎴戜滑鍙浠ョ湅鍒版垜浠鐨別th0鐨勯厤緗鏂囦歡鏄痠fcfg-eth0
3銆佺紪杈戦厤緗鏂囦歡
鍙浠ョ湅鍒幫紝榪欓噷浣跨敤鐨勬槸dhcp鑷鍔ㄨ幏鍙朓P鍦板潃錛堝洜涓築OOTPROTO鐨勫弬鏁頒負dhcp錛
BOOTPROTO鎺ュ彈3涓鍙傛暟錛歯one錛堢佹dhcp錛夛紝static(闈欐両P)錛宒hcp錛堣嚜鍔ㄨ幏鍙栵級
鎴戜滑闇瑕佸厛淇鏀笲OOTPROTO鐨勫弬鏁頒負static錛岀劧鍚庡壋寤轟袱涓鏂板弬鏁癐PADDR鍜孨ETMASK銆
渚嬪傛垜浠榪欓噷淇鏀笽P鍦板潃涓192.168.1.250錛屽瓙緗戞帺鐮佷負255.255.255.128
4銆侀噸鍚緗戠粶鏈嶅姟
鐢ㄥ懡浠や篃鍙浠,鏈淇濋櫓鐨勫氨鏄閲嶅惎鏈哄櫒錛坮eboot錛夈
systemctlrestartnetwork
鎴栬
servicenetworkrestart
鎴栬
/etc/init.d/networkrestart
鏌ョ湅ip鏄涓嶆槸宸茬粡鏀逛簡
緇堢涓婅緭鍏ifconfig銆傦紙鎴栬卛paddr鍛戒護錛
浜.閰嶇疆DNS
鏂規硶涓銆佷慨鏀圭綉鍗¢厤緗甶fcfg-eth0
#涓籇NS鏈嶅姟鍣
DNS1=218.85.157.99
#澶嘍NS鏈嶅姟鍣
DNS2=114.114.114.114
鎬庝箞鏀箄buntulinux鐨剗p鍦板潃錛
1銆佷慨鏀歸厤緗鏂囦歡/etc/network/interfaces
root@ubuntu:~#sudogedit/etc/network/interfaces
娣誨姞浠ヤ笅鍐呭癸細
autoeth0#璁劇疆鑷鍔ㄥ惎鍔╡th0鎺ュ彛
ifaceeth0inetstatic#閰嶇疆闈欐両
Paddress192.168.100.88#IP鍦板潃
netmask255.255.255.0#瀛愮綉鎺╃爜
gateway192.168.100.1#榛樿ょ綉鍏
2銆佷慨鏀笵NSsudogedit/etc/resolve.conf
nameserver127.0.0.1#璁板緱鍔犱笂nameserver8.8.8.8#褰撳湴dns鏈嶅姟鍣(鐢╥pconfig/all鏌ョ湅鏈鍦癲ns錛岀涓涓猟ns鏄榛樿ょ殑錛屽叡鏈2涓猟ns)
娉錛#鍚庨潰鐨勬敞閲婁俊鎮涓嶈佸姞榪涘幓銆
3銆侀噸鍚緗戠粶錛屼嬌閰嶇疆鐢熸晥sudo/etc/init.d/networkingrestart
4銆佹煡鐪媔p鏄鍚﹂厤緗鎴愬姛root@ubuntu:~#ifconfigeth0
Linkencap:EthernetHWaddr00:0c:21:2e:19:41inetaddr:192.168.100.88Bcast:192.168.100.255Mask:255.255.255.0
linux涓濡備綍鏀笽P錛
絎涓縐嶆柟寮忓氨鏄鍦ㄥ畨瑁呯殑鏃跺欏氨灝嗘湇鍔″櫒鐨処P鍦板潃閰嶇疆涓哄滻瀹氱殑IP鍦板潃錛岃繖鏍峰畨瑁呭ソ浠ュ悗灝變笉鐢ㄥ啀鍘諱慨鏀癸紝闈炲父鏂逛究銆傞栧厛鍚鍔ㄥ畨瑁呯▼搴忥紝寮濮嬪畨瑁咃紝絎涓姝ラ厤緗濂借璦錛岀劧鍚庤繘鍏ュ埌緋葷粺璁劇疆鐣岄潰銆
2鍦ㄧ郴緇熻劇疆鐣岄潰錛屽嵆system涓嬮潰錛屽彲浠ョ湅鍒頒竴涓狽etworkHostname鐨勯夐」錛屽彲浠ョ湅鍒伴粯璁ゆ槸disconnect錛岀偣榪涘幓浠ュ悗錛屽彲浠ョ湅鍒板瑰簲鐨勭綉鍗′篃鏄痮ff鐘舵併傜劧鍚庣偣鍑誨彸涓嬭掔殑configure榪涘叆緗戝崱璁劇疆鐣岄潰銆
3鍦ㄧ綉鍗¤劇疆鐣岄潰錛屽彲浠ョ湅鍒版湁涓狪Pv4settings錛岀偣鍑昏繖涓閫夐」鍗°傜偣榪涘幓鍙浠ョ湅鍒伴粯璁ょ殑璁劇疆鏄疉utomatic錛圖HCP錛夛紝涔熷氨鏄鑷鍔ㄨ幏鍙栫殑鎰忔濄
4鐐瑰嚮Method鍙寵竟鐨勪笅鎷夌澶達紝鍙浠ョ湅鍒版湁寰堝氶夐」銆傚傛灉瑕佽劇疆鍥哄畾IP錛屽垯鐐瑰嚮Manual銆傜劧鍚庡啀鐐瑰嚮涓嬮潰鐨刟dd鎸夐挳錛屽皢鍥哄畾鐨処P淇℃伅濉鍐欒繘鍘匯傞厤緗濂藉悗錛岀偣鍑誨彸涓嬭掔殑save鎸夐挳淇濆瓨閰嶇疆銆
5淇濆瓨濂藉悗錛屽洖鍒扮綉鍗$殑淇℃伅鐣岄潰錛岀偣鍑籵ff閭i噷錛屾妸瀹冨彉涓簅n錛岀劧鍚庡彲浠ョ湅鍒伴『鍒╄繛鎺ワ紝鐒跺悗鐐瑰嚮宸︿笂瑙掔殑Done錛屼繚瀛樿劇疆錛岀劧鍚庡洖鍒扮郴緇熷畨瑁呯晫闈錛岀偣鍑籦egaininstall緇х畫瀹夎呯郴緇熴
6絳夊埌緋葷粺瀹夎呭畬姣曞悗錛岀櫥闄嗙郴緇燂紝杈撳叆璐﹀彿瀵嗙爜銆傜劧鍚庝嬌鐢╥fconfig鍛戒護鏌ョ湅閰嶇疆鐨勭綉鍗′俊鎮錛屽彲浠ョ湅鍒幫紝紜瀹炲凡緇忔g『閰嶇疆錛屽備笅闈㈢涓寮犲浘鎵紺恆傜劧鍚庢垜浠鍐嶇敤ping鍛戒護鏉ユ嫻嬩竴涓嬶紝鍙浠ョ湅鍒拌兘澶焢ing閫氱櫨搴︾殑鍩熷悕錛岃存槑閰嶇疆宸茬粡鐢熸晥浜嗐
緙栬緫閰嶇疆鏂囦歡璁劇疆鍥哄畾IP
濡傛灉鍦ㄥ畨瑁呯殑榪囩▼涓錛屾病鏈夐氳繃涓婇潰絎涓縐嶆柟娉曢厤緗鍥哄畾IP錛岃屾槸鐩存帴浣跨敤鐨勬槸榛樿ょ殑DHCP妯″紡錛屽備笅闈㈢涓寮犲浘鎵紺恆傞偅涔堝氨闇瑕佸湪瀹夎呭畬鎴愪互鍚庢墜鍔ㄩ厤緗甀P銆
絳夌郴緇熷畨瑁呮垚鍔熷悗錛岃緭鍏ヨ處鍙峰瘑鐮侊紝浣跨敤ifconfig鍛戒護鏌ョ湅ip淇℃伅錛屽彲浠ョ湅鍒伴粯璁ゆ儏鍐典笅錛岀綉鍗ens33騫舵病鏈夎幏鍙栦換浣旾P鍦板潃淇℃伅錛屽嵆娌℃湁鐪嬪埌inet瀛楁牱銆
榪欎釜鏃跺欐垜浠鎵撳紑緗戝崱鐨勯厤緗鏂囦歡錛屽懡浠ゆ槸錛
vi/etc/sysconfig/network-scripts/ifcfg-ens33
鎵撳紑浠ュ悗鍙浠ョ湅鍒伴粯璁ょ殑閰嶇疆灝辨槸dhcp錛岀劧鍚巓nboot=no錛岃〃紺轟笉浼氶殢鐫緋葷粺鐨勫惎鍔ㄨ屽惎鍔ㄣ傛垜浠闇瑕佷慨鏀硅繖涓閰嶇疆銆
濡備笅鎵紺猴紝灝嗛厤緗淇鏀逛負錛
BOOTPROTO=static
琛ㄧず浣跨敤闈欐佸滻瀹欼P銆
onboot=yes
琛ㄧず緗戝崱闅忕潃緋葷粺鍚鍔ㄨ屽惎鍔ㄣ
鍚屾椂鍦ㄦ渶鍚庡姞涓婇渶瑕侀厤緗鐨処P鍦板潃淇℃伅銆傚傚浘涓鎵紺
閰嶇疆瀹屾垚鍚庯紝鎴戜滑浣跨敤鍛戒護錛
systemctlrestartnetwork
閲嶆柊鍚鍔ㄧ綉鍗★紝鐒跺悗鍐嶄嬌鐢╥fconfig鍛戒護鏌ョ湅緗戝崱淇℃伅錛屽彲浠ョ湅鍒癐P閰嶇疆宸茬粡鐢熸晥錛岀劧鍚庝嬌鐢╬ing鍛戒護ping涓涓嬬櫨搴︾殑緗戠珯銆傚彲浠ョ湅鍒版槸閫氱殑錛岃存槑IP鍦板潃閰嶇疆姝g『銆傝嚦姝わ紝涓ょ嶆柟娉曢厤緗鍥哄畾IP浠嬬粛瀹屾瘯銆