電訊茶室's Archiver

角色 發表於 2013-3-3 13:16

【OpenWRT】——Routing

[i=s] 本帖最後由 角色 於 2013-3-3 14:15 編輯 [/i]

引言——由于公司需要,把两边的segment的printer尽可能连接起来。而两家公司都是独立上网。所以需要用一个router。因为我知道OpenWRT能做VLAN和routing。但是。。。。。。。。。。。。OpenWRT本身的defualt firmware好像有bugs。

[attach]2254[/attach][code]config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'lan'
        option 'ifname' 'eth0.1'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'netmask' '255.255.255.0'
        option 'ipaddr' '192.168.10.1'

config 'interface' 'wan'
        option 'ifname' 'eth0.2'
        option 'proto' 'dhcp'

config 'switch'
        option 'name' 'rtl8366rb'
        option 'reset' '1'
        option 'enable_vlan' '1'
        option 'enable_vlan4k' '1'

config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan' '1'
        option 'ports' '3 4 5t'

config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan' '2'
        option 'ports' '0 5t'

config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan' '3'
        option 'ports' '1 2 5t'

config 'interface' 'lan2'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ifname' 'eth0.3'
        option 'ipaddr' '192.168.30.1'
        option 'netmask' '255.255.255.0'

config 'route'
        option 'interface' 'lan'
        option 'target' '192.168.30.0'
        option 'netmask' '255.255.255.0'
        option 'gateway' '192.168.30.1'

config 'route'
        option 'interface' 'lan2'
        option 'target' '192.168.10.0'
        option 'netmask' '255.255.255.0'
        option 'gateway' '192.168.10.1'
[/code]#

但是进入router里面,打route,竟然没有我added的static routes!!!:funk:[code]root@OpenWrt:/etc/config# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.30.0    *               255.255.255.0   U     0      0        0 br-lan2
192.168.10.0    *               255.255.255.0   U     0      0        0 br-lan
10.0.88.0       *               255.255.255.0   U     0      0        0 eth0.2
default         10.0.88.1       0.0.0.0         UG    0      0        0 eth0.2
root@OpenWrt:/etc/config#
[/code]#

那么先用手动add static route看看

1. 先add ip packages (我用GUI加入,非常简单)

ip (一件叫iproute2)

【1】wiki [url]http://en.wikipedia.org/wiki/Iproute2[/url]
【2】Linux Advanced Routing & Traffic Control HOWTO [url=http://lartc.org/howto/]Link[/url]
【3】IPROUTE2 Utility Suite Howto [url=http://www.policyrouting.org/iproute2.doc.html]Link[/url]

雯雯 發表於 2013-3-3 13:47

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=31086&ptid=5363]1#[/url] [i]角色[/i] [/b]

兩邊router lan port相連再在每邊router set static route是否可行?

角色 發表於 2013-3-3 14:02

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=31088&ptid=5363]2#[/url] [i]雯雯[/i] [/b]

现在问题是两边的routers,我没有admin权限。

雯雯 發表於 2013-3-3 14:05

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=31089&ptid=5363]3#[/url] [i]角色[/i] [/b]

但是你中間加部router仲難搞.

角色 發表於 2013-3-3 14:11

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=31090&ptid=5363]4#[/url] [i]雯雯[/i] [/b]

先问题是同一个router都不能把vlan1(LAN)与vlan3(LAN2)的IP互通。

雯雯 發表於 2013-3-3 14:26

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=31091&ptid=5363]5#[/url] [i]角色[/i] [/b]

剛才和ckleea兄傾過一下這個問題, 一般router像我用的fortigate和ckleea用的netgear, vlan互通都是在firewall裏面set.

頁: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.