Board logo

標題: 【OpenWRT】——Routing [打印本頁]

作者: 角色    時間: 2013-3-3 13:16     標題: 【OpenWRT】——Routing

本帖最後由 角色 於 2013-3-3 14:15 編輯

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

[attach]2254[/attach]
  1. config 'interface' 'loopback'
  2.         option 'ifname' 'lo'
  3.         option 'proto' 'static'
  4.         option 'ipaddr' '127.0.0.1'
  5.         option 'netmask' '255.0.0.0'

  6. config 'interface' 'lan'
  7.         option 'ifname' 'eth0.1'
  8.         option 'type' 'bridge'
  9.         option 'proto' 'static'
  10.         option 'netmask' '255.255.255.0'
  11.         option 'ipaddr' '192.168.10.1'

  12. config 'interface' 'wan'
  13.         option 'ifname' 'eth0.2'
  14.         option 'proto' 'dhcp'

  15. config 'switch'
  16.         option 'name' 'rtl8366rb'
  17.         option 'reset' '1'
  18.         option 'enable_vlan' '1'
  19.         option 'enable_vlan4k' '1'

  20. config 'switch_vlan'
  21.         option 'device' 'rtl8366rb'
  22.         option 'vlan' '1'
  23.         option 'ports' '3 4 5t'

  24. config 'switch_vlan'
  25.         option 'device' 'rtl8366rb'
  26.         option 'vlan' '2'
  27.         option 'ports' '0 5t'

  28. config 'switch_vlan'
  29.         option 'device' 'rtl8366rb'
  30.         option 'vlan' '3'
  31.         option 'ports' '1 2 5t'

  32. config 'interface' 'lan2'
  33.         option 'type' 'bridge'
  34.         option 'proto' 'static'
  35.         option 'ifname' 'eth0.3'
  36.         option 'ipaddr' '192.168.30.1'
  37.         option 'netmask' '255.255.255.0'

  38. config 'route'
  39.         option 'interface' 'lan'
  40.         option 'target' '192.168.30.0'
  41.         option 'netmask' '255.255.255.0'
  42.         option 'gateway' '192.168.30.1'

  43. config 'route'
  44.         option 'interface' 'lan2'
  45.         option 'target' '192.168.10.0'
  46.         option 'netmask' '255.255.255.0'
  47.         option 'gateway' '192.168.10.1'
複製代碼
#

但是进入router里面,打route,竟然没有我added的static routes!!!
  1. root@OpenWrt:/etc/config# route
  2. Kernel IP routing table
  3. Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
  4. 192.168.30.0    *               255.255.255.0   U     0      0        0 br-lan2
  5. 192.168.10.0    *               255.255.255.0   U     0      0        0 br-lan
  6. 10.0.88.0       *               255.255.255.0   U     0      0        0 eth0.2
  7. default         10.0.88.1       0.0.0.0         UG    0      0        0 eth0.2
  8. root@OpenWrt:/etc/config#
複製代碼
#

那么先用手动add static route看看

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

ip (一件叫iproute2)

【1】wiki http://en.wikipedia.org/wiki/Iproute2
【2】Linux Advanced Routing & Traffic Control HOWTO Link
【3】IPROUTE2 Utility Suite Howto Link
作者: 雯雯    時間: 2013-3-3 13:47

回復 1# 角色

兩邊router lan port相連再在每邊router set static route是否可行?
作者: 角色    時間: 2013-3-3 14:02

回復 2# 雯雯

现在问题是两边的routers,我没有admin权限。
作者: 雯雯    時間: 2013-3-3 14:05

回復 3# 角色

但是你中間加部router仲難搞.
作者: 角色    時間: 2013-3-3 14:11

回復 4# 雯雯

先问题是同一个router都不能把vlan1(LAN)与vlan3(LAN2)的IP互通。
作者: 雯雯    時間: 2013-3-3 14:26

回復 5# 角色

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




歡迎光臨 電訊茶室 (http://www.telecom-cafe.com/forum/) Powered by Discuz! 7.2