分享寂寞 <belonely.bbs@bbs.tku.edu.tw> wrote in message
news:3dhPFa$ILr@bbs.tku.edu.tw...
> 《 在 belonely (分享寂寞) 的大作中提到: 》
> : : >route add -net xxx.xxx.xxx.xxx netmast 255.255.255.0 dev etho
> : : >其實上面那一行就可以了…只是這樣較看得懂… …
> : : 可是這樣/etc/hosts好像沒有增加什麼耶,(好像跟我問的...)
> : : 不過剛好又學到新東西,
> : : 請問該行指令的功用是?
> : route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0
> : ==>把192.168.1.0這個子網路
> :    加到route裡.
> :    以後你要ping 192.168.1.xxx 的IP的可ping到.
> : 同法,
> : route add -net 192.168.0.0 netmask 255.255.0.0 dev eth0
> : 都可ping 192.xxx.xxx.xxx的IP,
> : 請問這樣設,和用Gateway:
> : route add -net 192.168.0.0 gw {某IP} netmask 255.255.0.0 dev eth0


前者只是當目的網路和指定界面在同一個 subnet 才有效。
後者是當當目的網路和指定界面不在同一個 subnet ﹐且必須經過指定 GW 才能到達﹐
但別忘了在對方網路﹐也設一個路由回來。


> 還有,怎麼把它存起來.(文字模式下)
> 以後一開機就可設好.

也可以把句子寫進 /etc/rc.d/rc.local 裡面﹐也可以修改
/etc/sysconfig/static-routes:
eth0 net 192.168.0.0 netmask 255.255.0.0 gw {某IP}