Linux下如何加入路由,使多個不同網段能相互訪問

tolywang發表於2007-11-02

Linux下設定路由,使多個不同網段能相互訪問。 Linux AS3.0 。


[root@PDM8_NewDB etc]# cat rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/opt/Navisphere/bin/naviserverutilcli update

route add -net 10.16.0.0 netmask 255.255.0.0 gw 10.16.24.1 dev eth0
route add -net 10.15.0.0 netmask 255.255.0.0 gw 10.16.24.1 dev eth0
route add -net 10.19.0.0 netmask 255.255.0.0 gw 10.16.24.1 dev eth0

[root@PDM8_NewDB etc]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:1D:09:08:7A:AB
inet addr:10.161.24.60 Bcast:10.16.27.255 Mask:255.255.252.0
inet6 addr: fe80::21d:9ff:fe08:7aab/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:216785968 errors:0 dropped:0 overruns:0 frame:0
TX packets:107362918 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:325968126242 (303.5 GiB) TX bytes:7519689253 (7.0 GiB)
Interrupt:169 Memory:d6000000-d6011100

eth1 Link encap:Ethernet HWaddr 00:1D:09:08:7A:A9
inet addr:10.14.68.22 Bcast:192.168.11.255 Mask:255.255.252.0
inet6 addr: fe80::21d:9ff:fe08:7aa9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:524084 errors:0 dropped:0 overruns:0 frame:0
TX packets:2133 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:43949525 (41.9 MiB) TX bytes:137236 (134.0 KiB)
Interrupt:169 Memory:da000000-da011100

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:63645 errors:0 dropped:0 overruns:0 frame:0
TX packets:63645 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3182601 (3.0 MiB) TX bytes:3182601 (3.0 MiB)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-84990/,如需轉載,請註明出處,否則將追究法律責任。

相關文章