zoukankan      html  css  js  c++  java
  • 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就是不行。

  • 相关阅读:
    坚持
    随笔
    C++:对象和类
    STEP7 V14 安装和激活
    c++:cout
    C 格式化字符串处理函数
    WIn:消极处理机制
    Python:requests发送json格式数据
    Python:logging日志功能的基本使用
    PLC:西门子测试
  • 原文地址:https://www.cnblogs.com/smbx-ztbz/p/4998179.html
Copyright © 2011-2022 走看看