修改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

你可能感兴趣的:(OpenWRT,php,开发语言)