電訊茶室's Archiver

角色 發表於 2013-3-2 12:15

【OpenWRT】——Network Interface

TP-LINK TL-WR1043ND里的/etc/config/network[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 'ipaddr'   '192.168.1.1'
        option 'netmask'  '255.255.255.0'

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

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

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

config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan' '2'
        option 'ports' '0 5t'
[/code]

角色 發表於 2013-3-2 12:17

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

如果大家第一看这个file都不知道它们是什么?

其实1043D里的有两个ethernet interface:lo,eth0,eth1三个interfaces,eth1是给wireless用,现在我们不谈。主要是谈及lo和eth0。

ifname = interface name
proto = protocol
ipaddr = ip addresss

1. Interface: Loopback, 所有码都是standard嘢!loopback IP就是127.0.0.1[code]config 'interface' 'loopback'
       option 'ifname'   'lo'
       option 'proto'    'static'
       option 'ipaddr'   '127.0.0.1'
       option 'netmask'  '255.0.0.0'[/code]#

2. Interface:lan[code]config 'interface' 'lan'
        option 'ifname'   'eth0.1'
        option 'type'     'bridge'
        option 'proto'    'static'
        option 'ipaddr'   '192.168.1.1'
        option 'netmask'  '255.255.255.0'
[/code]#

3. Interface:wan[code]config 'interface' 'wan'
        option 'ifname' 'eth0.2'
        option 'proto' 'dhcp'
[/code]#

4. Enable VLAN[code]config 'switch'
        option 'name' 'rtl8366rb'
        option 'reset' '1'
        option 'enable_vlan' '1'

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

config 'switch_vlan'
        option 'device' 'rtl8366rb'
        option 'vlan' '2'
        option 'ports' '0 5t'
~
[/code]#
where "t" attached to the number "5" denotes tagged port
0: WAN port
1 2 3 4: LAN port
5: (internal) CPU port

角色 發表於 2013-3-2 22:07

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

原先
VLAN1:port 1,2,3,4
VLAN2:port 0

更改为
VLAN1:port 3,4
VLAN2:port 0
VLAN3:port 1,2

用luCI GUI

[attach]2253[/attach]

/etc/config/network was revised to[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 'ipaddr' '192.168.1.1'
        option 'netmask' '255.255.255.0'

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

config 'switch'
        option 'name' 'rtl8366rb'
        option 'reset' '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'
[/code]

頁: [1]

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