Linuxä¸å¢å 软路ç±ç两ç§æ¹æ³
第ä¸ç§:
route add -net 172.16.6.0 netmask 255.255.255.0 gw 172.16.2.254 dev eth0
/* å¢å ä¸æ¡ç½ç»172.16.6.0/24 ç»è¿172.16.2.254 eth0 */
/* -netå¢å ç½ç» -hostå¢å ä¸»æº netmask åç½æ©ç gw ç½å
³ dev è£
ç½®,设å¤,è¿éæ¯ä½ çç½å¡å*/
route del gw 172.16.2.254 /* å é¤é»è®¤ç½å
³172.16.2.254 */
route del -net 172.16.86.0/24 /* å é¤é»è®¤ç½ç»172.16.86.0 */
route /* æ¾ç¤ºå½åè·¯ç±è¡¨ */
常ç¨çæ¯è¿ç§æ¹å¼,ä½ææ¶ä½ å¨å é¤æä¸æ¡è½¯è·¯ç±æ¶ä¼ä¸èµ·ä½ç¨,ä¼æä»ä¹æ示:
SIOCADDRT: æ æ³æ¥è§¦ç½è·¯
æ以è¿æ¶ç¨å¦ä¸çè¿ç§æ¹æ³å°±å¯ä»¥äº
第äºç§:
å®ç°çåè½åä¸é¢çä¸æ ·
ip route add 172.16.6.0/24 via 172.16.2.254 dev eth0
ip route del gw 172.16.2.254
ip route del 172.16.6.0/24 dev eth0
ip route
å é¤çæ¹æ³ï¼
æ·»å è·¯ç±:
route add -net 10.0.0.0 netmask 255.0.0.0 dev eth0
å é¤è·¯ç±ï¼
route del -net 10.0.0.0 netmask 255.0.0.0 dev eth0
æ·»å é»è®¤è·¯ç±ï¼
route add default gw 10.0.0.1
å é¤é»è®¤è·¯ç±ï¼
route del default gw 10.0.0.1
æè
route del default
---------------------------------------------------------------------------------------
linuxä¸æ·»å è·¯ç±çæ¹æ³ï¼
ããä¸ï¼ä½¿ç¨ route å½ä»¤æ·»å
ãã使ç¨route å½ä»¤æ·»å çè·¯ç±ï¼æºå¨éå¯æè
ç½å¡éå¯åè·¯ç±å°±å¤±æäºï¼æ¹æ³ï¼
ãã//æ·»å å°ä¸»æºçè·¯ç±
ãã# route add âhost 192.168.168.110 dev eth0
ãã# route add âhost 192.168.168.119 gw 192.168.168.1
ãã//æ·»å å°ç½ç»çè·¯ç±
ãã# route add ânet IP netmask MASK eth0
ãã# route add ânet IP netmask MASK gw IP
ãã# route add ânet IP/24 eth1
ãã//æ·»å é»è®¤ç½å
³
ãã# route add default gw IP
ãã//å é¤è·¯ç±
ãã# route del âhost 192.168.168.110 dev eth0
ããäºï¼å¨linuxä¸è®¾ç½®æ°¸ä¹
è·¯ç±çæ¹æ³ï¼
ãã1.å¨/etc/rc.localéæ·»å
ããæ¹æ³ï¼
ããroute add -net 192.168.3.0/24 dev eth0
ããroute add -net 192.168.2.0/24 gw 192.168.3.254
ãã2.å¨/etc/sysconfig/networkéæ·»å å°æ«å°¾
ããæ¹æ³ï¼GATEWAY=gw-ip æè
GATEWAY=gw-dev
ãã3./etc/sysconfig/static-router :
ããany net x.x.x.x/24 gw y.y.y.y
温馨提示:答案为网友推荐,仅供参考