修改openwrt 默认参数

网络配置

方法一: 使用板级参数定义

在以下文件中定义好板子上的网口,及需要配置的IP地址 , 编译系统会将此作为输入,

  1. 文件一:
vim friendlywrt/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
            nanopi-r5s)
                    ucidef_set_interface_wan 'eth0'
                    ucidef_set_interface "lan" device  "eth1 eth2" protocol "static" ipaddr "192.168.2.1"
  1. 文件二:
    vim friendlywrt/target/linux/rockchip/armv8/base-files/etc/board.d/02_network
    rockchip_setup_interfaces()
    {
    local board=“ 1 " l o c a l b o a r d n a m e = " 1" local boardname=" 1"localboardname="{board##*,}”

     case "$boardname" in
     nanopi-r2s | \
     nanopi-r2c | \
     nanopi-r4s | \
     nanopi-r2 | \
     nanopi-r5c | \
     nanopi-r6c | \
     nanopi-r4s)
         ##ucidef_set_interface_wan 'eth0'
         ucidef_set_interface "lan" device  "eth1" protocol "static" ipaddr "192.168.2.1"
         ucidef_set_interface "lan" device  "eth1" protocol "static" ipaddr "192.168.2.1"
         ;;
    

方法二:使用config/network

创建默认网络配置文件 :

##vim friendlywrt/package/base-files/files/etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd00:ab:cd::/48'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'eth0'
        option proto 'static'
        option device 'eth0'
        option ipaddr '192.x.x.x'
        option netmask '255.255.255.0'

其他默认配置

#修改默认密码
friendlywrt/package/base-files/files/etc/shadow 
#修改开机启动界面
#vim friendlywrt/package/base-files/files/etc/banner

#修改代理arp: arp-proxy, 编辑以下文件增加arp代理配置
vim device/common/default-settings/sysctl/etc/sysctl.conf
net.ipv4.conf.all.proxy_arp=1
net.ipv4.conf.eth1.proxy_arp=1
net.ipv4.conf.eth0.proxy_arp=1

#修改hostname (主机名), 编辑以下文件 ,增加kernel.hostname = "XX"
device/common/default-settings/sysctl/etc/sysctl.conf

#修改 opkg 源
vim device/common/distfeeds/install.sh
  • 22
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

月光技术杂谈

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值