Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to enable working mode switch and networking in OpenWRT

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how OpenWRT enables the working mode switch and networking. I hope you will get something after reading this article. Let's discuss it together.

The main configuration rc.local script is as follows:

Read_gpio () {(echo $1 > / sys/class/gpio/export) > & / dev/null (echo "in" > / sys/class/gpio/gpio$1/direction) > & / dev/null return `cat / sys/class/gpio/gpio$1/ value`;} read_gpio 19 / cat / sys/class/gpio/gpio$1/ value` 01001) v = "hotspot";; 11000) v = "4th";; *) v = "error";; esaccp / etc/config/$v/* / etc/config/logger working mode: $vexit 0

The principle is to boot and automatically copy the configuration files under / etc/config/. You don't need all the configuration files, just firewall, network and wireless. Name it according to the working mode and create three directories:

Mkdir / etc/config/apmkdir / etc/config/repeatermkdir / etc/config/hotspot

Later, we will write the configuration file and put it in these directories. Take ap as an example. In this mode, the network port is used to do WAN, and wireless LAN,WAN is done. Take ADSL access as an example, and other cases are self-adaptable:

Uci set wireless.@wifi-device [0] .password = 0bot UCI set wireless.@wifi-iface [0] .ssid='umu618.com';uci set wireless.@wifi-iface [0] .encryption='psk2+ccmp';uci set wireless.@wifi-iface [0] .key='WiFi password'; uci commit wireless Wifiuci delete network.lan.ifnameuci delete network.lan.typeuci add network interfaceuci rename network.@interface [- 1] = 'wan'uci set network.@interface [- 1] .ifname =' eth2'uci set network.@interface [- 1]. _ orig_ifname='eth2'uci set network.@interface [- 1]. _ orig_bridge='false'uci set network.@interface [- 1] .proto = 'pppoe'uci set network.@interface [- 1] .username =' broadband account 'uci set network.@interface [ -1] .password = 'broadband password' uci commit networkcp / etc/config/firewall / etc/config/ap/cp / etc/config/network / etc/config/ap/cp / etc/config/wireless / etc/config/ap/

Let's talk about repeater, network port to do LAN, wireless to do an AP Client and an AP. Note that the following command is based on the initialized configuration file. Please back up and restore in advance. Do not continue the configuration directly after configuring the previous ap mode. There may be problems.

Uci add network interfaceuci rename network.@interface [- 1] = 'wwan'uci set network.@interface [- 1] .proto =' dhcp'uci commit networkuci set wireless.@wifi-device [0] .password = 0bot uci set wireless.@wifi-iface [0] .ssid='umu618.com';uci set wireless.@wifi-iface [0] .encryption='psk2+ccmp';uci set wireless.@wifi-iface [0] .password' Uci add wireless wifi-ifaceuci set wireless.@wifi-iface [- 1] .network = 'wwan'uci set wireless.@wifi-iface [- 1] .ssid =' existing WiFi name 'uci set wireless.@wifi-iface [- 1] .device =' radio0'uci set wireless.@wifi-iface [- 1] .mode = 'sta'uci set wireless.@wifi-iface [- 1] .bssid =' MAC address of the existing wireless router 'uci set wireless.@wifi-iface [- 1] .device 'uci set wireless.@wifi-iface [- 1] .key =' existing WiFi password 'uci commit wireless Wifiuci get firewall.@zone [1] .networkuci show firewall.@zone [1] uci set firewall.@zone [1]. Network='wan wan6 wwan'uci commit firewall/etc/init.d/firewall restartcp / etc/config/firewall / etc/config/repeater/cp / etc/config/network / etc/config/repeater/cp / etc/config/wireless / etc/config/repeater/ after reading this article, I believe you have some understanding of "how to enable working mode switch and networking in OpenWRT" If you want to know more related knowledge, welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report