openwrt lan/wan口自動翻轉


參考:

http://www.right.com.cn/forum/thread-75532-1-1.html

該實驗基於ar9331 dragino2板子的,板子只引出一個LAN口。

1、 固件編譯

make menuconfig

Kernel modules --->

Network Devices --->

<*> kmod-macvlan

Network --->

Routing and Redirection --->

<*> ip

2、 配置

/etc/rc.local

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

ip link add link eth0 eth2 type macvlan
ifconfig eth2 hw ether 00:11:22:33:44:5b
ifconfig eth2 up

exit 0

/etc/config/network

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 'eth2'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '192.168.18.1'
        option 'netmask' '255.255.255.0'

config 'interface' 'wan'
        option 'proto' 'dhcp'
        option 'ifname' 'eth0'
        option 'hostname' 'openwrt'

3、 重啟

注意:

要把wan口默認的eth1改成eth0,使得開機默認就是wan口。

要把lan口的eth0改成eth2,不知道為什么改成eth1就是不行。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM