1.linux设置ipå°åçå½ä»¤linux设置ip
linux设置ipå°åçå½ä»¤linux设置ip
ipaæ¯ä»ä¹å½ä»¤ï¼å¨linuxç³»ç»å¯ä»¥æ¥çipå°åä¿¡æ¯çå½ä»¤ç±»ä¼¼linuxçifconfigï¼windowsipconfig
linuxæä¹è°è¯ï¼
1ã使ç¨printè¯å¥
è¿æ¯ä¸ä¸ªåºæ¬çè°è¯é®é¢çæ¹æ³ãæ们å¨ç¨åºä¸æççå°æ¹æå ¥printè¯å¥æ¥äºè§£ç¨åºçè¿è¡æµç¨æ§å¶æµååéå¼çæ¹åã
å®ç缺ç¹æ¯éè¦è¿è¡ç¨åºç¼è¾ï¼æ·»å printè¯å¥ï¼å¿ é¡»éæ°ç¼è¯ï¼éæ°è¿è¡æ¥è·å¾è¾åºãè¥éè¦è°è¯çç¨åºæ¯è¾å¤§ï¼è¿å°æ¯ä¸ä¸ªèæ¶è´¹åçæ¹æ³ã
2ã使ç¨æ¥è¯¢
å¨æäºæ åµä¸ï¼æ们éè¦å¼æ¸ æ¥å¨ä¸ä¸ªè¿è¡å¨å æ ¸ä¸çè¿ç¨çç¶æåå åæ å°ã为äºè·å¾è¿äºä¿¡æ¯ï¼æ们ä¸éè¦å¨å æ ¸ä¸æå ¥ä»»ä½ä»£ç ãç¸åï¼å¯ä»¥ç¨/procæ件系ç»ãå¨/procç伪æ件系ç»ï¼ä¿çç³»ç»å¯å¨è¿è¡å°±æ¶éçè¿è¡ä¿¡æ¯(cpuä¿¡æ¯,源码C语言SDL简单窗口源码å å容éç)ã
ls-l/procçè¾åºç»æï¼éè¿å¯¹ç³»ç»ä¸è¿è¡çæ¯ä¸ä¸ªè¿ç¨å¨/procæ件系ç»ä¸æä¸ä¸ªä»¥è¿ç¨idå½åç项ãæ¯ä¸ªè¿ç¨çç»èä¿¡æ¯å¯ä»¥å¨è¿ç¨id对åºçç®å½ä¸çæ件ä¸è·å¾ãä¹å¯ä»¥ls/proc/pidçè¾åºã
å è´¹è§é¢æç¨æ¨èï¼linuxè§é¢æç¨
3ã使ç¨è·è¸ª
straceçåltraceæ¯ä¸¤ä¸ªå¨Linuxä¸ç¨æ¥è¿½è¸ªç¨åºçæ§è¡ç»èçè·è¸ªå·¥å ·ã
strace:
straceæ¦æªåè®°å½ç³»ç»è°ç¨åå ¶æ¥æ¶çä¿¡å·ã对äºç¨æ·ï¼å®æ¾ç¤ºäºç³»ç»è°ç¨ãä¼ éç»å®ä»¬çåæ°åè¿åå¼ãstraceå¯ä»¥éçå°å·²å¨è¿è¡çè¿ç¨æä¸ä¸ªæ°çè¿ç¨ãå®ä½ä¸ºä¸ä¸ªé对å¼åè åç³»ç»ç®¡çåçè¯æãè°è¯å·¥å ·æ¯å¾æç¨çã
å®ä¹å¯ä»¥ç¨æ¥å½åä¸ä¸ªéè¿è·è¸ªä¸åçç¨åºè°ç¨æ¥äºè§£ç³»ç»çå·¥å ·ãè¿ä¸ªå·¥å ·ç好å¤æ¯ä¸éè¦æºä»£ç ï¼ç¨åºä¹ä¸éè¦éæ°ç¼è¯ã
使ç¨straceçåºæ¬è¯æ³æ¯ï¼
straceçè¾åºé常é¿ï¼æ们é常ä¸ä¼å¯¹æ¾ç¤ºçæ¯ä¸è¡é½æå ´è¶£ãæ们å¯ä»¥ç¨-eexpré项æ¥è¿æ»¤ä¸æ³è¦çæ°æ®ã
ç¨-ppidé项æ¥ç»å°è¿è¡ä¸çè¿ç¨ã
ç¨-oé项ï¼å½ä»¤çè¾åºå¯ä»¥è¢«éå®åå°æ件ã
straceè¿æ»¤æåªæç³»ç»è°ç¨çè¾åºã
ltrace:
ltraceè·è¸ªåè®°å½ä¸ä¸ªè¿ç¨çå¨æï¼è¿è¡æ¶ï¼åºçè°ç¨åå ¶æ¶å°çä¿¡å·ãå®ä¹å¯ä»¥è·è¸ªä¸ä¸ªè¿ç¨æä½çç³»ç»è°ç¨ãå®çç¨æ³æ¯ç±»ä¼¼ä¸straceã
-ié项å¨è°ç¨åºæ¶æå°æ令æéã
-Sé项被ç¨æ¥ç°å®ç³»ç»è°ç¨ååºè°ç¨.
traceææSTRCMPåºè°ç¨çè¾åºã
ç¸å ³æç« æç¨æ¨èï¼linuxæç¨
以ä¸å°±æ¯linuxä¸ç¨åºè°è¯çæ¹æ³æåªäºç详ç»å 容
linuxl2tpnsæä¹é ç½®ï¼
æå¼/etc/ipsec.confæ件ï¼åå¦ä¸é ç½®ï¼configsetupnat_traversal=yes#è¿éå å«çç½ç»å°åå 许é 置为è¿ç¨å®¢æ·ç«¯æå¨çåç½ãæ¢å¥è¯è¯´ï¼#è¿äºå°åèå´åºè¯¥æ¯ä½ çNATè·¯ç±å¨åé¢ç客æ·ç«¯çå°åãoe=offprotostack=netkeyconnL2TP-PSK-NATrightsubnet=vhost:%privalso=L2TP-PSK-noNATconnL2TP-PSK-noNATauthby=secretpfs=noauto=addkeyingtries=3rekey=no#AppleçiOSä¸ä¼åédeleteæéï¼#æ以æ们éè¦éè¿æ»äº¡å¯¹ç«¯ï¼deadpeerï¼æ£æµæ¥è¯å«ææç客æ·ç«¯dpddelay=dpdtimeout=dpdaction=clear#设置ikelifetimeåkeylifeåWindowsçé»è®¤è®¾ç½®ä¸è´ikelifetime=8hkeylife=1htype=transport#æ¿æ¢IPå°åä¸ºä½ çæ¬å°IPï¼ä¸è¬æ¯ï¼ç§æå°åãNATå çå°åï¼left=x.x.x.x#ç¨äºå级è¿çWindows/XP客æ·ç«¯leftprotoport=/#è¦æ¯æèç客æ·ç«¯ï¼éè¦è®¾ç½®leftprotoport=/%anyright=%anyrightprotoport=/%any#强å¶ææè¿æ¥é½NATï¼å 为iOSforceencaps=yes转载ï¼ä» ä¾åèãå¦ææç没帮å©å°æ¨ï¼è¯·ç»§ç»è¿½é®ã
linuxæä¹ç»ç½å¡å 临æ¶ipï¼
å¨å·¥ä½ä¸ç»å¸¸éå°éè¦ä¸ºæ个ç½å¡æ·»å ä¸ä¸ªä¸´æ¶IPï¼
æ·»å æ¹æ³ï¼
ifconfigem..2.netmask...0
ipaddradd..2./devem2
å é¤æ¹æ³ï¼
ipaddrdelete..2.deveth0:0ã建议å¨è¯¢ä¸ä¸ä¸ä¸äººå£«æ¯è¾å¥½ä¸ç¹ï¼æè æ¾ä¹¦çä¸ä¸ã