LAN/WAN config

From WRTnode Wiki Site
Jump to: navigation, search
This page contains changes which are not marked for translation.

Other languages:
English 100% • ‎中文(中国大陆)‎ 100%

In many cases, we need to customize a particular network port for LAN or WAN side on the WRTnode board.

There are many ways to accomplish this task: uboot compile-time setting in OpenWrt compile-time setting in OpenWrt of set in the configuration file.

Here we explain one of the most simple way: in: | set Wikipedia OpenWrt OpenWrt of the configuration file, and then explain how to compile OpenWrt Firmware stage default this setting.

In the OpenWrt after the start, we can find the /etc/config/nework file, edit the file using vi, you can find the following:

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '1 2 3 4 6t'
config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0 6t'

The above setup defines 2 vlan, 6t defines the mt7620 built-in switch, 1,2,3,4 defines 4 LAN, 0 defines an Ethernet WAN.

So, we can change the vlan 0, 1,2,3,4 according to our needs in order to define a LAN or WAN port (or even all network ports can be set to LAN or WAN, P-) However, the consequences ~ ~).

When done, simply restart the network interface

/etc/init.d/network restart 



We can define the network ports and setup on OpenWRT start, we want that firmware compilation phase to complete this by default.

We assume that $(TOPDIR) for OpenWrt of compiler directory.

vi $(TOPDIR)/target/linux/ramips/base-files/etc/uci-defaults/02_network 

Find the following parameters:

        wrtnode)
                ucidef_set_interfaces_lan_wan "eth0.1" "apcli0"
                ucidef_add_switch "switch0" "1" "1"
                ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
                ucidef_add_switch_vlan "switch0" "2" "0 6t"
                ;;

Now you should know how to change the network ports according to your needs :)

Keep on rock!